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 +4 -4
- data/README.markdown +172 -1
- data/lib/yandex-delivery/api_request.rb +0 -1
- data/lib/yandex-delivery/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a31de731dfa6b000c6629fdd71d563b8ee60e95de48284ed0f7bacfff83d14fd
|
4
|
+
data.tar.gz: d857e0cbc948f4a8fd42d899f7b7e6d15aed5fb46367a16cb1bd69dd2f19c767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 057da7de3ae480d829cd49d1491dc30c39da0ca4e39bc967ccd55ec3da373c50799a6066c44d64553a46687d8be07b3703e5cb7f7bb3530f2b8faa8b3a7688a7
|
7
|
+
data.tar.gz: 639b709d414c455ea3f50bce47924937b7a9aa3b3a2c2e74ec8c8de08368745cb48187dfe38da50641632bfff06cd90ad98653b2cc8e712c9722127f3aa6fbf2
|
data/README.markdown
CHANGED
@@ -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
|
```
|