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

Commit 90519b0

Browse files
matiasalbarellosfroehler
authored andcommitted
Adds attr_reader :customs_declaration (#34)
* Adds `attr_reader :customs_declaration` to `Shipment`
1 parent cfcf2bc commit 90519b0

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
### Added
33
- Add attr_reader for `id` to class `Shipcloud::Address` to be able to get the id of a created address
44
- Add attr_reader for `id` to class `Shipcloud::Webhook` to be able to get the id of a created webhook
5-
5+
- Add attr_reader for `customs_declaration` to class `Shipcloud::Shipment` to be able to get the `customs_declaration` of a created shipment
66
### Changed
77

88
### Deprecated

lib/shipcloud/shipment.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ class Shipment < Base
55
include Shipcloud::Operations::All
66

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

1011
def self.index_response_root
1112
"#{class_name.downcase}s"

spec/shipcloud/shipment_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
id: "123456",
2828
name: "bar"
2929
}
30-
}
30+
},
31+
customs_declaration: {
32+
id: "123456",
33+
contents_type: "commercial_goods",
34+
},
3135
}
3236
end
3337

@@ -51,6 +55,9 @@
5155
expect(shipment.package[:length]).to eq 40
5256
expect(shipment.package[:width]).to eq 20
5357
expect(shipment.package[:height]).to eq 20
58+
59+
expect(shipment.customs_declaration[:id]).to eq "123456"
60+
expect(shipment.customs_declaration[:contents_type]).to eq "commercial_goods"
5461
end
5562

5663
it "initializes the metadata correctly" do

0 commit comments

Comments
 (0)