Module: Unforlogistics::Core::Shipments
- Included in:
- Api
- Defined in:
- lib/unforlogistics/core/shipments.rb
Instance Method Summary collapse
- #cancel_shipment(code) ⇒ Object
- #create_shipment(attrs = {}) ⇒ Object
- #get_shipment(code) ⇒ Object
- #get_shipments(filters = {}) ⇒ Object
- #quote_shipment(attrs = {}) ⇒ Object
Instance Method Details
#cancel_shipment(code) ⇒ Object
20 21 22 23 24 |
# File 'lib/unforlogistics/core/shipments.rb', line 20 def cancel_shipment(code) response = put_request("/shipments/#{code}/cancellation") get_persistance_response(response) end |
#create_shipment(attrs = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/unforlogistics/core/shipments.rb', line 14 def create_shipment(attrs={}) response = post_request('/shipments', attrs) get_persistance_response(response) end |
#get_shipment(code) ⇒ Object
10 11 12 |
# File 'lib/unforlogistics/core/shipments.rb', line 10 def get_shipment(code) get_request("/shipments/#{code}").body end |
#get_shipments(filters = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/unforlogistics/core/shipments.rb', line 4 def get_shipments(filters={}) response = get_request('/shipments', filters) get_paging_response(response) end |
#quote_shipment(attrs = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/unforlogistics/core/shipments.rb', line 26 def quote_shipment(attrs={}) response = post_request('/shipments/quote', attrs) if response.headers.warning.nil? errors = [] else errors = response.headers.warning end OpenStruct.new({ result: response.body, valid: errors.empty?, errors: errors }) end |