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

Pickup Object in Shipment's create parameters. #56

Merged
merged 2 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/shipcloud/shipment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Shipment < Base

attr_accessor :from, :to, :carrier, :package, :reference_number, :metadata
attr_reader :id, :created_at, :carrier_tracking_no, :tracking_url, :label_url,
:packages, :price, :customs_declaration
:packages, :pickup, :price, :customs_declaration

def self.index_response_root
"#{class_name.downcase}s"
Expand Down
27 changes: 27 additions & 0 deletions spec/shipcloud/shipment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@
width: 20,
height: 20
},
pickup: {
pickup_time: {
earliest: "2015-09-15T09:00:00+02:00",
latest: "2015-09-15T18:00:00+02:00"
},
pickup_address: {
company: "Sender Ltd.",
first_name: "Jane",
last_name: "Doe",
street: "Musterstraße",
street_no: "42",
zip_code: "54321",
city: "Musterstadt",
country: "DE"
},
},
metadata: {
product: {
name: "foo"
Expand Down Expand Up @@ -56,6 +72,17 @@
expect(shipment.package[:width]).to eq 20
expect(shipment.package[:height]).to eq 20

expect(shipment.pickup[:pickup_time][:earliest]).to eq "2015-09-15T09:00:00+02:00"
expect(shipment.pickup[:pickup_time][:latest]).to eq "2015-09-15T18:00:00+02:00"
expect(shipment.pickup[:pickup_address][:company]).to eq "Sender Ltd."
expect(shipment.pickup[:pickup_address][:first_name]).to eq "Jane"
expect(shipment.pickup[:pickup_address][:last_name]).to eq "Doe"
expect(shipment.pickup[:pickup_address][:street]).to eq "Musterstraße"
expect(shipment.pickup[:pickup_address][:street_no]).to eq "42"
expect(shipment.pickup[:pickup_address][:zip_code]).to eq "54321"
expect(shipment.pickup[:pickup_address][:city]).to eq "Musterstadt"
expect(shipment.pickup[:pickup_address][:country]).to eq "DE"

expect(shipment.customs_declaration[:id]).to eq "123456"
expect(shipment.customs_declaration[:contents_type]).to eq "commercial_goods"
end
Expand Down