Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit cbf6bfc

Browse files
author
Jonathan Jäkel
authored
Support shipments with pickup requests (#60)
Express carriers like [TNT](https://developers.shipcloud.io/carriers/tnt.html) need the pickup time frame creating the shipment. This change is compatible for non-express carriers.
1 parent f52e3c6 commit cbf6bfc

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## [Unreleased]
22
### Added
33

4+
- Support shipments with pickup requests as required for [TNT](https://developers.shipcloud.io/carriers/tnt.html).
5+
46
### Changed
57

68
### Deprecated

lib/shipcloud/shipment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Shipment < Base
66

77
attr_accessor :from, :to, :carrier, :package, :reference_number, :metadata
88
attr_reader :id, :created_at, :carrier_tracking_no, :tracking_url, :label_url,
9-
:packages, :price, :customs_declaration
9+
:packages, :price, :customs_declaration, :pickup
1010

1111
def self.index_response_root
1212
"#{class_name.downcase}s"

spec/shipcloud/shipment_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
id: "123456",
3333
contents_type: "commercial_goods",
3434
},
35+
pickup: {
36+
pickup_time: {
37+
earliest: "2020-07-24T13:59:58+23:57",
38+
latest: "2020-07-24T18:59:58+23:57",
39+
}
40+
}
3541
}
3642
end
3743

@@ -58,6 +64,8 @@
5864

5965
expect(shipment.customs_declaration[:id]).to eq "123456"
6066
expect(shipment.customs_declaration[:contents_type]).to eq "commercial_goods"
67+
expect(shipment.pickup[:pickup_time][:earliest]).to eq "2020-07-24T13:59:58+23:57"
68+
expect(shipment.pickup[:pickup_time][:latest]).to eq "2020-07-24T18:59:58+23:57"
6169
end
6270

6371
it "initializes the metadata correctly" do

0 commit comments

Comments
 (0)