Skip to content

Conversation

Nerdenberger
Copy link

As a user of the SOAP API I often need to pass headers such as 'AllOrNone' or 'AssignmentRule' to salesforce to fit the requirements of my integration.

This PR adds the ability for a user to pass an optional headers argument to most SOAP calls.

header = { "AllOrNoneHeader" => { "allOrNone" => true } } 
client.upsert(table, external_id, batch, header)

@jheth
Copy link
Contributor

jheth commented Aug 16, 2017

Hey @Nerdenberger! Thanks for the PR. It looks like we have a mix of tabs vs spaces. Can you fix that up?


@headers = options[:headers] if options[:headers]

@headers = { 'tns:CallOptions' => { 'tns:client' => client_id } } if client_id
Copy link
Contributor

Choose a reason for hiding this comment

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

This combination of client_id would not work with optional headers. What if you merge the hashes? @headers.merge(options[:headers]) if options[:headers].is_a?(Hash)


def query(soql)
call_soap_api(:query, {:queryString => soql})
def query(soql, header={})
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of passing header into every method I think you can use @headers in call_soap_api and it would apply to all calls. Do you ever find yourself needing different headers per request?

@jheth
Copy link
Contributor

jheth commented Aug 29, 2017

@Nerdenberger What do you think of the comments I left on the commits?

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.

2 participants