yandex-delivery 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20948af6947ba0c5eacd0d0a8e0f46bf818f1a15eae22180309cc6781550a91a
4
- data.tar.gz: 68fabec7fa939e083146b7f6ce8f8ebe701d5a1722aab54c09f4663ac09b8b67
3
+ metadata.gz: a31de731dfa6b000c6629fdd71d563b8ee60e95de48284ed0f7bacfff83d14fd
4
+ data.tar.gz: d857e0cbc948f4a8fd42d899f7b7e6d15aed5fb46367a16cb1bd69dd2f19c767
5
5
  SHA512:
6
- metadata.gz: 052ef2f8e89462737a5db6fa555bec56945fba5907c93a302382aae0589c833f734bc4009f4a05b33fc5b4be37a7e80867dd7cb929a092d084d1a2003089c8d1
7
- data.tar.gz: 258765b235e43f80a363a75eb724e824a7b414fe9b8b3e011d0a1c7c366f054d0a58bb909545d3787acf3b09fa4d3bcabbf82a3a4fadda7ebdbadc271a96cbe0
6
+ metadata.gz: 057da7de3ae480d829cd49d1491dc30c39da0ca4e39bc967ccd55ec3da373c50799a6066c44d64553a46687d8be07b3703e5cb7f7bb3530f2b8faa8b3a7688a7
7
+ data.tar.gz: 639b709d414c455ea3f50bce47924937b7a9aa3b3a2c2e74ec8c8de08368745cb48187dfe38da50641632bfff06cd90ad98653b2cc8e712c9722127f3aa6fbf2
@@ -70,7 +70,9 @@ YandexDelivery::Request.logger = MyLogger.new
70
70
 
71
71
  ## Примеры
72
72
 
73
- ### Поиск вариантов доставки
73
+ ### Варианты доставки
74
+
75
+ #### Поиск вариантов доставки
74
76
 
