Module: Unforlogistics::Core::ShipmentTrips
- Included in:
- Api
- Defined in:
- lib/unforlogistics/core/shipment_trips.rb
Instance Method Summary collapse
- #create_shipment_trip(attrs = {}) ⇒ Object
- #get_shipment_trip(id) ⇒ Object
- #get_shipment_trips(filters = {}) ⇒ Object
- #get_shipment_trips_availability(attrs = {}) ⇒ Object
Instance Method Details
#create_shipment_trip(attrs = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/unforlogistics/core/shipment_trips.rb', line 14 def create_shipment_trip(attrs={}) response = post_request('/shipment_trips', attrs) get_persistance_response(response) end |
#get_shipment_trip(id) ⇒ Object
10 11 12 |
# File 'lib/unforlogistics/core/shipment_trips.rb', line 10 def get_shipment_trip(id) get_request("/shipment_trips/#{id}").body end |
#get_shipment_trips(filters = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/unforlogistics/core/shipment_trips.rb', line 4 def get_shipment_trips(filters={}) response = get_request('/shipment_trips', filters) get_paging_response(response) end |
#get_shipment_trips_availability(attrs = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/unforlogistics/core/shipment_trips.rb', line 20 def get_shipment_trips_availability(attrs={}) response = post_request('/shipment_trips/availability', attrs) if response.headers.warning.nil? OpenStruct.new({ valid: true, results: response.body, errors: [] }) else OpenStruct.new({ valid: false, results: nil, errors: response.headers.warning }) end end |