-
Notifications
You must be signed in to change notification settings - Fork 25
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
Accepts Headers #25
base: master
Are you sure you want to change the base?
Accepts Headers #25
Conversation
Hey @Nerdenberger! Thanks for the PR. It looks like we have a mix of tabs vs spaces. Can you fix that up? |
@@ -19,6 +19,9 @@ def initialize(options = {}) | |||
# to make SOAP calls in Professional/Group Edition organizations. | |||
|
|||
client_id = options[:client_id] || Soapforce.configuration.client_id | |||
|
|||
@headers = options[:headers] if options[:headers] | |||
|
|||
@headers = { 'tns:CallOptions' => { 'tns:client' => client_id } } if client_id |
There was a problem hiding this comment.
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)
@@ -204,21 +207,21 @@ def describe_layout(sobject_type, layout_id=nil) | |||
response | |||
end | |||
|
|||
def query(soql) | |||
call_soap_api(:query, {:queryString => soql}) | |||
def query(soql, header={}) |
There was a problem hiding this comment.
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?
@Nerdenberger What do you think of the comments I left on the commits? |
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.