75
77
  ```ruby
76
78
  # для Rails senderId указывать не обязательно, в запрос подставится значение из config/yandex_delivery2.yml
@@ -80,4 +82,173 @@ body = {
80
82
  }
81
83
 
82
84
  YandexDelivery::Request.delivery_options.upsert(body: body)
85
+ ```
86
+
87
+ #### Поиск пунктов выдачи заказов
88
+
89
+ ```ruby
90
+ YandexDelivery::Request.pickup_points.upsert(body: {locationId: 2})
91
+ ```
92
+
93
+ ### Операции с заказами
94
+
95
+ #### Создать черновик заказа
96
+
97
+ ```ruby
98
+ response = YandexDelivery::Request.orders.create(body: {deliveryType: 'COURIER'})
99
+ order_id = response.body
100
+ ```
101
+
102
+ #### Обновить черновик заказа
103
+
104
+ ```ruby
105
+ YandexDelivery::Request.orders(order_id).upsert(body: {deliveryType: 'PICKUP'})
106
+ ```
107
+
108
+ #### Оформить заказ
109
+
110
+ ```ruby
111
+ YandexDelivery::Request.orders.submit.create(body: {orderIds: [order_id]})
112
+ ```
113
+
114
+ #### Получить данные о заказе
115
+
116
+ ```ruby
117
+ response = YandexDelivery::Request.orders(order_id).retrieve
118
+ order = response.body
119
+ ```
120
+
121
+ #### Удалить заказ
122
+
123
+ ```ruby
124
+ YandexDelivery::Request.orders(order_id).delete
125
+ ```
126
+
127
+ #### Получить ярлык заказа
128
+
129
+ ```ruby
130
+ YandexDelivery::Request.orders(order_id).label.retrieve
131
+ ```
132
+
133
+ #### Поиск заказов
134
+
135
+ ```ruby
136
+ sender_ids = YandexDelivery.senders.map{|sender| sender['id']}
137
+ YandexDelivery::Request.orders.search.upsert(body: {senderIds: sender_ids, orderIds: [order_id]})
138
+ ```
139
+
140
+ #### Получить историю статусов заказа
141
+
142
+ ```ruby
143
+ YandexDelivery::Request.orders(order_id).statuses.retrieve
144
+ ```
145
+
146
+ #### Получить статус заказов
147
+
148
+ ```ruby
149
+ YandexDelivery::Request.orders.status.upsert
150
+ ```
151
+
152
+ ### Операции с отгрузками
153
+
154
+ #### Создать заявку на отгрузку
155
+
156
+ ```ruby
157
+ body = {
158
+ cabinetId: YandexDelivery.client['id'],
159
+ shipment: {
160
+ type: "WITHDRAW",
161
+ date: "2020-10-05",
162
+ warehouseFrom: YandexDelivery.warehouses.first['id'],
163
+ warehouseTo: 123,
164
+ partnerTo: 678
165
+ },
166
+ intervalId: 765478,
167
+ dimensions: {
168
+ length: 10,
169
+ width: 15,
170
+ height: 40,
171
+ weight: 5.5
172
+ },
173
+ courier: {
174
+ type: "CAR",
175
+ firstName: "Василий",
176
+ middleName: "Иванович",
177
+ lastName: "Пупкин",
178
+ phone: "+79998887766",
179
+ carNumber: "о000оо",
180
+ carBrand: "Maybach"
181
+ },
182
+ comment: "comment"
183
+ }
184
+ response = YandexDelivery::Request.shipments.application.create(body body)
185
+ shipment_id = response.body['id']
186
+ ```
187
+
188
+ #### Подтвердить отгрузку
189
+
190
+ ```ruby
191
+ body = {
192
+ cabinetId: YandexDelivery.client['id'],
193
+ shipmentApplicationIds: [shipment_id]
194
+ }
195
+ YandexDelivery::Request.shipments.application.submit.create(body body)
196
+ ```
197
+
198
+ #### Получить список отгрузок
199
+
200
+ ```ruby
201
+ body = {
202
+ cabinetId: YandexDelivery.client['id'],
203
+ shipmentType: "IMPORT",
204
+ dateFrom: "2020-10-05",
205
+ "dateTo": "2020-11-05",
206
+ "partnerIds":
207
+ [
208
+ 239847,
209
+ 98234,
210
+ 54968
211
+ ]
212
+ }
213
+ YandexDelivery::Request.shipments.search.upsert(body: body)
214
+ ```
215
+
216
+ #### Получить интервалы самопривозов
217
+
218
+ ```ruby
219
+ warehouse_id = YandexDelivery.warehouses.first['id']
220
+ YandexDelivery::Request.shipments.intervals.import.retrieve(params: {warehouseId: warehouse_id, date: '2020-10-06'})
221
+ ```
222
+
223
+ #### Получить интервалы заборов
224
+
225
+ ```ruby
226
+ YandexDelivery::Request.shipments.intervals.withdraw.retrieve(params: {partnerId: 106, date: '2020-10-06'})
227
+ ```
228
+
229
+ #### Получить акт передачи заказов
230
+
231
+ ```ruby
232
+ YandexDelivery::Request.shipments.applications(shipment_id).act.retrieve(params: {cabinetId: YandexDelivery.client['id']})
233
+ ```
234
+
235
+ ### Справочные данные
236
+
237
+ #### Получить полный адрес
238
+
239
+ ```ruby
240
+ YandexDelivery::Request.location.retrieve(params: {term: 'Санкт-Петербург'})
241
+ ```
242
+
243
+ #### Получить индекс по адресу
244
+
245
+ ```ruby
246
+ response = YandexDelivery::Request.location.postal_code.retrieve(params: {address: 'Санкт-Петербург, ул. Профессора Попова, д. 37Щ, БЦ "Сенатор"'})
247
+ postal_code = response.body.first[:postalCode]
248
+ ```
249
+
250
+ #### Получить список служб доставки
251
+
252
+ ```ruby
253
+ YandexDelivery::Request.delivery_services.retrieve(params: {cabinetId: YandexDelivery.client['id']})
83
254
  ```
@@ -145,7 +145,6 @@ module YandexDelivery
145
145
  request.body = body if body
146
146
  request.options.timeout = self.timeout
147
147
  request.options.open_timeout = self.open_timeout
148
- p request
149
148
  end
150
149
  end
151
150
 
@@ -1,3 +1,3 @@
1
1
  module YandexDelivery
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex-delivery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Osetrov