rms_api_ruby 0.1.0 → 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/.rubocop.yml +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +40 -12
- data/config/wsdl/inventory_v_1.0.wsdl +587 -0
- data/lib/rms_api_ruby.rb +6 -0
- data/lib/rms_api_ruby/chain/soap_client.rb +7 -5
- data/lib/rms_api_ruby/config.rb +3 -1
- data/lib/rms_api_ruby/inventory.rb +72 -0
- data/lib/rms_api_ruby/order.rb +77 -0
- data/lib/rms_api_ruby/orders.rb +10 -99
- data/lib/rms_api_ruby/soap_api.rb +35 -0
- data/lib/rms_api_ruby/soap_api/client.rb +78 -0
- data/lib/rms_api_ruby/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6beebfbe603b7e26e86bd033dd82de0076b3f1f026d0955b7f22beea696af9cd
|
|
4
|
+
data.tar.gz: 35754f19da9146aea6e08846bc15f432cd0ba4ce225338f68f81e020cf6cac2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b9aa67da7fb52c1c4f74e22c170bdad02bb3df0af1b5f6c6098bc07f70cb6d195cfd05e7c7c06dc65cd8e3bc201ad0a686465eb4f65338eeff8e4ef29688d78
|
|
7
|
+
data.tar.gz: 1a62876866c2f6d92f43ecd44cb089c9e2fe45a2e6b151998bd6dce1ab1cac659946fe5fe227a20688021a5f4fe2cbbb54c21a94489d1ef33989dd829f7bd3fe
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# RmsApiRuby
|
|
2
2
|
|
|
3
|
-
RmsApiRuby is a ruby gem for the RMS(Rakuten Marchant Service) Web API.
|
|
3
|
+
RmsApiRuby is a ruby gem for the RMS(Rakuten Marchant Service) Web API. By default all API calls will return [Hashie::Mash](https://github.com/intridea/hashie/tree/v1.2.0) objects.
|
|
4
|
+
At this time this gem supports OrderAPI and InventoryAPI only.
|
|
4
5
|
|
|
5
6
|
Support
|
|
6
7
|
- OrderAPI
|
|
8
|
+
- InventoryAPI
|
|
7
9
|
|
|
8
10
|
Not Support yet
|
|
9
11
|
- ItemAPI
|
|
@@ -13,7 +15,6 @@ Not Support yet
|
|
|
13
15
|
- CategoryAPI
|
|
14
16
|
- CouponAPI
|
|
15
17
|
- ShopManagimentAPI
|
|
16
|
-
- InventoryAPI
|
|
17
18
|
- System Event Notification Service
|
|
18
19
|
- RakutenPayOrderAPI
|
|
19
20
|
- PaymentAPI
|
|
@@ -50,24 +51,27 @@ Or can set any of the options via this way
|
|
|
50
51
|
|
|
51
52
|
```ruby
|
|
52
53
|
RmsApiRuby.configure do |config|
|
|
53
|
-
config.service_secret
|
|
54
|
-
config.license_key
|
|
55
|
-
config.shop_url
|
|
56
|
-
config.
|
|
57
|
-
config.
|
|
54
|
+
config.service_secret = 'Your RMS service secret'
|
|
55
|
+
config.license_key = 'Your RMS license key'
|
|
56
|
+
config.shop_url = 'Your RMS shop url'
|
|
57
|
+
config.user_name = 'user name' # default 'rms_api_ruby'
|
|
58
|
+
config.order_api_version = 'Order API version' # default 1.0
|
|
59
|
+
config.inventory_api_version = 'Inventory API version' # default 1.0
|
|
58
60
|
end
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
### Example
|
|
62
64
|
|
|
63
|
-
####
|
|
65
|
+
#### OrderAPI
|
|
66
|
+
|
|
67
|
+
##### GetOrder
|
|
64
68
|
|
|
65
69
|
```ruby
|
|
66
70
|
args = {
|
|
67
71
|
is_order_number_only_flag: false,
|
|
68
72
|
order_number: ['Rakuten order number you want'],
|
|
69
73
|
}
|
|
70
|
-
response = RmsApiRuby::
|
|
74
|
+
response = RmsApiRuby::Order.get_order(args)
|
|
71
75
|
# => #<Hashie::Mash>
|
|
72
76
|
|
|
73
77
|
response.error_code
|
|
@@ -80,10 +84,10 @@ rakuten_order = response.order_model
|
|
|
80
84
|
# => #<Hashie::Mash>
|
|
81
85
|
```
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
##### ChangeStatus
|
|
84
88
|
|
|
85
89
|
```ruby
|
|
86
|
-
response = RmsApiRuby::
|
|
90
|
+
response = RmsApiRuby::Order.get_request_id
|
|
87
91
|
# => #<Hashie::Mash>
|
|
88
92
|
|
|
89
93
|
response.error_code
|
|
@@ -105,7 +109,7 @@ args = {
|
|
|
105
109
|
]
|
|
106
110
|
}
|
|
107
111
|
|
|
108
|
-
response = RmsApiRuby::
|
|
112
|
+
response = RmsApiRuby::Order.change_status(args)
|
|
109
113
|
# => #<Hashie::Mash>
|
|
110
114
|
|
|
111
115
|
response.error_code
|
|
@@ -116,6 +120,30 @@ response.message
|
|
|
116
120
|
|
|
117
121
|
```
|
|
118
122
|
|
|
123
|
+
### InventoryAPI
|
|
124
|
+
|
|
125
|
+
#### GetInventoryExternal
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
args = {
|
|
129
|
+
inventory_search_range: 100
|
|
130
|
+
}
|
|
131
|
+
response = RmsApiRuby::Inventory.get_inventory_external(args)
|
|
132
|
+
# => #<Hashie::Mash>
|
|
133
|
+
|
|
134
|
+
response.keys
|
|
135
|
+
# => ["err_code", "err_message", "get_response_external_item", "@xmlns:n1", "@xmlns:n2", "@xsi:type"]
|
|
136
|
+
|
|
137
|
+
response.err_code
|
|
138
|
+
# => 'N00-000'
|
|
139
|
+
|
|
140
|
+
response.err_message
|
|
141
|
+
# => '正常終了'
|
|
142
|
+
|
|
143
|
+
response.get_response_external_item
|
|
144
|
+
# => #<Hashie::Mash>
|
|
145
|
+
```
|
|
146
|
+
|
|
119
147
|
## Development
|
|
120
148
|
|
|
121
149
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<definitions xmlns:tns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
3
|
+
xmlns:wsr="http://www.openuri.org/2002/10/soap/reliability/"
|
|
4
|
+
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
|
|
5
|
+
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
|
|
6
|
+
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
|
|
7
|
+
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
|
8
|
+
xmlns:soap12enc="http://www.w3.org/2003/05/soap-encoding"
|
|
9
|
+
xmlns:conv="http://www.openuri.org/2002/04/wsdl/conversation/"
|
|
10
|
+
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
|
11
|
+
xmlns:s="http://www.w3.org/2001/XMLSchema"
|
|
12
|
+
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
|
13
|
+
targetNamespace="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi">
|
|
14
|
+
<types>
|
|
15
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
16
|
+
xmlns:stns="java:language_builtins.lang"
|
|
17
|
+
elementFormDefault="qualified"
|
|
18
|
+
attributeFormDefault="qualified"
|
|
19
|
+
targetNamespace="java:language_builtins.lang">
|
|
20
|
+
<xsd:complexType name="ArrayOfString">
|
|
21
|
+
<xsd:sequence>
|
|
22
|
+
<xsd:element type="xsd:string"
|
|
23
|
+
name="string"
|
|
24
|
+
minOccurs="0"
|
|
25
|
+
maxOccurs="unbounded"
|
|
26
|
+
nillable="true">
|
|
27
|
+
</xsd:element>
|
|
28
|
+
</xsd:sequence>
|
|
29
|
+
</xsd:complexType>
|
|
30
|
+
</xsd:schema>
|
|
31
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
32
|
+
xmlns:stns="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
33
|
+
elementFormDefault="qualified"
|
|
34
|
+
attributeFormDefault="qualified"
|
|
35
|
+
targetNamespace="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity">
|
|
36
|
+
<xsd:import namespace="java:language_builtins.lang">
|
|
37
|
+
</xsd:import>
|
|
38
|
+
<xsd:complexType name="ArrayOfGetResponseExternalItem">
|
|
39
|
+
<xsd:sequence>
|
|
40
|
+
<xsd:element type="stns:GetResponseExternalItem"
|
|
41
|
+
name="GetResponseExternalItem"
|
|
42
|
+
minOccurs="0"
|
|
43
|
+
maxOccurs="unbounded"
|
|
44
|
+
nillable="true">
|
|
45
|
+
</xsd:element>
|
|
46
|
+
</xsd:sequence>
|
|
47
|
+
</xsd:complexType>
|
|
48
|
+
<xsd:complexType name="ArrayOfGetResponseExternalItemDetail">
|
|
49
|
+
<xsd:sequence>
|
|
50
|
+
<xsd:element type="stns:GetResponseExternalItemDetail"
|
|
51
|
+
name="GetResponseExternalItemDetail"
|
|
52
|
+
minOccurs="0"
|
|
53
|
+
maxOccurs="unbounded"
|
|
54
|
+
nillable="true">
|
|
55
|
+
</xsd:element>
|
|
56
|
+
</xsd:sequence>
|
|
57
|
+
</xsd:complexType>
|
|
58
|
+
<xsd:complexType name="ArrayOfUpdateRequestExternalItem">
|
|
59
|
+
<xsd:sequence>
|
|
60
|
+
<xsd:element type="stns:UpdateRequestExternalItem"
|
|
61
|
+
name="UpdateRequestExternalItem"
|
|
62
|
+
minOccurs="0"
|
|
63
|
+
maxOccurs="unbounded"
|
|
64
|
+
nillable="true">
|
|
65
|
+
</xsd:element>
|
|
66
|
+
</xsd:sequence>
|
|
67
|
+
</xsd:complexType>
|
|
68
|
+
<xsd:complexType name="ArrayOfUpdateResponseExternalItem">
|
|
69
|
+
<xsd:sequence>
|
|
70
|
+
<xsd:element type="stns:UpdateResponseExternalItem"
|
|
71
|
+
name="UpdateResponseExternalItem"
|
|
72
|
+
minOccurs="0"
|
|
73
|
+
maxOccurs="unbounded"
|
|
74
|
+
nillable="true">
|
|
75
|
+
</xsd:element>
|
|
76
|
+
</xsd:sequence>
|
|
77
|
+
</xsd:complexType>
|
|
78
|
+
<xsd:complexType name="UpdateSingleRequestExternalItem">
|
|
79
|
+
<xsd:sequence>
|
|
80
|
+
<xsd:element type="stns:UpdateRequestExternalItem"
|
|
81
|
+
name="UpdateRequestExternalItem"
|
|
82
|
+
minOccurs="0"
|
|
83
|
+
maxOccurs="1"
|
|
84
|
+
nillable="true">
|
|
85
|
+
</xsd:element>
|
|
86
|
+
</xsd:sequence>
|
|
87
|
+
</xsd:complexType>
|
|
88
|
+
<xsd:complexType name="ExternalUserAuthModel">
|
|
89
|
+
<xsd:complexContent>
|
|
90
|
+
<xsd:extension base="stns:UserAuthBase">
|
|
91
|
+
<xsd:sequence>
|
|
92
|
+
<xsd:element type="xsd:string"
|
|
93
|
+
name="shopUrl"
|
|
94
|
+
minOccurs="1"
|
|
95
|
+
maxOccurs="1"
|
|
96
|
+
nillable="true">
|
|
97
|
+
</xsd:element>
|
|
98
|
+
</xsd:sequence>
|
|
99
|
+
</xsd:extension>
|
|
100
|
+
</xsd:complexContent>
|
|
101
|
+
</xsd:complexType>
|
|
102
|
+
<xsd:complexType name="GetRequestExternalModel">
|
|
103
|
+
<xsd:complexContent>
|
|
104
|
+
<xsd:extension base="stns:RequestModel">
|
|
105
|
+
<xsd:sequence>
|
|
106
|
+
<xsd:element type="xsd:string"
|
|
107
|
+
name="inventorySearchRange"
|
|
108
|
+
minOccurs="1"
|
|
109
|
+
maxOccurs="1"
|
|
110
|
+
nillable="true">
|
|
111
|
+
</xsd:element>
|
|
112
|
+
<xsd:element xmlns:tp="java:language_builtins.lang"
|
|
113
|
+
type="tp:ArrayOfString"
|
|
114
|
+
name="itemUrl"
|
|
115
|
+
minOccurs="1"
|
|
116
|
+
maxOccurs="1"
|
|
117
|
+
nillable="true">
|
|
118
|
+
</xsd:element>
|
|
119
|
+
</xsd:sequence>
|
|
120
|
+
</xsd:extension>
|
|
121
|
+
</xsd:complexContent>
|
|
122
|
+
</xsd:complexType>
|
|
123
|
+
<xsd:complexType name="GetResponseExternalItem">
|
|
124
|
+
<xsd:sequence>
|
|
125
|
+
<xsd:element type="stns:ArrayOfGetResponseExternalItemDetail"
|
|
126
|
+
name="getResponseExternalItemDetail"
|
|
127
|
+
minOccurs="1"
|
|
128
|
+
maxOccurs="1"
|
|
129
|
+
nillable="true">
|
|
130
|
+
</xsd:element>
|
|
131
|
+
<xsd:element type="xsd:int"
|
|
132
|
+
name="inventoryType"
|
|
133
|
+
minOccurs="1"
|
|
134
|
+
maxOccurs="1">
|
|
135
|
+
</xsd:element>
|
|
136
|
+
<xsd:element type="xsd:string"
|
|
137
|
+
name="itemNumber"
|
|
138
|
+
minOccurs="1"
|
|
139
|
+
maxOccurs="1"
|
|
140
|
+
nillable="true">
|
|
141
|
+
</xsd:element>
|
|
142
|
+
<xsd:element type="xsd:string"
|
|
143
|
+
name="itemUrl"
|
|
144
|
+
minOccurs="1"
|
|
145
|
+
maxOccurs="1"
|
|
146
|
+
nillable="true">
|
|
147
|
+
</xsd:element>
|
|
148
|
+
<xsd:element type="xsd:int"
|
|
149
|
+
name="nokoriThreshold"
|
|
150
|
+
minOccurs="1"
|
|
151
|
+
maxOccurs="1">
|
|
152
|
+
</xsd:element>
|
|
153
|
+
<xsd:element type="xsd:int"
|
|
154
|
+
name="restTypeFlag"
|
|
155
|
+
minOccurs="1"
|
|
156
|
+
maxOccurs="1">
|
|
157
|
+
</xsd:element>
|
|
158
|
+
</xsd:sequence>
|
|
159
|
+
</xsd:complexType>
|
|
160
|
+
<xsd:complexType name="GetResponseExternalItemDetail">
|
|
161
|
+
<xsd:sequence>
|
|
162
|
+
<xsd:element type="xsd:string"
|
|
163
|
+
name="HChoiceName"
|
|
164
|
+
minOccurs="1"
|
|
165
|
+
maxOccurs="1"
|
|
166
|
+
nillable="true">
|
|
167
|
+
</xsd:element>
|
|
168
|
+
<xsd:element type="xsd:string"
|
|
169
|
+
name="VChoiceName"
|
|
170
|
+
minOccurs="1"
|
|
171
|
+
maxOccurs="1"
|
|
172
|
+
nillable="true">
|
|
173
|
+
</xsd:element>
|
|
174
|
+
<xsd:element type="xsd:int"
|
|
175
|
+
name="inventoryBackFlag"
|
|
176
|
+
minOccurs="1"
|
|
177
|
+
maxOccurs="1">
|
|
178
|
+
</xsd:element>
|
|
179
|
+
<xsd:element type="xsd:int"
|
|
180
|
+
name="inventoryCount"
|
|
181
|
+
minOccurs="1"
|
|
182
|
+
maxOccurs="1">
|
|
183
|
+
</xsd:element>
|
|
184
|
+
<xsd:element type="xsd:int"
|
|
185
|
+
name="lackDeliveryId"
|
|
186
|
+
minOccurs="1"
|
|
187
|
+
maxOccurs="1">
|
|
188
|
+
</xsd:element>
|
|
189
|
+
<xsd:element type="xsd:int"
|
|
190
|
+
name="normalDeliveryId"
|
|
191
|
+
minOccurs="1"
|
|
192
|
+
maxOccurs="1">
|
|
193
|
+
</xsd:element>
|
|
194
|
+
<xsd:element type="xsd:int"
|
|
195
|
+
name="orderFlag"
|
|
196
|
+
minOccurs="1"
|
|
197
|
+
maxOccurs="1">
|
|
198
|
+
</xsd:element>
|
|
199
|
+
<xsd:element type="xsd:int"
|
|
200
|
+
name="orderSalesFlag"
|
|
201
|
+
minOccurs="1"
|
|
202
|
+
maxOccurs="1">
|
|
203
|
+
</xsd:element>
|
|
204
|
+
</xsd:sequence>
|
|
205
|
+
</xsd:complexType>
|
|
206
|
+
<xsd:complexType name="GetResponseExternalModel">
|
|
207
|
+
<xsd:complexContent>
|
|
208
|
+
<xsd:extension base="stns:ResponseModel">
|
|
209
|
+
<xsd:sequence>
|
|
210
|
+
<xsd:element type="stns:ArrayOfGetResponseExternalItem"
|
|
211
|
+
name="getResponseExternalItem"
|
|
212
|
+
minOccurs="1"
|
|
213
|
+
maxOccurs="1"
|
|
214
|
+
nillable="true">
|
|
215
|
+
</xsd:element>
|
|
216
|
+
</xsd:sequence>
|
|
217
|
+
</xsd:extension>
|
|
218
|
+
</xsd:complexContent>
|
|
219
|
+
</xsd:complexType>
|
|
220
|
+
<xsd:complexType name="RequestModel">
|
|
221
|
+
</xsd:complexType>
|
|
222
|
+
<xsd:complexType name="ResponseModel">
|
|
223
|
+
<xsd:sequence>
|
|
224
|
+
<xsd:element type="xsd:string"
|
|
225
|
+
name="errCode"
|
|
226
|
+
minOccurs="1"
|
|
227
|
+
maxOccurs="1"
|
|
228
|
+
nillable="true">
|
|
229
|
+
</xsd:element>
|
|
230
|
+
<xsd:element type="xsd:string"
|
|
231
|
+
name="errMessage"
|
|
232
|
+
minOccurs="1"
|
|
233
|
+
maxOccurs="1"
|
|
234
|
+
nillable="true">
|
|
235
|
+
</xsd:element>
|
|
236
|
+
</xsd:sequence>
|
|
237
|
+
</xsd:complexType>
|
|
238
|
+
<xsd:complexType name="UpdateRequestExternalItem">
|
|
239
|
+
<xsd:sequence>
|
|
240
|
+
<xsd:element type="xsd:string"
|
|
241
|
+
name="HChoiceName"
|
|
242
|
+
minOccurs="1"
|
|
243
|
+
maxOccurs="1"
|
|
244
|
+
nillable="true">
|
|
245
|
+
</xsd:element>
|
|
246
|
+
<xsd:element type="xsd:string"
|
|
247
|
+
name="VChoiceName"
|
|
248
|
+
minOccurs="1"
|
|
249
|
+
maxOccurs="1"
|
|
250
|
+
nillable="true">
|
|
251
|
+
</xsd:element>
|
|
252
|
+
<xsd:element type="xsd:int"
|
|
253
|
+
name="inventory"
|
|
254
|
+
minOccurs="1"
|
|
255
|
+
maxOccurs="1">
|
|
256
|
+
</xsd:element>
|
|
257
|
+
<xsd:element type="xsd:int"
|
|
258
|
+
name="inventoryBackFlag"
|
|
259
|
+
minOccurs="1"
|
|
260
|
+
maxOccurs="1">
|
|
261
|
+
</xsd:element>
|
|
262
|
+
<xsd:element type="xsd:int"
|
|
263
|
+
name="inventoryType"
|
|
264
|
+
minOccurs="1"
|
|
265
|
+
maxOccurs="1">
|
|
266
|
+
</xsd:element>
|
|
267
|
+
<xsd:element type="xsd:int"
|
|
268
|
+
name="inventoryUpdateMode"
|
|
269
|
+
minOccurs="1"
|
|
270
|
+
maxOccurs="1">
|
|
271
|
+
</xsd:element>
|
|
272
|
+
<xsd:element type="xsd:string"
|
|
273
|
+
name="itemUrl"
|
|
274
|
+
minOccurs="1"
|
|
275
|
+
maxOccurs="1"
|
|
276
|
+
nillable="true">
|
|
277
|
+
</xsd:element>
|
|
278
|
+
<xsd:element type="xsd:boolean"
|
|
279
|
+
name="lackDeliveryDeleteFlag"
|
|
280
|
+
minOccurs="1"
|
|
281
|
+
maxOccurs="1">
|
|
282
|
+
</xsd:element>
|
|
283
|
+
<xsd:element type="xsd:int"
|
|
284
|
+
name="lackDeliveryId"
|
|
285
|
+
minOccurs="1"
|
|
286
|
+
maxOccurs="1">
|
|
287
|
+
</xsd:element>
|
|
288
|
+
<xsd:element type="xsd:int"
|
|
289
|
+
name="nokoriThreshold"
|
|
290
|
+
minOccurs="1"
|
|
291
|
+
maxOccurs="1">
|
|
292
|
+
</xsd:element>
|
|
293
|
+
<xsd:element type="xsd:boolean"
|
|
294
|
+
name="normalDeliveryDeleteFlag"
|
|
295
|
+
minOccurs="1"
|
|
296
|
+
maxOccurs="1">
|
|
297
|
+
</xsd:element>
|
|
298
|
+
<xsd:element type="xsd:int"
|
|
299
|
+
name="normalDeliveryId"
|
|
300
|
+
minOccurs="1"
|
|
301
|
+
maxOccurs="1">
|
|
302
|
+
</xsd:element>
|
|
303
|
+
<xsd:element type="xsd:int"
|
|
304
|
+
name="orderFlag"
|
|
305
|
+
minOccurs="1"
|
|
306
|
+
maxOccurs="1">
|
|
307
|
+
</xsd:element>
|
|
308
|
+
<xsd:element type="xsd:int"
|
|
309
|
+
name="orderSalesFlag"
|
|
310
|
+
minOccurs="1"
|
|
311
|
+
maxOccurs="1">
|
|
312
|
+
</xsd:element>
|
|
313
|
+
<xsd:element type="xsd:int"
|
|
314
|
+
name="restTypeFlag"
|
|
315
|
+
minOccurs="1"
|
|
316
|
+
maxOccurs="1">
|
|
317
|
+
</xsd:element>
|
|
318
|
+
</xsd:sequence>
|
|
319
|
+
</xsd:complexType>
|
|
320
|
+
<xsd:complexType name="UpdateRequestExternalModel">
|
|
321
|
+
<xsd:complexContent>
|
|
322
|
+
<xsd:extension base="stns:RequestModel">
|
|
323
|
+
<xsd:sequence>
|
|
324
|
+
<xsd:element type="stns:ArrayOfUpdateRequestExternalItem"
|
|
325
|
+
name="updateRequestExternalItem"
|
|
326
|
+
minOccurs="1"
|
|
327
|
+
maxOccurs="1"
|
|
328
|
+
nillable="true">
|
|
329
|
+
</xsd:element>
|
|
330
|
+
</xsd:sequence>
|
|
331
|
+
</xsd:extension>
|
|
332
|
+
</xsd:complexContent>
|
|
333
|
+
</xsd:complexType>
|
|
334
|
+
<xsd:complexType name="UpdateSingleRequestExternalModel">
|
|
335
|
+
<xsd:complexContent>
|
|
336
|
+
<xsd:extension base="stns:RequestModel">
|
|
337
|
+
<xsd:sequence>
|
|
338
|
+
<xsd:element type="stns:UpdateSingleRequestExternalItem"
|
|
339
|
+
name="updateRequestExternalItem"
|
|
340
|
+
minOccurs="1"
|
|
341
|
+
maxOccurs="1"
|
|
342
|
+
nillable="true">
|
|
343
|
+
</xsd:element>
|
|
344
|
+
</xsd:sequence>
|
|
345
|
+
</xsd:extension>
|
|
346
|
+
</xsd:complexContent>
|
|
347
|
+
</xsd:complexType>
|
|
348
|
+
<xsd:complexType name="UpdateResponseExternalItem">
|
|
349
|
+
<xsd:sequence>
|
|
350
|
+
<xsd:element type="xsd:string"
|
|
351
|
+
name="HChoiceName"
|
|
352
|
+
minOccurs="1"
|
|
353
|
+
maxOccurs="1"
|
|
354
|
+
nillable="true">
|
|
355
|
+
</xsd:element>
|
|
356
|
+
<xsd:element type="xsd:string"
|
|
357
|
+
name="VChoiceName"
|
|
358
|
+
minOccurs="1"
|
|
359
|
+
maxOccurs="1"
|
|
360
|
+
nillable="true">
|
|
361
|
+
</xsd:element>
|
|
362
|
+
<xsd:element type="xsd:string"
|
|
363
|
+
name="itemErrCode"
|
|
364
|
+
minOccurs="1"
|
|
365
|
+
maxOccurs="1"
|
|
366
|
+
nillable="true">
|
|
367
|
+
</xsd:element>
|
|
368
|
+
<xsd:element type="xsd:string"
|
|
369
|
+
name="itemErrMessage"
|
|
370
|
+
minOccurs="1"
|
|
371
|
+
maxOccurs="1"
|
|
372
|
+
nillable="true">
|
|
373
|
+
</xsd:element>
|
|
374
|
+
<xsd:element type="xsd:string"
|
|
375
|
+
name="itemUrl"
|
|
376
|
+
minOccurs="1"
|
|
377
|
+
maxOccurs="1"
|
|
378
|
+
nillable="true">
|
|
379
|
+
</xsd:element>
|
|
380
|
+
</xsd:sequence>
|
|
381
|
+
</xsd:complexType>
|
|
382
|
+
<xsd:complexType name="UpdateResponseExternalModel">
|
|
383
|
+
<xsd:complexContent>
|
|
384
|
+
<xsd:extension base="stns:ResponseModel">
|
|
385
|
+
<xsd:sequence>
|
|
386
|
+
<xsd:element type="stns:ArrayOfUpdateResponseExternalItem"
|
|
387
|
+
name="updateResponseExternalItem"
|
|
388
|
+
minOccurs="1"
|
|
389
|
+
maxOccurs="1"
|
|
390
|
+
nillable="true">
|
|
391
|
+
</xsd:element>
|
|
392
|
+
</xsd:sequence>
|
|
393
|
+
</xsd:extension>
|
|
394
|
+
</xsd:complexContent>
|
|
395
|
+
</xsd:complexType>
|
|
396
|
+
<xsd:complexType name="UserAuthBase">
|
|
397
|
+
<xsd:sequence>
|
|
398
|
+
<xsd:element type="xsd:string"
|
|
399
|
+
name="authKey"
|
|
400
|
+
minOccurs="1"
|
|
401
|
+
maxOccurs="1"
|
|
402
|
+
nillable="true">
|
|
403
|
+
</xsd:element>
|
|
404
|
+
<xsd:element type="xsd:string"
|
|
405
|
+
name="userName"
|
|
406
|
+
minOccurs="1"
|
|
407
|
+
maxOccurs="1"
|
|
408
|
+
nillable="true">
|
|
409
|
+
</xsd:element>
|
|
410
|
+
</xsd:sequence>
|
|
411
|
+
</xsd:complexType>
|
|
412
|
+
</xsd:schema>
|
|
413
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
414
|
+
xmlns:stns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
415
|
+
elementFormDefault="qualified"
|
|
416
|
+
attributeFormDefault="unqualified"
|
|
417
|
+
targetNamespace="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi">
|
|
418
|
+
<xsd:import namespace="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity">
|
|
419
|
+
</xsd:import>
|
|
420
|
+
<xsd:element name="getInventoryExternal">
|
|
421
|
+
<xsd:complexType>
|
|
422
|
+
<xsd:sequence>
|
|
423
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
424
|
+
type="tp:ExternalUserAuthModel"
|
|
425
|
+
name="externalUserAuthModel">
|
|
426
|
+
</xsd:element>
|
|
427
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
428
|
+
type="tp:GetRequestExternalModel"
|
|
429
|
+
name="getRequestExternalModel">
|
|
430
|
+
</xsd:element>
|
|
431
|
+
</xsd:sequence>
|
|
432
|
+
</xsd:complexType>
|
|
433
|
+
</xsd:element>
|
|
434
|
+
<xsd:element name="getInventoryExternalResponse">
|
|
435
|
+
<xsd:complexType>
|
|
436
|
+
<xsd:sequence>
|
|
437
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
438
|
+
type="tp:GetResponseExternalModel"
|
|
439
|
+
name="result">
|
|
440
|
+
</xsd:element>
|
|
441
|
+
</xsd:sequence>
|
|
442
|
+
</xsd:complexType>
|
|
443
|
+
</xsd:element>
|
|
444
|
+
<xsd:element name="updateInventoryExternal">
|
|
445
|
+
<xsd:complexType>
|
|
446
|
+
<xsd:sequence>
|
|
447
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
448
|
+
type="tp:ExternalUserAuthModel"
|
|
449
|
+
name="externalUserAuthModel">
|
|
450
|
+
</xsd:element>
|
|
451
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
452
|
+
type="tp:UpdateRequestExternalModel"
|
|
453
|
+
name="updateRequestExternalModel">
|
|
454
|
+
</xsd:element>
|
|
455
|
+
</xsd:sequence>
|
|
456
|
+
</xsd:complexType>
|
|
457
|
+
</xsd:element>
|
|
458
|
+
<xsd:element name="updateInventoryExternalResponse">
|
|
459
|
+
<xsd:complexType>
|
|
460
|
+
<xsd:sequence>
|
|
461
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
462
|
+
type="tp:UpdateResponseExternalModel"
|
|
463
|
+
name="result">
|
|
464
|
+
</xsd:element>
|
|
465
|
+
</xsd:sequence>
|
|
466
|
+
</xsd:complexType>
|
|
467
|
+
</xsd:element>
|
|
468
|
+
<xsd:element name="updateSingleInventoryExternal">
|
|
469
|
+
<xsd:complexType>
|
|
470
|
+
<xsd:sequence>
|
|
471
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
472
|
+
type="tp:ExternalUserAuthModel"
|
|
473
|
+
name="externalUserAuthModel">
|
|
474
|
+
</xsd:element>
|
|
475
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
476
|
+
type="tp:UpdateSingleRequestExternalModel"
|
|
477
|
+
name="updateRequestExternalModel">
|
|
478
|
+
</xsd:element>
|
|
479
|
+
</xsd:sequence>
|
|
480
|
+
</xsd:complexType>
|
|
481
|
+
</xsd:element>
|
|
482
|
+
<xsd:element name="updateSingleInventoryExternalResponse">
|
|
483
|
+
<xsd:complexType>
|
|
484
|
+
<xsd:sequence>
|
|
485
|
+
<xsd:element xmlns:tp="java:jp.co.rakuten.rms.mall.inventoryapi.v1.model.entity"
|
|
486
|
+
type="tp:UpdateResponseExternalModel"
|
|
487
|
+
name="result">
|
|
488
|
+
</xsd:element>
|
|
489
|
+
</xsd:sequence>
|
|
490
|
+
</xsd:complexType>
|
|
491
|
+
</xsd:element>
|
|
492
|
+
</xsd:schema>
|
|
493
|
+
</types>
|
|
494
|
+
<message name="getInventoryExternal">
|
|
495
|
+
<part xmlns:partns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
496
|
+
name="parameters"
|
|
497
|
+
element="partns:getInventoryExternal">
|
|
498
|
+
</part>
|
|
499
|
+
</message>
|
|
500
|
+
<message name="getInventoryExternalResponse">
|
|
501
|
+
<part xmlns:partns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
502
|
+
name="parameters"
|
|
503
|
+
element="partns:getInventoryExternalResponse">
|
|
504
|
+
</part>
|
|
505
|
+
</message>
|
|
506
|
+
<message name="updateInventoryExternal">
|
|
507
|
+
<part xmlns:partns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
508
|
+
name="parameters"
|
|
509
|
+
element="partns:updateInventoryExternal">
|
|
510
|
+
</part>
|
|
511
|
+
</message>
|
|
512
|
+
<message name="updateInventoryExternalResponse">
|
|
513
|
+
<part xmlns:partns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
514
|
+
name="parameters"
|
|
515
|
+
element="partns:updateInventoryExternalResponse">
|
|
516
|
+
</part>
|
|
517
|
+
</message>
|
|
518
|
+
<message name="updateSingleInventoryExternal">
|
|
519
|
+
<part xmlns:partns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
520
|
+
name="parameters"
|
|
521
|
+
element="partns:updateSingleInventoryExternal">
|
|
522
|
+
</part>
|
|
523
|
+
</message>
|
|
524
|
+
<message name="updateSingleInventoryExternalResponse">
|
|
525
|
+
<part xmlns:partns="https://inventoryapi.rms.rakuten.co.jp/rms/mall/inventoryapi"
|
|
526
|
+
name="parameters"
|
|
527
|
+
element="partns:updateSingleInventoryExternalResponse">
|
|
528
|
+
</part>
|
|
529
|
+
</message>
|
|
530
|
+
<portType name="inventoryapiPort">
|
|
531
|
+
<operation name="getInventoryExternal">
|
|
532
|
+
<input message="tns:getInventoryExternal">
|
|
533
|
+
</input>
|
|
534
|
+
<output message="tns:getInventoryExternalResponse">
|
|
535
|
+
</output>
|
|
536
|
+
</operation>
|
|
537
|
+
<operation name="updateInventoryExternal">
|
|
538
|
+
<input message="tns:updateInventoryExternal">
|
|
539
|
+
</input>
|
|
540
|
+
<output message="tns:updateInventoryExternalResponse">
|
|
541
|
+
</output>
|
|
542
|
+
</operation>
|
|
543
|
+
<operation name="updateSingleInventoryExternal">
|
|
544
|
+
<input message="tns:updateSingleInventoryExternal">
|
|
545
|
+
</input>
|
|
546
|
+
<output message="tns:updateSingleInventoryExternalResponse">
|
|
547
|
+
</output>
|
|
548
|
+
</operation>
|
|
549
|
+
</portType>
|
|
550
|
+
<binding type="tns:inventoryapiPort"
|
|
551
|
+
name="inventoryapiPort">
|
|
552
|
+
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|
|
553
|
+
<operation name="getInventoryExternal">
|
|
554
|
+
<soap:operation style="document" soapAction="" />
|
|
555
|
+
<input>
|
|
556
|
+
<soap:body use="literal" />
|
|
557
|
+
</input>
|
|
558
|
+
<output>
|
|
559
|
+
<soap:body use="literal" />
|
|
560
|
+
</output>
|
|
561
|
+
</operation>
|
|
562
|
+
<operation name="updateInventoryExternal">
|
|
563
|
+
<soap:operation style="document" soapAction="" />
|
|
564
|
+
<input>
|
|
565
|
+
<soap:body use="literal" />
|
|
566
|
+
</input>
|
|
567
|
+
<output>
|
|
568
|
+
<soap:body use="literal" />
|
|
569
|
+
</output>
|
|
570
|
+
</operation>
|
|
571
|
+
<operation name="updateSingleInventoryExternal">
|
|
572
|
+
<soap:operation style="document" soapAction="" />
|
|
573
|
+
<input>
|
|
574
|
+
<soap:body use="literal" />
|
|
575
|
+
</input>
|
|
576
|
+
<output>
|
|
577
|
+
<soap:body use="literal" />
|
|
578
|
+
</output>
|
|
579
|
+
</operation>
|
|
580
|
+
</binding>
|
|
581
|
+
<service name="inventoryapi">
|
|
582
|
+
<port name="inventoryapiPort"
|
|
583
|
+
binding="tns:inventoryapiPort">
|
|
584
|
+
<soap:address location="https://api.rms.rakuten.co.jp/es/1.0/inventory/ws" />
|
|
585
|
+
</port>
|
|
586
|
+
</service>
|
|
587
|
+
</definitions>
|
data/lib/rms_api_ruby.rb
CHANGED
|
@@ -11,5 +11,11 @@ module RmsApiRuby
|
|
|
11
11
|
|
|
12
12
|
autoload :Authentication, 'rms_api_ruby/authentication'
|
|
13
13
|
autoload :Chain, 'rms_api_ruby/chain'
|
|
14
|
+
autoload :Order, 'rms_api_ruby/order'
|
|
14
15
|
autoload :Orders, 'rms_api_ruby/orders'
|
|
16
|
+
autoload :Inventory, 'rms_api_ruby/inventory'
|
|
17
|
+
|
|
18
|
+
def self.root
|
|
19
|
+
File.dirname __dir__
|
|
20
|
+
end
|
|
15
21
|
end
|
|
@@ -6,10 +6,11 @@ module RmsApiRuby
|
|
|
6
6
|
class SoapClient < RmsApiRuby::Chain
|
|
7
7
|
SUCCESS = 200
|
|
8
8
|
|
|
9
|
-
def initialize(wsdl, operation, message)
|
|
10
|
-
@client
|
|
11
|
-
@operation
|
|
12
|
-
@message
|
|
9
|
+
def initialize(wsdl, operation, message, return_method)
|
|
10
|
+
@client = Savon.client(wsdl: wsdl)
|
|
11
|
+
@operation = operation
|
|
12
|
+
@message = message
|
|
13
|
+
@return_method = return_method
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def call
|
|
@@ -31,7 +32,8 @@ module RmsApiRuby
|
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
def parse_to_mash
|
|
34
|
-
Hashie::Mash.new(@response.body).
|
|
35
|
+
Hashie::Mash.new(@response.body).
|
|
36
|
+
send("#{@operation}_response").send(@return_method)
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
end
|
data/lib/rms_api_ruby/config.rb
CHANGED
|
@@ -80,12 +80,14 @@ module RmsApiRuby
|
|
|
80
80
|
option :service_secret, default: -> { ENV['RMS_API_SERVICE_SECRET'] }
|
|
81
81
|
option :license_key, default: -> { ENV['RMS_API_LICENSE_KEY'] }
|
|
82
82
|
option :shop_url, default: -> { ENV['RMS_API_SHOP_URL'] }
|
|
83
|
-
option :version, default: '1.0'
|
|
84
83
|
option :user_name, default: 'rms_api_ruby'
|
|
85
84
|
|
|
86
85
|
option :logger, default: ::Logger.new(STDOUT)
|
|
87
86
|
option :log_level, default: ::Logger::DEBUG
|
|
88
87
|
|
|
88
|
+
option :order_api_version, default: '1.0'
|
|
89
|
+
option :inventory_api_version, default: '1.0'
|
|
90
|
+
|
|
89
91
|
def options
|
|
90
92
|
self.class.options
|
|
91
93
|
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'rms_api_ruby/soap_api'
|
|
2
|
+
|
|
3
|
+
module RmsApiRuby
|
|
4
|
+
class Inventory
|
|
5
|
+
extend RmsApiRuby::SoapApi
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def api_methods
|
|
9
|
+
%i[
|
|
10
|
+
get_inventory_external
|
|
11
|
+
update_inventory_external
|
|
12
|
+
update_single_inventory_external
|
|
13
|
+
]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def soap_client
|
|
17
|
+
Client
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Client < RmsApiRuby::SoapApi::Client
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def error_code
|
|
25
|
+
:err_code
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def error_message
|
|
29
|
+
:err_message
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def message
|
|
33
|
+
auth_params.merge business_params
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def return_method
|
|
37
|
+
:result
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def api_name
|
|
41
|
+
'InventoryAPI'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def wsdl
|
|
45
|
+
File.join(RmsApiRuby.root, 'config', 'wsdl', "inventory_v_#{version}.wsdl")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def version
|
|
49
|
+
RmsApiRuby.configuration.inventory_api_version
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def auth_params
|
|
53
|
+
{
|
|
54
|
+
external_user_auth_model: {
|
|
55
|
+
auth_key: RmsApiRuby::Authentication.key,
|
|
56
|
+
shop_url: RmsApiRuby.configuration.shop_url,
|
|
57
|
+
user_name: RmsApiRuby.configuration.user_name
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def business_params
|
|
63
|
+
key = if @operation == :get_inventory_external
|
|
64
|
+
:get_request_external_model
|
|
65
|
+
else
|
|
66
|
+
:updateRequestExternalModel
|
|
67
|
+
end
|
|
68
|
+
{ key => @args }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require 'rms_api_ruby/soap_api'
|
|
2
|
+
|
|
3
|
+
module RmsApiRuby
|
|
4
|
+
class Order
|
|
5
|
+
extend RmsApiRuby::SoapApi
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
def api_methods
|
|
9
|
+
%i[
|
|
10
|
+
get_order
|
|
11
|
+
update_order
|
|
12
|
+
cancel_order
|
|
13
|
+
change_status
|
|
14
|
+
decision_point
|
|
15
|
+
r_bank_account_transfer
|
|
16
|
+
change_r_bank_to_unprocessing
|
|
17
|
+
do_enclosure
|
|
18
|
+
do_un_enclosure
|
|
19
|
+
change_enclosure_parent
|
|
20
|
+
get_enclosure_list
|
|
21
|
+
get_request_id
|
|
22
|
+
get_result
|
|
23
|
+
]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def soap_client
|
|
27
|
+
Client
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class Client < RmsApiRuby::SoapApi::Client
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def error_code
|
|
35
|
+
:error_code
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def error_message
|
|
39
|
+
:message
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def message
|
|
43
|
+
auth_params.merge business_params
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def return_method
|
|
47
|
+
:return
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def api_name
|
|
51
|
+
'OrderAPI'
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def wsdl
|
|
55
|
+
"https://api.rms.rakuten.co.jp/es/#{version}/order/ws?WSDL"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def version
|
|
59
|
+
RmsApiRuby.configuration.order_api_version
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def auth_params
|
|
63
|
+
{
|
|
64
|
+
arg0: {
|
|
65
|
+
auth_key: RmsApiRuby::Authentication.key,
|
|
66
|
+
shop_url: RmsApiRuby.configuration.shop_url,
|
|
67
|
+
user_name: RmsApiRuby.configuration.user_name
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def business_params
|
|
73
|
+
{ arg1: @args }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
data/lib/rms_api_ruby/orders.rb
CHANGED
|
@@ -1,109 +1,20 @@
|
|
|
1
|
-
require 'rms_api_ruby/
|
|
2
|
-
require 'rms_api_ruby/chain'
|
|
3
|
-
require 'rms_api_ruby/config'
|
|
1
|
+
require 'rms_api_ruby/order'
|
|
4
2
|
|
|
5
3
|
module RmsApiRuby
|
|
6
|
-
class Orders
|
|
4
|
+
class Orders < RmsApiRuby::Order
|
|
7
5
|
class << self
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
update_order
|
|
11
|
-
cancel_order
|
|
12
|
-
change_status
|
|
13
|
-
decision_point
|
|
14
|
-
r_bank_account_transfer
|
|
15
|
-
change_r_bank_to_unprocessing
|
|
16
|
-
do_enclosure
|
|
17
|
-
do_un_enclosure
|
|
18
|
-
change_enclosure_parent
|
|
19
|
-
get_enclosure_list
|
|
20
|
-
get_request_id
|
|
21
|
-
get_result
|
|
22
|
-
].freeze
|
|
23
|
-
|
|
24
|
-
def method_missing(method, *args)
|
|
25
|
-
API_METHODS.include?(method) ? call_api(method, args.first) : super
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def respond_to_missing?(method, include_private = false)
|
|
29
|
-
API_METHODS.include?(method) || super
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def call_api(api_method, args)
|
|
33
|
-
Flow.new.
|
|
34
|
-
chain(response: :response) { Client.new(api_method, args) }.
|
|
35
|
-
on_dam { |error| handle_error(error) }.
|
|
36
|
-
outflow.
|
|
37
|
-
try(:response)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def handle_error(error)
|
|
41
|
-
raise error
|
|
42
|
-
rescue ServerError, AuthenticationError => e
|
|
43
|
-
RmsApiRuby.logger.error(e.message)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
class Client
|
|
48
|
-
include Waterfall
|
|
49
|
-
|
|
50
|
-
AUTH_ERRORCODE = /^E02-00/
|
|
51
|
-
|
|
52
|
-
def initialize(operation, args)
|
|
53
|
-
@operation = operation
|
|
54
|
-
@args = args
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def call # rubocop:disable Metrics/AbcSize
|
|
58
|
-
chain { RmsApiRuby::Chain::Logger.new(:info, start_message) }
|
|
59
|
-
chain(response: :response) do
|
|
60
|
-
RmsApiRuby::Chain::SoapClient.new(wsdl, @operation, message)
|
|
61
|
-
end
|
|
62
|
-
when_truthy { |outflow| outflow.response.error_code =~ AUTH_ERRORCODE }.
|
|
63
|
-
dam { |outflow| auth_error(outflow.response) }
|
|
64
|
-
chain { RmsApiRuby::Chain::Logger.new(:info, complete_message) }
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
private
|
|
68
|
-
|
|
69
|
-
def message
|
|
70
|
-
auth_params.merge business_params
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def auth_params
|
|
74
|
-
{
|
|
75
|
-
arg0: {
|
|
76
|
-
auth_key: RmsApiRuby::Authentication.key,
|
|
77
|
-
shop_url: RmsApiRuby.configuration.shop_url,
|
|
78
|
-
user_name: RmsApiRuby.configuration.user_name
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def business_params
|
|
84
|
-
{ arg1: @args }
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def wsdl
|
|
88
|
-
"https://api.rms.rakuten.co.jp/es/#{version}/order/ws?WSDL"
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def version
|
|
92
|
-
RmsApiRuby.configuration.version
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def auth_error(response)
|
|
96
|
-
refference = "status: #{response.error_code}, message: #{response.message}"
|
|
97
|
-
message = "RMS Api authentication failed. #{refference}"
|
|
98
|
-
RmsApiRuby::AuthenticationError.new message
|
|
6
|
+
def soap_client
|
|
7
|
+
RmsApiRuby::Order::Client
|
|
99
8
|
end
|
|
100
9
|
|
|
101
|
-
def
|
|
102
|
-
|
|
10
|
+
def call_api(method, args)
|
|
11
|
+
RmsApiRuby.configuration.logger.warn deprecation_message
|
|
12
|
+
super(method, args)
|
|
103
13
|
end
|
|
104
14
|
|
|
105
|
-
def
|
|
106
|
-
"
|
|
15
|
+
def deprecation_message
|
|
16
|
+
"[DEPRECATION]: 'RmsApiRuby::Orders' class is deprecated."\
|
|
17
|
+
" Use 'RmsApiRuby::Order' class instead."
|
|
107
18
|
end
|
|
108
19
|
end
|
|
109
20
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module RmsApiRuby
|
|
2
|
+
module SoapApi
|
|
3
|
+
autoload :Client, 'rms_api_ruby/soap_api/client'
|
|
4
|
+
|
|
5
|
+
def api_methods
|
|
6
|
+
raise NotImplementedError, "You must implement #{self}::#{__method__}"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def soap_client
|
|
10
|
+
raise NotImplementedError, "You must implement #{self}::#{__method__}"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def method_missing(method, *args)
|
|
14
|
+
api_methods.include?(method) ? call_api(method, args.first) : super
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def respond_to_missing?(method, include_private = false)
|
|
18
|
+
api_methods.include?(method) || super
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def call_api(method, args)
|
|
22
|
+
Flow.new.
|
|
23
|
+
chain(response: :response) { soap_client.new(method, args) }.
|
|
24
|
+
on_dam { |error| handle_error(error) }.
|
|
25
|
+
outflow.
|
|
26
|
+
try(:response)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def handle_error(error)
|
|
30
|
+
raise error
|
|
31
|
+
rescue ServerError, AuthenticationError => e
|
|
32
|
+
RmsApiRuby.configuration.logger.error(e.message)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'rms_api_ruby/authentication'
|
|
2
|
+
require 'rms_api_ruby/chain'
|
|
3
|
+
|
|
4
|
+
module RmsApiRuby
|
|
5
|
+
module SoapApi
|
|
6
|
+
class Client
|
|
7
|
+
include Waterfall
|
|
8
|
+
|
|
9
|
+
AUTH_ERRORCODE = /^E02-00/
|
|
10
|
+
|
|
11
|
+
def initialize(operation, args)
|
|
12
|
+
@operation = operation
|
|
13
|
+
@args = args
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call
|
|
17
|
+
chain { log :info, start_message }
|
|
18
|
+
chain(response: :response) { execute_request }
|
|
19
|
+
when_truthy { |outflow| authentication_error?(outflow) }.
|
|
20
|
+
dam { |outflow| auth_error(outflow.response) }
|
|
21
|
+
chain { log :info, complete_message }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def authentication_error?(outflow)
|
|
27
|
+
outflow.response.send(error_code) =~ AUTH_ERRORCODE
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def error_code
|
|
31
|
+
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def error_message
|
|
35
|
+
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def message
|
|
39
|
+
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def return_method
|
|
43
|
+
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def api_name
|
|
47
|
+
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def wsdl
|
|
51
|
+
raise NotImplementedError, "You must implement #{self.class}##{__method__}"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def log(level, message)
|
|
55
|
+
RmsApiRuby::Chain::Logger.new(level, message)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def execute_request
|
|
59
|
+
RmsApiRuby::Chain::SoapClient.new(wsdl, @operation, message, return_method)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def start_message
|
|
63
|
+
"RMS #{api_name} '#{@operation.to_s.camelize}' started. args: #{@args.inspect}"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def complete_message
|
|
67
|
+
"RMS #{api_name} '#{@operation.to_s.camelize}' completed."
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def auth_error(response)
|
|
71
|
+
refference = "status: #{response.send(error_code)},"\
|
|
72
|
+
" message: #{response.send(error_message)}"
|
|
73
|
+
message = "RMS Api authentication failed. #{refference}"
|
|
74
|
+
RmsApiRuby::AuthenticationError.new message
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
data/lib/rms_api_ruby/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rms_api_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kaicoh
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-06-
|
|
11
|
+
date: 2018-06-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -141,13 +141,18 @@ files:
|
|
|
141
141
|
- Rakefile
|
|
142
142
|
- bin/console
|
|
143
143
|
- bin/setup
|
|
144
|
+
- config/wsdl/inventory_v_1.0.wsdl
|
|
144
145
|
- lib/rms_api_ruby.rb
|
|
145
146
|
- lib/rms_api_ruby/authentication.rb
|
|
146
147
|
- lib/rms_api_ruby/chain.rb
|
|
147
148
|
- lib/rms_api_ruby/chain/logger.rb
|
|
148
149
|
- lib/rms_api_ruby/chain/soap_client.rb
|
|
149
150
|
- lib/rms_api_ruby/config.rb
|
|
151
|
+
- lib/rms_api_ruby/inventory.rb
|
|
152
|
+
- lib/rms_api_ruby/order.rb
|
|
150
153
|
- lib/rms_api_ruby/orders.rb
|
|
154
|
+
- lib/rms_api_ruby/soap_api.rb
|
|
155
|
+
- lib/rms_api_ruby/soap_api/client.rb
|
|
151
156
|
- lib/rms_api_ruby/version.rb
|
|
152
157
|
- rms_api_ruby.gemspec
|
|
153
158
|
homepage: https://github.com/Kaicoh
|