laximo 0.7 → 0.8
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/README.md +32 -44
- data/laximo.gemspec +2 -2
- data/lib/laximo.rb +4 -4
- data/lib/laximo/am.rb +6 -6
- data/lib/laximo/defaults.rb +2 -0
- data/lib/laximo/oem.rb +46 -62
- data/lib/laximo/options.rb +17 -57
- data/lib/laximo/query.rb +69 -136
- data/lib/laximo/request.rb +13 -36
- data/lib/laximo/respond/{find_detail.rb → am/find_detail.rb} +0 -0
- data/lib/laximo/respond/{find_oem.rb → am/find_oem.rb} +0 -0
- data/lib/laximo/respond/{find_oem_correction.rb → am/find_oem_correction.rb} +0 -0
- data/lib/laximo/respond/{find_replacements.rb → am/find_replacements.rb} +7 -2
- data/lib/laximo/respond/{list_manufacturer.rb → am/list_manufacturer.rb} +6 -2
- data/lib/laximo/respond/{manufacturer_info.rb → am/manufacturer_info.rb} +6 -2
- data/lib/laximo/respond/{exec_custom_operation.rb → oem/exec_custom_operation.rb} +1 -0
- data/lib/laximo/respond/oem/find_vehicle.rb +27 -0
- data/lib/laximo/respond/{find_vehicle_by_frame.rb → oem/find_vehicle_by_frame.rb} +1 -0
- data/lib/laximo/respond/{find_vehicle_by_wizard.rb → oem/find_vehicle_by_frame_no.rb} +4 -3
- data/lib/laximo/respond/{find_vehicle_by_vin.rb → oem/find_vehicle_by_vin.rb} +1 -0
- data/lib/laximo/respond/{find_vehicle_by_wizard2.rb → oem/find_vehicle_by_wizard2.rb} +1 -0
- data/lib/laximo/respond/{get_catalog_info.rb → oem/get_catalog_info.rb} +0 -0
- data/lib/laximo/respond/{get_filter_by_detail.rb → oem/get_filter_by_detail.rb} +6 -2
- data/lib/laximo/respond/{get_filter_by_unit.rb → oem/get_filter_by_unit.rb} +1 -0
- data/lib/laximo/respond/{get_unit_info.rb → oem/get_unit_info.rb} +1 -0
- data/lib/laximo/respond/{get_vehicle_info.rb → oem/get_vehicle_info.rb} +1 -0
- data/lib/laximo/respond/{get_wizard2.rb → oem/get_wizard2.rb} +1 -0
- data/lib/laximo/respond/{get_wizard_next_step2.rb → oem/get_wizard_next_step2.rb} +0 -0
- data/lib/laximo/respond/{list_catalogs.rb → oem/list_catalogs.rb} +1 -0
- data/lib/laximo/respond/{list_categories.rb → oem/list_categories.rb} +6 -2
- data/lib/laximo/respond/{list_detail_by_unit.rb → oem/list_detail_by_unit.rb} +1 -0
- data/lib/laximo/respond/{list_image_map_by_unit.rb → oem/list_image_map_by_unit.rb} +6 -2
- data/lib/laximo/respond/{list_quick_detail.rb → oem/list_quick_detail.rb} +1 -0
- data/lib/laximo/respond/{list_quick_group.rb → oem/list_quick_group.rb} +6 -2
- data/lib/laximo/respond/{list_units.rb → oem/list_units.rb} +1 -0
- data/lib/laximo/version.rb +1 -1
- metadata +32 -32
- data/lib/laximo/respond/get_wizard.rb +0 -26
data/lib/laximo/options.rb
CHANGED
|
@@ -5,116 +5,76 @@ module Laximo
|
|
|
5
5
|
|
|
6
6
|
extend self
|
|
7
7
|
|
|
8
|
-
def use_login(str = nil)
|
|
9
|
-
|
|
10
|
-
::Laximo.deprecated!
|
|
11
|
-
|
|
12
|
-
return (@use_login === true) if str.nil?
|
|
13
|
-
@use_login = str
|
|
14
|
-
|
|
15
|
-
end # use login
|
|
16
|
-
|
|
17
8
|
def login(str = nil)
|
|
18
9
|
|
|
19
10
|
return @login if str.nil?
|
|
20
11
|
@login = str
|
|
21
12
|
|
|
22
|
-
end
|
|
13
|
+
end
|
|
23
14
|
|
|
24
15
|
def password(str = nil)
|
|
25
16
|
|
|
26
17
|
return @password if str.nil?
|
|
27
18
|
@password = str
|
|
28
19
|
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def ssl_key(str = nil)
|
|
32
|
-
|
|
33
|
-
::Laximo.deprecated!
|
|
34
|
-
|
|
35
|
-
return @ssl_key if str.nil?
|
|
36
|
-
raise ::LoadError.new("File #{str} is not found") unless File.exists?(str)
|
|
37
|
-
|
|
38
|
-
@ssl_key = ::OpenSSL::PKey::RSA.new(::File.read(str))
|
|
39
|
-
|
|
40
|
-
end # ssl_key
|
|
41
|
-
|
|
42
|
-
def ssl_cert(str = nil)
|
|
43
|
-
|
|
44
|
-
::Laximo.deprecated!
|
|
45
|
-
|
|
46
|
-
return @ssl_cert if str.nil?
|
|
47
|
-
raise ::LoadError.new("File #{str} is not found") unless File.exists?(str)
|
|
48
|
-
|
|
49
|
-
@ssl_cert = ::OpenSSL::X509::Certificate.new(::File.read(str))
|
|
50
|
-
|
|
51
|
-
end # ssl_cert
|
|
52
|
-
|
|
53
|
-
def ssl_verify(str = nil)
|
|
54
|
-
|
|
55
|
-
::Laximo.deprecated!
|
|
56
|
-
|
|
57
|
-
return @ssl_verify if str.nil?
|
|
58
|
-
@ssl_verify = (str === true ? ::OpenSSL::SSL::VERIFY_PEER : ::OpenSSL::SSL::VERIFY_NONE)
|
|
59
|
-
|
|
60
|
-
end # ssl_verify
|
|
61
|
-
|
|
62
|
-
def use_ssl(str = nil)
|
|
63
|
-
|
|
64
|
-
return (@use_ssl === true) if str.nil?
|
|
65
|
-
@use_ssl = str
|
|
66
|
-
|
|
67
|
-
end # use_ssl
|
|
20
|
+
end
|
|
68
21
|
|
|
69
22
|
def timeout(str = nil)
|
|
70
23
|
|
|
71
24
|
return @timeout if str.nil?
|
|
72
25
|
@timeout = String(str).to_i(10).abs
|
|
73
26
|
|
|
74
|
-
end
|
|
27
|
+
end
|
|
75
28
|
|
|
76
29
|
def user_agent(str = nil)
|
|
77
30
|
|
|
78
31
|
return @user_agent if str.nil?
|
|
79
32
|
@user_agent = str
|
|
80
33
|
|
|
81
|
-
end
|
|
34
|
+
end
|
|
82
35
|
|
|
83
36
|
def debug(str = nil)
|
|
84
37
|
@debug = (str === true)
|
|
85
|
-
end
|
|
38
|
+
end
|
|
86
39
|
|
|
87
40
|
def debug?
|
|
88
41
|
@debug === true
|
|
89
|
-
end
|
|
42
|
+
end
|
|
90
43
|
|
|
91
44
|
def am_soap_action(str = nil)
|
|
92
45
|
|
|
93
46
|
return @am_soap_action if str.nil?
|
|
94
47
|
@am_soap_action = str
|
|
95
48
|
|
|
96
|
-
end
|
|
49
|
+
end
|
|
97
50
|
|
|
98
51
|
def am_soap_endpoint(str = nil)
|
|
99
52
|
|
|
100
53
|
return @am_soap_endpoint if str.nil?
|
|
101
54
|
@am_soap_endpoint = str
|
|
102
55
|
|
|
103
|
-
end
|
|
56
|
+
end
|
|
104
57
|
|
|
105
58
|
def oem_soap_action(str = nil)
|
|
106
59
|
|
|
107
60
|
return @oem_soap_action if str.nil?
|
|
108
61
|
@oem_soap_action = str
|
|
109
62
|
|
|
110
|
-
end
|
|
63
|
+
end
|
|
111
64
|
|
|
112
65
|
def oem_soap_endpoint(str = nil)
|
|
113
66
|
|
|
114
67
|
return @oem_soap_endpoint if str.nil?
|
|
115
68
|
@oem_soap_endpoint = str
|
|
116
69
|
|
|
117
|
-
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def locale(str = nil)
|
|
73
|
+
|
|
74
|
+
return @locale if str.nil?
|
|
75
|
+
@locale = str
|
|
76
|
+
|
|
77
|
+
end
|
|
118
78
|
|
|
119
79
|
end # Options
|
|
120
80
|
|
data/lib/laximo/query.rb
CHANGED
|
@@ -8,189 +8,113 @@ module Laximo
|
|
|
8
8
|
@func_name = func_name
|
|
9
9
|
@query = {}
|
|
10
10
|
|
|
11
|
-
end
|
|
11
|
+
end
|
|
12
12
|
|
|
13
13
|
def locale(v = nil)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@query[:Locale] = escape(v)
|
|
17
|
-
self
|
|
18
|
-
|
|
19
|
-
end # locale
|
|
14
|
+
add_param(:Locale, v)
|
|
15
|
+
end
|
|
20
16
|
|
|
21
17
|
def ssd(v = nil)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@query[:ssd] = escape(v)
|
|
25
|
-
self
|
|
26
|
-
|
|
27
|
-
end # ssd
|
|
18
|
+
add_param(:ssd, v)
|
|
19
|
+
end
|
|
28
20
|
|
|
29
21
|
def catalog(v = nil)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@query[:Catalog] = escape(v)
|
|
33
|
-
self
|
|
34
|
-
|
|
35
|
-
end # catalog
|
|
22
|
+
add_param(:Catalog, v)
|
|
23
|
+
end
|
|
36
24
|
|
|
37
25
|
def operation(v = nil)
|
|
26
|
+
add_param(:operation, v)
|
|
27
|
+
end
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
@query[:operation] = escape(v)
|
|
41
|
-
self
|
|
42
|
-
|
|
43
|
-
end # operation
|
|
29
|
+
def param(h = {})
|
|
44
30
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if v.is_a?(Hash) && !v.empty?
|
|
49
|
-
@query[v.keys.first] = escape(v.values.first)
|
|
50
|
-
end
|
|
31
|
+
h.each { |k, v|
|
|
32
|
+
add_param(k, v)
|
|
33
|
+
}
|
|
51
34
|
self
|
|
52
35
|
|
|
53
|
-
end
|
|
36
|
+
end
|
|
54
37
|
|
|
55
38
|
def localized(v = false)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
@query[:Localized] = (v === true)
|
|
59
|
-
self
|
|
60
|
-
|
|
61
|
-
end # localized
|
|
39
|
+
add_param(:Localized, (v === true))
|
|
40
|
+
end
|
|
62
41
|
|
|
63
42
|
def wizard_id(v = nil)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
@query[:WizardId] = escape(v)
|
|
67
|
-
self
|
|
68
|
-
|
|
69
|
-
end # wizard_id
|
|
43
|
+
add_param(:WizardId, v)
|
|
44
|
+
end
|
|
70
45
|
|
|
71
46
|
def value_id(v = nil)
|
|
47
|
+
add_param(:ValueId, v)
|
|
48
|
+
end
|
|
72
49
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
end # value_id
|
|
78
|
-
|
|
79
|
-
def options(args = [])
|
|
80
|
-
|
|
81
|
-
@str = nil
|
|
82
|
-
@query[:Options] = args.empty? ? nil : args.join(',')
|
|
83
|
-
self
|
|
84
|
-
|
|
85
|
-
end # options
|
|
50
|
+
def options(v = [])
|
|
51
|
+
add_param(:Options, v)
|
|
52
|
+
end
|
|
86
53
|
|
|
87
54
|
def brand(v = nil)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
@query[:Brand] = escape(v)
|
|
91
|
-
self
|
|
92
|
-
|
|
93
|
-
end # brand
|
|
55
|
+
add_param(:Brand, v)
|
|
56
|
+
end
|
|
94
57
|
|
|
95
58
|
def oem(v = nil)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
@query[:OEM] = escape(v)
|
|
99
|
-
self
|
|
100
|
-
|
|
101
|
-
end # oem
|
|
59
|
+
add_param(:OEM, v)
|
|
60
|
+
end
|
|
102
61
|
|
|
103
62
|
def detail_id(v = nil)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@query[:DetailId] = escape(v)
|
|
107
|
-
self
|
|
108
|
-
|
|
109
|
-
end # detail_id
|
|
63
|
+
add_param(:DetailId, v)
|
|
64
|
+
end
|
|
110
65
|
|
|
111
66
|
def manufacturer_id(v = nil)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
@query[:ManufacturerId] = escape(v)
|
|
115
|
-
self
|
|
116
|
-
|
|
117
|
-
end # manufacturer_id
|
|
67
|
+
add_param(:ManufacturerId, v)
|
|
68
|
+
end
|
|
118
69
|
|
|
119
70
|
def vin(v = nil)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
@query[:VIN] = escape(v)
|
|
123
|
-
self
|
|
124
|
-
|
|
125
|
-
end # vin
|
|
71
|
+
add_param(:VIN, v)
|
|
72
|
+
end
|
|
126
73
|
|
|
127
74
|
def frame(v = nil)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
@query[:Frame] = escape(v)
|
|
131
|
-
self
|
|
132
|
-
|
|
133
|
-
end # frame
|
|
75
|
+
add_param(:Frame, v)
|
|
76
|
+
end
|
|
134
77
|
|
|
135
78
|
def frame_no(v = nil)
|
|
79
|
+
add_param(:FrameNo, v)
|
|
80
|
+
end
|
|
136
81
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
end # frame_no
|
|
82
|
+
def ident_string(v = nil)
|
|
83
|
+
add_param(:IdentString, v)
|
|
84
|
+
end
|
|
142
85
|
|
|
143
86
|
def vehicle_id(v = nil)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
@query[:VehicleId] = escape(v)
|
|
147
|
-
self
|
|
148
|
-
|
|
149
|
-
end # vehicle_id
|
|
87
|
+
add_param(:VehicleId, v)
|
|
88
|
+
end
|
|
150
89
|
|
|
151
90
|
def category_id(v = nil)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
@query[:CategoryId] = escape(v)
|
|
155
|
-
self
|
|
156
|
-
|
|
157
|
-
end # category_id
|
|
91
|
+
add_param(:CategoryId, v)
|
|
92
|
+
end
|
|
158
93
|
|
|
159
94
|
def unit_id(v = nil)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
@query[:UnitId] = escape(v)
|
|
163
|
-
self
|
|
164
|
-
|
|
165
|
-
end # unit_id
|
|
95
|
+
add_param(:UnitId, v)
|
|
96
|
+
end
|
|
166
97
|
|
|
167
98
|
def filter(v = nil)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
@query[:Filter] = escape(v)
|
|
171
|
-
self
|
|
172
|
-
|
|
173
|
-
end # filter
|
|
99
|
+
add_param(:Filter, v)
|
|
100
|
+
end
|
|
174
101
|
|
|
175
102
|
def quick_group_id(v = nil)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
@query[:QuickGroupId] = escape(v)
|
|
179
|
-
self
|
|
180
|
-
|
|
181
|
-
end # quick_group_id
|
|
103
|
+
add_param(:QuickGroupId, v)
|
|
104
|
+
end
|
|
182
105
|
|
|
183
106
|
def all(v = nil)
|
|
184
107
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
108
|
+
add_param(
|
|
109
|
+
:QuickGroupId,
|
|
110
|
+
(v === true || v == 1 || v == '1' ? 1 : 0)
|
|
111
|
+
)
|
|
188
112
|
|
|
189
|
-
end
|
|
113
|
+
end
|
|
190
114
|
|
|
191
115
|
def call(request)
|
|
192
116
|
request.call(self.to_s)
|
|
193
|
-
end
|
|
117
|
+
end
|
|
194
118
|
|
|
195
119
|
def to_s
|
|
196
120
|
|
|
@@ -205,15 +129,24 @@ module Laximo
|
|
|
205
129
|
@str[0] = ''
|
|
206
130
|
@str = "#{@func_name}:#{@str}"
|
|
207
131
|
|
|
208
|
-
end
|
|
132
|
+
end
|
|
209
133
|
|
|
210
134
|
alias :to_str :to_s
|
|
211
135
|
|
|
212
136
|
private
|
|
213
137
|
|
|
214
|
-
def
|
|
215
|
-
|
|
216
|
-
|
|
138
|
+
def add_param(k, v)
|
|
139
|
+
|
|
140
|
+
if v.is_a?(::Array)
|
|
141
|
+
@query[k] = v.empty? ? nil : v.join(',')
|
|
142
|
+
else
|
|
143
|
+
@query[k] = v.nil? ? nil : String(v)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
@str = nil
|
|
147
|
+
self
|
|
148
|
+
|
|
149
|
+
end
|
|
217
150
|
|
|
218
151
|
end # Query
|
|
219
152
|
|
data/lib/laximo/request.rb
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# encoding: utf-8
|
|
2
2
|
module Laximo
|
|
3
3
|
|
|
4
|
-
REQUEST_MSG = %q(<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
-
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
|
|
6
|
-
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
7
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
|
|
8
|
-
<SOAP-ENV:Body>
|
|
9
|
-
<ns5692:QueryData xmlns:ns5692="%{act}">
|
|
10
|
-
<request xsi:type="xsd:string">%{msg}</request>
|
|
11
|
-
</ns5692:QueryData>
|
|
12
|
-
</SOAP-ENV:Body>
|
|
13
|
-
</SOAP-ENV:Envelope>).freeze
|
|
14
|
-
|
|
15
4
|
REQUEST_LOGIN_MSG = %q(<?xml version="1.0" encoding="UTF-8"?>
|
|
16
5
|
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
|
|
17
6
|
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
@@ -39,31 +28,24 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://sch
|
|
|
39
28
|
set_request_params
|
|
40
29
|
set_http_params
|
|
41
30
|
|
|
42
|
-
end
|
|
31
|
+
end
|
|
43
32
|
|
|
44
33
|
def call(msg)
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
@request.body = REQUEST_LOGIN_MSG % {
|
|
53
|
-
msg: msg,
|
|
54
|
-
act: @soap_action,
|
|
55
|
-
login: ::Laximo.options.login,
|
|
56
|
-
hash: hash(msg, ::Laximo.options.password)
|
|
57
|
-
}
|
|
58
|
-
end
|
|
35
|
+
@request.body = (REQUEST_LOGIN_MSG % {
|
|
36
|
+
msg: msg,
|
|
37
|
+
act: @soap_action,
|
|
38
|
+
login: ::Laximo.options.login,
|
|
39
|
+
hash: hash(msg, ::Laximo.options.password)
|
|
40
|
+
})
|
|
59
41
|
|
|
60
42
|
begin
|
|
61
43
|
@http.request @request
|
|
62
|
-
rescue => ex
|
|
44
|
+
rescue ::Exception => ex
|
|
63
45
|
ex
|
|
64
46
|
end
|
|
65
47
|
|
|
66
|
-
end
|
|
48
|
+
end
|
|
67
49
|
|
|
68
50
|
private
|
|
69
51
|
|
|
@@ -74,18 +56,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://sch
|
|
|
74
56
|
@http.use_ssl = ssl?
|
|
75
57
|
@http.verify_mode = ::OpenSSL::SSL::VERIFY_NONE
|
|
76
58
|
|
|
77
|
-
if ::Laximo.options.use_ssl
|
|
78
|
-
@http.key = ::Laximo.options.ssl_key
|
|
79
|
-
@http.cert = ::Laximo.options.ssl_cert
|
|
80
|
-
end
|
|
81
|
-
|
|
82
59
|
@http.open_timeout = ::Laximo.options.timeout
|
|
83
60
|
@http.read_timeout = ::Laximo.options.timeout
|
|
84
61
|
@http.ssl_timeout = ::Laximo.options.timeout
|
|
85
62
|
|
|
86
63
|
self
|
|
87
64
|
|
|
88
|
-
end
|
|
65
|
+
end
|
|
89
66
|
|
|
90
67
|
def set_request_params
|
|
91
68
|
|
|
@@ -96,11 +73,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://sch
|
|
|
96
73
|
|
|
97
74
|
self
|
|
98
75
|
|
|
99
|
-
end
|
|
76
|
+
end
|
|
100
77
|
|
|
101
78
|
def hash(command, password)
|
|
102
79
|
::Digest::MD5::hexdigest "#{command}#{password}"
|
|
103
|
-
end
|
|
80
|
+
end
|
|
104
81
|
|
|
105
82
|
def ssl?
|
|
106
83
|
@uri.scheme == 'https'.freeze
|