pratka 0.1.0 → 0.1.1
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/CHANGELOG.md +8 -1
- data/README.md +25 -1
- data/lib/pratka/speedy/client.rb +13 -2
- data/lib/pratka/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: 5b7fcba8830d7b2a64d6eface4623a15a44f88891a3642ef144fcef3df7af4e9
|
|
4
|
+
data.tar.gz: 141e3f04d803fd70e8e1173334b10ce88e1908d8f9c1d711bbd27e02de265547
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90e43c700109947503183ab11b2d8601be0ddeb69c1d9736ae71124e56a2546f8a08ebe43a18647add64412ab39e45b2a6379091af8e2383763ef604457bbe37
|
|
7
|
+
data.tar.gz: be018a707f9cc0fe0d7dd665b7dfbe672557ffc9f83cac1a1b46aa53cf741f8428f8024bc8cf2706c4514a476b7b1d99ec9c707dd2d09bce00f6a5eaf08ab809
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.1] - 2026-10-08
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `fetch_shipment_info` returns full details of existing shipments
|
|
8
|
+
|
|
9
|
+
[0.1.1]: https://github.com/tripplesteel/pratka/releases/tag/v0.1.1
|
|
10
|
+
|
|
3
11
|
## [0.1.0] - 2026-10-07
|
|
4
12
|
|
|
5
13
|
Initial release, with Speedy as the first supported courier.
|
|
@@ -18,5 +26,4 @@ Initial release, with Speedy as the first supported courier.
|
|
|
18
26
|
- Validation of required params, which treats blank values as missing
|
|
19
27
|
- Supports Ruby 3.3+ and JRuby
|
|
20
28
|
|
|
21
|
-
[Unreleased]: https://github.com/tripplesteel/pratka/compare/v0.1.0...HEAD
|
|
22
29
|
[0.1.0]: https://github.com/tripplesteel/pratka/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -345,6 +345,30 @@ Example response:
|
|
|
345
345
|
}
|
|
346
346
|
```
|
|
347
347
|
|
|
348
|
+
#### Fetch shipment info
|
|
349
|
+
|
|
350
|
+
```ruby
|
|
351
|
+
client.fetch_shipment_info(shipment_ids: ["299999990", "299999991"])
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Allowed options:
|
|
355
|
+
- `shipment_ids` (Mandatory) - Array of shipment ids
|
|
356
|
+
|
|
357
|
+
Returns the parsed JSON response with one [Shipment](https://api.speedy.bg/api/docs/#href-ds-shipment) per id. Each shipment has its sender, recipient, service, content, payment, price and delivery details, plus `ref1`, `ref2`, `returnShipmentId` and `redirectShipmentId` when set
|
|
358
|
+
|
|
359
|
+
Example response:
|
|
360
|
+
|
|
361
|
+
```ruby
|
|
362
|
+
{"shipments" =>
|
|
363
|
+
[{"id" => "299999990",
|
|
364
|
+
"ref1" => "ORDER-1001",
|
|
365
|
+
"service" => {"serviceId" => 505, "pickupDate" => "2026-10-08"},
|
|
366
|
+
"content" => {"parcelsCount" => 1, "totalWeight" => 1.5, "contents" => "Books"},
|
|
367
|
+
"price" => {"amount" => 6.2, "vat" => 1.24, "total" => 7.44, "currency" => "BGN"},
|
|
368
|
+
"delivery" => {"deliveryDeadline" => "2026-10-09T19:00:00+0300"}}]
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
348
372
|
#### Calculate
|
|
349
373
|
|
|
350
374
|
```ruby
|
|
@@ -403,7 +427,7 @@ Returns the parsed JSON response with one tracked parcel per matched parcel. A `
|
|
|
403
427
|
|
|
404
428
|
A parcel Speedy can't find comes back with its own `error` object instead of operations. `track` doesn't raise for it, so check each parcel
|
|
405
429
|
|
|
406
|
-
Speedy
|
|
430
|
+
Speedy enforces 10 parcels limit per request. If you send more than 10 parcels it raises `ArgumentError` with the message `Speedy tracks at most 10 parcels per call`. Split larger lists into batches, for example with `each_slice(10)`
|
|
407
431
|
|
|
408
432
|
Example response:
|
|
409
433
|
|
data/lib/pratka/speedy/client.rb
CHANGED
|
@@ -61,11 +61,13 @@ module Pratka
|
|
|
61
61
|
payment: :payment
|
|
62
62
|
}.freeze
|
|
63
63
|
|
|
64
|
+
SHIPMENT_INFO_ENDPOINT = "shipment/info"
|
|
65
|
+
SHIPMENT_INFO_PARAMS = { shipment_ids: :shipmentIds }.freeze
|
|
66
|
+
|
|
64
67
|
TRACK_ENDPOINT = "track"
|
|
65
68
|
TRACK_PARAMS = { parcels: :parcels, last_operation_only: :lastOperationOnly }.freeze
|
|
66
69
|
|
|
67
|
-
# Speedy
|
|
68
|
-
|
|
70
|
+
# Speedy allows up to 10 parcels per request
|
|
69
71
|
TRACK_MAX_PARCELS = 10
|
|
70
72
|
|
|
71
73
|
def initialize(username:, password:, language: nil, country_id: Speedy.configuration.country_id)
|
|
@@ -159,6 +161,15 @@ module Pratka
|
|
|
159
161
|
call(CREATE_SHIPMENT_ENDPOINT, map_params(options, SHIPMENT_PARAMS, required: %i[recipient service content payment]))
|
|
160
162
|
end
|
|
161
163
|
|
|
164
|
+
# Fetch full details of existing shipments
|
|
165
|
+
# [Shipment Information Request (ShipmentInformationRequest)](https://api.speedy.bg/api/docs/#href-shipment-info-req)
|
|
166
|
+
# Allowed params:
|
|
167
|
+
# shipment_ids (Mandatory) - String[] - Shipment ids
|
|
168
|
+
# Returns one Shipment per id with its sender, recipient, service, content, payment, price and delivery
|
|
169
|
+
def fetch_shipment_info(**options)
|
|
170
|
+
call(SHIPMENT_INFO_ENDPOINT, map_params(options, SHIPMENT_INFO_PARAMS, required: [:shipment_ids]))
|
|
171
|
+
end
|
|
172
|
+
|
|
162
173
|
# Calculate shipment price and delivery deadline for one or more services
|
|
163
174
|
# [Calculation Request (CalculationRequest)](https://api.speedy.bg/api/docs/#href-calculation-req)
|
|
164
175
|
# Allowed params:
|
data/lib/pratka/version.rb
CHANGED