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

Add Log Filter Options for Savon #33

Merged
merged 5 commits into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/soapforce/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def initialize(options = {})
# Due to SSLv3 POODLE vulnerabilty and disabling of TLSv1, use TLSv1_2
@ssl_version = options[:ssl_version] || :TLSv1_2

# For security purposes, default to filtering out passwords
# To override this, include the following in the opportunities hash: filters => []
@filters = options[:filters] || [:password]

if options[:tag_style] == :raw
@tag_style = :raw
@response_tags = lambda { |key| key }
Expand All @@ -50,6 +54,7 @@ def initialize(options = {})
convert_request_keys_to: :none,
convert_response_tags_to: @response_tags,
pretty_print_xml: true,
filters: @filters,
logger: @logger,
log: (@logger != false),
endpoint: @login_url,
Expand Down Expand Up @@ -102,6 +107,7 @@ def login(options={})
convert_request_keys_to: :none,
convert_response_tags_to: @response_tags,
logger: @logger,
filters: @filters,
log: (@logger != false),
endpoint: @server_url,
ssl_version: @ssl_version # Sets ssl_version for HTTPI adapter
Expand Down
2 changes: 1 addition & 1 deletion soapforce.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "savon", ">= 2.3.0", '< 3.0.0'

spec.add_development_dependency 'rspec', '>= 2.14.0', '< 4.0.0'
spec.add_development_dependency 'webmock', '>= 1.17.0', '< 2.0.0'
spec.add_development_dependency 'webmock', '>=2.3.2'
spec.add_development_dependency 'simplecov', '>= 0.9.0', '< 1.0.0'
end
4 changes: 2 additions & 2 deletions spec/lib/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@

describe "#update" do
before(:each) do
@body = "<tns:update><tns:sObjects><ins0:type>Opportunity</ins0:type><ins0:Id>003ABCDE</ins0:Id><tns:Name>SOAPForce Opportunity</tns:Name><tns:CloseDate>2013-08-12</tns:CloseDate><tns:StageName>Closed Won</tns:StageName></tns:sObjects></tns:update>"
@body = "<tns:update><tns:sObjects><ins0:type>Opportunity</ins0:type><tns:Id>003ABCDE</tns:Id><tns:Name>SOAPForce Opportunity</tns:Name><tns:CloseDate>2013-08-12</tns:CloseDate><tns:StageName>Closed Won</tns:StageName></tns:sObjects></tns:update>"
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't expect the namespace to change. Any idea why it did?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, not really, but it looks like a Savon issue savonrb/savon#830

@params = { Id: '003ABCDE', Name: "SOAPForce Opportunity", CloseDate: '2013-08-12', StageName: 'Closed Won' }
end

Expand Down Expand Up @@ -356,7 +356,7 @@

describe "#upsert" do
before(:each) do
@body = "<tns:upsert><tns:externalIDFieldName>External_Id__c</tns:externalIDFieldName><tns:sObjects><ins0:type>Opportunity</ins0:type><tns:Name>New Opportunity</tns:Name><tns:CloseDate>2013-08-12</tns:CloseDate><tns:StageName>Prospecting</tns:StageName></tns:sObjects><tns:sObjects><ins0:type>Opportunity</ins0:type><ins0:Id>003ABCDE</ins0:Id><tns:Name>Existing Opportunity</tns:Name><tns:CloseDate>2013-08-12</tns:CloseDate><tns:StageName>Closed Won</tns:StageName></tns:sObjects></tns:upsert>"
@body = "<tns:upsert><tns:externalIDFieldName>External_Id__c</tns:externalIDFieldName><tns:sObjects><ins0:type>Opportunity</ins0:type><tns:Name>New Opportunity</tns:Name><tns:CloseDate>2013-08-12</tns:CloseDate><tns:StageName>Prospecting</tns:StageName></tns:sObjects><tns:sObjects><ins0:type>Opportunity</ins0:type><tns:Id>003ABCDE</tns:Id><tns:Name>Existing Opportunity</tns:Name><tns:CloseDate>2013-08-12</tns:CloseDate><tns:StageName>Closed Won</tns:StageName></tns:sObjects></tns:upsert>"
@objects = [
{ Name: "New Opportunity", CloseDate: '2013-08-12', StageName: 'Prospecting' },
{ Id: '003ABCDE', Name: "Existing Opportunity", CloseDate: '2013-08-12', StageName: 'Closed Won' }
Expand Down