Skip to content

Commit 40d7cbf

Browse files
committed
Derive WSDL from API endpoint
1 parent 2e0a880 commit 40d7cbf

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lib/marketo_api/client.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class MarketoAPI::Client
2121
namespaces: { 'xmlns:ns1' => 'http://www.marketo.com/mktows/' },
2222
pretty_print_xml: true,
2323
ssl_verify_mode: :none,
24+
ssl_version: :TLSv1,
2425
convert_request_keys_to: :none,
2526
}.freeze
2627
DEFAULT_CONFIG.values.each(&:freeze)
@@ -69,6 +70,7 @@ class MarketoAPI::Client
6970
# +ssl_verify_mode+:: How to verify SSL keys. This version defaults to
7071
# +none+. Version 1.0 will default to normal
7172
# verification.
73+
# +ssl_version+:: The SSL version to use. Defaults to TLSv1.
7274
# +headers+:: Headers to use. Defaults to Connection: Keep-Alive.
7375
# Version 1.0 will enforce at least this value.
7476
#
@@ -85,8 +87,8 @@ def initialize(config = {})
8587
encryption_key = config.delete(:encryption_key)
8688
@auth = AuthHeader.new(user_id, encryption_key)
8789

88-
@wsdl = "http://app.marketo.com/soap/mktows/#{api_version}?WSDL".freeze
8990
@endpoint = "https://#{subdomain}.mktoapi.com/soap/mktows/#{api_version}".freeze
91+
@wsdl = "#{@endpoint}?WSDL".freeze
9092
@savon = Savon.client(config.merge(wsdl: wsdl, endpoint: endpoint))
9193
end
9294

test/marketo_api/test_client.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,17 @@ def test_subdomain
1818
assert_equal 'testable', setup_client(api_subdomain: 'testable').subdomain
1919
end
2020

21-
def test_wsdl
22-
assert_equal "http://app.marketo.com/soap/mktows/2_3?WSDL",
23-
subject.wsdl
24-
assert_equal "http://app.marketo.com/soap/mktows/2_4?WSDL",
25-
setup_client(api_version: '2_4').wsdl
26-
end
27-
2821
def test_endpoint
2922
assert_equal "https://123-ABC-456.mktoapi.com/soap/mktows/2_3",
3023
subject.endpoint
3124
assert_equal "https://testable.mktoapi.com/soap/mktows/2_4",
3225
setup_client(api_subdomain: 'testable', api_version: '2_4').endpoint
3326
end
3427

28+
def test_wsdl
29+
assert_equal "#{subject.endpoint}?WSDL", subject.wsdl
30+
end
31+
3532
def test_generated_methods
3633
assert subject.respond_to? :campaigns
3734
assert subject.respond_to? :leads

0 commit comments

Comments
 (0)