zanox_api 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/zanox_api.rb +13 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2811a431265f917e26e8eaeb40b52761b32ab18
|
4
|
+
data.tar.gz: 6ab4bf364ab479b7257f01d1d3b8c20efb9bec17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b33466f0776bb64f6708604eaa3b5055ecba0955252ba39b0abb35c3bec5d30975790099bb720f1b684076dc8e3864a39a7009aab24b3aa0b6b84cbe0595bc10
|
7
|
+
data.tar.gz: 4b0a3120f466bd27df60813452264150d97a296a2305b7ad30704c88c9b1ac0543ca944c89c9ecd32e4ebcd7a66eb477254751f569cf2d4a6e8c163bdabe4034
|
data/lib/zanox_api.rb
CHANGED
@@ -55,7 +55,7 @@ module Zanox
|
|
55
55
|
@service_name = service_name
|
56
56
|
@connect_id = options[:connect_id]
|
57
57
|
@secret_key = options[:secret_key]
|
58
|
-
@base_api_url = options[:api_url] || '
|
58
|
+
@base_api_url = options[:api_url] || 'https://api.zanox.com/wsdl/2011-03-01'
|
59
59
|
@normalize_responses = options[:normalize_responses]
|
60
60
|
|
61
61
|
@savon_client = Savon.client({
|
@@ -63,16 +63,23 @@ module Zanox
|
|
63
63
|
log: options[:log],
|
64
64
|
log_level: options[:log_level],
|
65
65
|
logger: options[:logger],
|
66
|
-
pretty_print_xml: options[:
|
66
|
+
pretty_print_xml: options[:pretty_print_xml],
|
67
67
|
})
|
68
68
|
end
|
69
69
|
|
70
70
|
def method_missing(name, *args, &block)
|
71
|
-
|
72
|
-
params
|
71
|
+
name = name.to_s
|
72
|
+
params = if name.start_with?('authenticated_')
|
73
|
+
name = name.gsub(/^authenticated_/, '')
|
74
|
+
Zanox::API.params_for_method(@service_name, name.gsub('_', '').downcase, @secret_key)
|
75
|
+
else
|
76
|
+
{}
|
77
|
+
end
|
78
|
+
|
79
|
+
params.merge!(connect_id: @connect_id)
|
73
80
|
params.merge!(args[0] || {})
|
74
81
|
response = @savon_client.call(name.to_sym, message: params)
|
75
|
-
contents = response.body[(name
|
82
|
+
contents = response.body[(name + '_response').to_sym]
|
76
83
|
if @normalize_responses
|
77
84
|
Zanox::API.normalize_response(contents)
|
78
85
|
else
|
@@ -89,6 +96,7 @@ module Zanox
|
|
89
96
|
|
90
97
|
class DataClient < Client
|
91
98
|
def initialize(options = {})
|
99
|
+
options[:api_url] ||= 'https://data.zanox.com/wsdl/2011-05-01'
|
92
100
|
super('dataservice', options)
|
93
101
|
end
|
94
102
|
end
|