Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create arbitrary SObjects from Map #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sebbean
Copy link

@sebbean sebbean commented May 19, 2016

Enables commands such as:

resp = Forcex.post("/services/data/v20.0/sobjects/Case/", %{ "Subject" => "API TEST 2", "Priority" => "High", "Origin" => "Web"}, client)

Looking to also implement a helper function for creating SObjects using Forcex.Client. Any thoughts or input?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling 82878d2 on sebbean:task/enable-sobject-create-call into cd8b4d2 on jeffweiss:master.

@sebbean sebbean changed the title content-type header necessary in POST request Create arbitrary SObjects from Map May 19, 2016
|> create_sobject(name, map)
end
def create_sobject(client, name, map) do
Forcex.post("/services/data/v20.0/sobjects/#{name}", map, client)
Copy link
Author

@sebbean sebbean May 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffweiss curious why you chose to have Forcex module methods use a trailing client param rather than leading (for pipeline operator)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebbean the reason that I have client as the trailing param is that for most of the calls, it is the least relevant to the name of the function. True, moving client to the first parameter would make it more cases of using |> possible, but client isn't the focus of many of the functions, nor is it transformed by many of the functions (the obvious exception is Forcex.Client).

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling 60618d3 on sebbean:task/enable-sobject-create-call into cd8b4d2 on jeffweiss:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling 61a182d on sebbean:task/enable-sobject-create-call into cd8b4d2 on jeffweiss:master.

@jeffweiss
Copy link
Owner

@sebbean First of all, thank you!
I think we already have something that ought to create an SObject from a map: https://github.com/jeffweiss/forcex/blob/master/lib/mix/tasks/compile.forcex.ex#L80
That said, creating and updating SObject is not my primary use case with this lib, so it hasn't gotten any exercise. We probably do need to set the content type. I will do some investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants