ozon-logistics 0.0.7 → 0.0.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffaf042b4939f2ec4c6b15ea459dd3481271a454cbba2fe57ab3ff5a68f61a6a
4
- data.tar.gz: 2a8d7916ad20083eb73e88dbb8aef71913fab5c39c922900720fc40e60100588
3
+ metadata.gz: e4c4f351393367ec940e0f7abd55135de1587ec44a4b26c4145b8f30143db09f
4
+ data.tar.gz: dd723292b024d65d594b4140539427fbcf6a83575137b85778b74e3ceca5fd4c
5
5
  SHA512:
6
- metadata.gz: 2c6f855ef682ff805793cdc6238f872deb4b02d921efd7455de1eeec71fb352261011f3425120f9199bbe27c2a2fe205f1eeb0432d87bf5f08ffcd045d1f8652
7
- data.tar.gz: e3420d7f8b3b5d6ce80a08eabd6a63ad175649d19bc2c73443fd844988ade4f0a4a9db49c9205040701247d926d4cb0b5f8b99209b638cf72f29b33be2f1b8a6
6
+ metadata.gz: 5aef5ad14830fdaae7d65ea352b57c4244897dd51e09df1a8cd3d88f196dc6ae1cf8316a0742eec31a546c020826a4b25190ae9f4cce1eba586607455368b9d1
7
+ data.tar.gz: c82628cf9568ee9354b2bead904aad23737a6776b16f8ae8782710b14a863ff7cdcc31213e0f696c70e05cfee49c12bfdc5bbe469d351788ddb58dc0cd833af6
data/README.markdown CHANGED
@@ -160,6 +160,10 @@ amount = response.body[:amount]
160
160
  ```ruby
161
161
  body = {
162
162
  orderNumber: '1',
163
+ firstMileTransfer: {
164
+ type: 'DropOff',
165
+ fromPlaceId: OzonLogistics.from_places.to_s
166
+ },
163
167
  buyer: {
164
168
  name: 'Павел',
165
169
  phone: '+71234567890',
@@ -203,6 +207,19 @@ body = {
203
207
  response = OzonLogistics::Request.order.create(body: body)
204
208
  order = response[:data]
205
209
  ```
210
+
211
+ ### Shipment
212
+ #### Метод создания заявки на отгрузку на складе OZON
213
+ ```ruby
214
+ body = {
215
+ orderIds: [
216
+ order_id
217
+ ]
218
+ }
219
+ response = OzonLogistics::Request.shipmentRequest.create(body: body)
220
+ result = response.body
221
+ ```
222
+
206
223
  ### Tariff
207
224
  #### Получение списка тарифов
208
225
  ```ruby
@@ -2,12 +2,12 @@ defaults: &defaults
2
2
  GRANT_TYPE: 'client_credentials'
3
3
  CLIENT_ID: 'ApiTest_11111111-1111-1111-1111-111111111111'
4
4
  CLIENT_SECRET: 'SRYksX3PBPUYj73A6cNqbQYRSaYNpjSodIMeWoSCQ8U='
5
- URL_TOKEN: 'https://api-stg.ozonru.me/principal-auth-api/connect/token'
6
- HOST: 'https://api-stg.ozonru.me/principal-integration-api'
5
+ URL_TOKEN: 'https://xapi.ozon.ru/principal-auth-api/connect/token'
6
+ HOST: 'https://xapi.ozon.ru/principal-integration-api'
7
7
  production:
8
8
  <<: *defaults
9
- URL_TOKEN: 'https://api.ozon.ru/principal-auth-api/connect/token'
10
- HOST: 'https://api.ozon.ru/principal-integration-api'
9
+ URL_TOKEN: 'https://xapi.ozon.ru/principal-auth-api/connect/token'
10
+ HOST: 'https://xapi.ozon.ru/principal-integration-api'
11
11
  CLIENT_ID: ''
12
12
  CLIENT_SECRET: ''
13
13
  development:
@@ -13,7 +13,7 @@ module OzonLogistics
13
13
  configure_request(request: request, params: params, headers: headers, body: MultiJson.dump(body))
14
14
  end
15
15
  parse_response(response)
16
- rescue => e
16
+ rescue StandardError => e
17
17
  if e.response.dig(:status) == 401 && first_time
18
18
  OzonLogistics::Request.access_token = OzonLogistics.generate_access_token.try(:dig, "access_token")
19
19
  self.post(params: params, headers: headers, body: body, first_time: false)
@@ -32,8 +32,8 @@ module OzonLogistics
32
32
  configure_request(request: request, params: params, headers: headers, body: MultiJson.dump(body))
33
33
  end
34
34
  parse_response(response)
35
- rescue => e
36
- if e.response.dig(:status)== 401 && first_time
35
+ rescue StandardError => e
36
+ if e.response.dig(:status) == 401 && first_time
37
37
  OzonLogistics::Request.access_token = OzonLogistics.generate_access_token.try(:dig, "access_token")
38
38
  self.patch(params: params, headers: headers, body: body, first_time: false)
39
39
  else
@@ -50,7 +50,7 @@ module OzonLogistics
50
50
  configure_request(request: request, params: params, headers: headers, body: MultiJson.dump(body))
51
51
  end
52
52
  parse_response(response)
53
- rescue => e
53
+ rescue StandardError => e
54
54
  if e.response.dig(:status) == 401 && first_time
55
55
  OzonLogistics::Request.access_token = OzonLogistics.generate_access_token.try(:dig, "access_token")
56
56
  self.put(params: params, headers: headers, body: body, first_time: false)
@@ -68,7 +68,7 @@ module OzonLogistics
68
68
  configure_request(request: request, params: params, headers: headers)
69
69
  end
70
70
  parse_response(response)
71
- rescue => e
71
+ rescue StandardError => e
72
72
  if e.response.dig(:status) == 401 && first_time
73
73
  OzonLogistics::Request.access_token = OzonLogistics.generate_access_token.try(:dig, "access_token")
74
74
  self.get(params: params, headers: headers, first_time: false)
@@ -86,7 +86,7 @@ module OzonLogistics
86
86
  configure_request(request: request, params: params, headers: headers)
87
87
  end
88
88
  parse_response(response)
89
- rescue => e
89
+ rescue StandardError => e
90
90
  if e.response.dig(:status) == 401 && first_time
91
91
  OzonLogistics::Request.access_token = OzonLogistics.generate_access_token.try(:dig, "access_token")
92
92
  self.delete(params: params, headers: headers, first_time: false)
@@ -163,7 +163,8 @@ module OzonLogistics
163
163
  if request
164
164
  request.params.merge!(params) if params
165
165
  request.headers['Content-Type'] = 'application/json'
166
- request.headers['Authorization'] = "Bearer #{self.access_token}"
166
+ request.headers['Authorization'] = "Bearer #{OzonLogistics::Request.access_token}"
167
+ request.headers['User-Agent'] = "OzonLogistics/#{OzonLogistics::VERSION} Ruby gem"
167
168
  request.headers.merge!(headers) if headers
168
169
  request.body = body if body
169
170
  request.options.timeout = self.timeout
@@ -201,8 +202,7 @@ module OzonLogistics
201
202
  end
202
203
 
203
204
  def validate_access_token
204
- access_token = self.access_token
205
- unless access_token && (access_token["-"] || self.api_endpoint)
205
+ unless self.access_token
206
206
  raise OzonLogistics::OzonLogisticsError, "You must set an access_token prior to making a call"
207
207
  end
208
208
  end
@@ -21,7 +21,7 @@ module OzonLogistics
21
21
  end
22
22
 
23
23
  def method_missing(method, *args)
24
- @path_parts << method.to_s.downcase
24
+ @path_parts << method.to_s
25
25
  @path_parts << args if args.length > 0
26
26
  @path_parts.flatten!
27
27
  self
@@ -1,3 +1,3 @@
1
1
  module OzonLogistics
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -3,6 +3,7 @@ require 'ozon-logistics/ozon_error'
3
3
  require 'ozon-logistics/request'
4
4
  require 'ozon-logistics/api_request'
5
5
  require 'ozon-logistics/response'
6
+ require 'ozon-logistics/version'
6
7
 
7
8
  module OzonLogistics
8
9
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ozon-logistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Osetrov