soapforce 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd5c5c5b9695c66f12ab00cbee13da2b42642241
4
- data.tar.gz: d0ba26805133773096f3a56ea1f036cd52c96f87
3
+ metadata.gz: b7c46d6400d937ff6e2d4f5228eb5471dadc485b
4
+ data.tar.gz: f7e7361eb79e6aec2b93fd19a2ab4827209dbe88
5
5
  SHA512:
6
- metadata.gz: 8ae925b874a554018c6506afe733ac7797d27eb243e3143a08ef8fe6a9527878d1c0cced97f204e58cb89efb29276cdf1be7e865c3255a117e655c31b5a90263
7
- data.tar.gz: 7d0db9b99d00f006f991fe75327918fa90d60843cfe7b3889dfe4f1af622e82dcb8c37bf306c1b1aff4744819253c5cd85506bfe317dfcfca1046999c24e3632
6
+ metadata.gz: 7fc6271269f00251aaa1e0927c1dac79f1221fb6061d74b3b51e2022e0ba4a9edb27fc970c7cc5166d573240de673615979788d92b9cfd7cd3e041f7609629f2
7
+ data.tar.gz: 8d18b2bfe192277f2f294d8689149151f83a4564fb7fa471d81b3f051fa9f183907a431d80c676b1534225c1bb8bf93a46271faed59f466d033aae8ffcbd8834
@@ -1,3 +1,7 @@
1
+ ## 0.8.0 (Aug 27, 2018)
2
+ * Add Log Filter Options for Savon #33
3
+ * Modified upsert method #22
4
+
1
5
  ## 0.7.0 (Jan 21, 2017)
2
6
  * Support Savon timeout and proxy options #19
3
7
  * Updated Partner WSDL #20
@@ -29,6 +29,10 @@ module Soapforce
29
29
  # Due to SSLv3 POODLE vulnerabilty and disabling of TLSv1, use TLSv1_2
30
30
  @ssl_version = options[:ssl_version] || :TLSv1_2
31
31
 
32
+ # For security purposes, default to filtering out passwords
33
+ # To override this, include the following in the opportunities hash: filters => []
34
+ @filters = options[:filters] || [:password]
35
+
32
36
  if options[:tag_style] == :raw
33
37
  @tag_style = :raw
34
38
  @response_tags = lambda { |key| key }
@@ -50,6 +54,7 @@ module Soapforce
50
54
  convert_request_keys_to: :none,
51
55
  convert_response_tags_to: @response_tags,
52
56
  pretty_print_xml: true,
57
+ filters: @filters,
53
58
  logger: @logger,
54
59
  log: (@logger != false),
55
60
  endpoint: @login_url,
@@ -102,6 +107,7 @@ module Soapforce
102
107
  convert_request_keys_to: :none,
103
108
  convert_response_tags_to: @response_tags,
104
109
  logger: @logger,
110
+ filters: @filters,
105
111
  log: (@logger != false),
106
112
  endpoint: @server_url,
107
113
  ssl_version: @ssl_version # Sets ssl_version for HTTPI adapter
@@ -300,11 +306,30 @@ module Soapforce
300
306
  # Examples
301
307
  #
302
308
  # # Update the record with external ID of 12
303
- # client.upsert!('Account', 'External__c', External__c: 12, Name: 'Foobar')
309
+ # client.upsert('Account', 'External__c', External__c: 12, Name: 'Foobar')
304
310
  #
305
311
  # Returns Hash if the record was found and updated or newly created.
306
312
  # Raises an exception if an error is returned from Salesforce.
307
313
  def upsert(sobject_type, external_id_field_name, objects)
314
+ upsert!(sobject_type, external_id_field_name, objects)
315
+ rescue
316
+ false
317
+ end
318
+
319
+ # Public: Update or create a record based on an external ID
320
+ #
321
+ # sobject - The name of the sobject to created.
322
+ # field - The name of the external Id field to match against.
323
+ # attrs - Hash of attributes for the record.
324
+ #
325
+ # Examples
326
+ #
327
+ # # Update the record with external ID of 12
328
+ # client.upsert!('Account', 'External__c', External__c: 12, Name: 'Foobar')
329
+ #
330
+ # Returns Hash if the record was found and updated or newly created.
331
+ # Raises an exception if an error is returned from Salesforce.
332
+ def upsert!(sobject_type, external_id_field_name, objects)
308
333
  message = {externalIDFieldName: external_id_field_name}.merge(sobjects_hash(sobject_type, objects))
309
334
  call_soap_api(:upsert, message)
310
335
  end
@@ -1,3 +1,3 @@
1
1
  module Soapforce
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "savon", ">= 2.3.0", '< 3.0.0'
22
22
 
23
23
  spec.add_development_dependency 'rspec', '>= 2.14.0', '< 4.0.0'
24
- spec.add_development_dependency 'webmock', '>= 1.17.0', '< 2.0.0'
24
+ spec.add_development_dependency 'webmock', '>=2.3.2'
25
25
  spec.add_development_dependency 'simplecov', '>= 0.9.0', '< 1.0.0'
26
26
  end
@@ -319,7 +319,7 @@ describe Soapforce::Client do
319
319
 
320
320
  describe "#update" do
321
321
  before(:each) do
322
- @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>"
322
+ @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>"
323
323
  @params = { Id: '003ABCDE', Name: "SOAPForce Opportunity", CloseDate: '2013-08-12', StageName: 'Closed Won' }
324
324
  end
325
325
 
@@ -356,7 +356,7 @@ describe Soapforce::Client do
356
356
 
357
357
  describe "#upsert" do
358
358
  before(:each) do
359
- @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>"
359
+ @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>"
360
360
  @objects = [
361
361
  { Name: "New Opportunity", CloseDate: '2013-08-12', StageName: 'Prospecting' },
362
362
  { Id: '003ABCDE', Name: "Existing Opportunity", CloseDate: '2013-08-12', StageName: 'Closed Won' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soapforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Heth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2018-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -56,20 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.17.0
60
- - - "<"
61
- - !ruby/object:Gem::Version
62
- version: 2.0.0
59
+ version: 2.3.2
63
60
  type: :development
64
61
  prerelease: false
65
62
  version_requirements: !ruby/object:Gem::Requirement
66
63
  requirements:
67
64
  - - ">="
68
65
  - !ruby/object:Gem::Version
69
- version: 1.17.0
70
- - - "<"
71
- - !ruby/object:Gem::Version
72
- version: 2.0.0
66
+ version: 2.3.2
73
67
  - !ruby/object:Gem::Dependency
74
68
  name: simplecov
75
69
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
158
  version: '0'
165
159
  requirements: []
166
160
  rubyforge_project:
167
- rubygems_version: 2.5.1
161
+ rubygems_version: 2.6.11
168
162
  signing_key:
169
163
  specification_version: 4
170
164
  summary: Wraps Savon with helper methods and custom types for interacting with the