Class: ShipEngine::Domain::Shipments
- Inherits:
-
Object
- Object
- ShipEngine::Domain::Shipments
- Defined in:
- lib/shipengine/domains/shipments.rb
Instance Method Summary collapse
- #add_tag_to_shipment(shipment_id:, tag_name:, params: {}) ⇒ Object
- #cancel_shipment_by_id(shipment_id:, params: {}) ⇒ Object
- #create_shipments(params: {}) ⇒ Object
-
#initialize ⇒ Shipments
constructor
A new instance of Shipments.
- #list_shipments(params: {}) ⇒ Object
- #parse_shipping_info(params: {}) ⇒ Object
- #remove_tag_to_shipment(shipment_id:, tag_name:, params: {}) ⇒ Object
- #shipment_by_external_id(external_shipment_id:, params: {}) ⇒ Object
- #shipment_by_id(shipment_id:, params: {}) ⇒ Object
- #shipment_rates(shipment_id:, params: {}) ⇒ Object
- #update_shipment_by_id(shipment_id:, params: {}) ⇒ Object
Constructor Details
#initialize ⇒ Shipments
Returns a new instance of Shipments.
8 9 10 |
# File 'lib/shipengine/domains/shipments.rb', line 8 def initialize @client = ShipEngine::Client.new end |
Instance Method Details
#add_tag_to_shipment(shipment_id:, tag_name:, params: {}) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/shipengine/domains/shipments.rb', line 84 def add_tag_to_shipment(shipment_id:, tag_name:, params: {}) response = @client.post( path: "#{ShipEngine::Constants::PATHS.v1.shipments.root}/#{shipment_id}/tags/#{tag_name}", options: params ) Hashie::Mash.new(response.body) end |
#cancel_shipment_by_id(shipment_id:, params: {}) ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/shipengine/domains/shipments.rb', line 66 def cancel_shipment_by_id(shipment_id:, params: {}) response = @client.put( path: "#{ShipEngine::Constants::PATHS.v1.shipments.root}/#{shipment_id}/cancel", options: params ) Hashie::Mash.new(response.body) end |
#create_shipments(params: {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/shipengine/domains/shipments.rb', line 21 def create_shipments(params: {}) response = @client.post( path: ShipEngine::Constants::PATHS.v1.shipments.root, options: params ) Hashie::Mash.new(response.body) end |
#list_shipments(params: {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/shipengine/domains/shipments.rb', line 12 def list_shipments(params: {}) response = @client.get( path: ShipEngine::Constants::PATHS.v1.shipments.root, options: params ) Hashie::Mash.new(response.body) end |
#parse_shipping_info(params: {}) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/shipengine/domains/shipments.rb', line 39 def parse_shipping_info(params: {}) response = @client.put( path: ShipEngine::Constants::PATHS.v1.shipments.parse_shipping_info, options: params ) Hashie::Mash.new(response.body) end |
#remove_tag_to_shipment(shipment_id:, tag_name:, params: {}) ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/shipengine/domains/shipments.rb', line 93 def remove_tag_to_shipment(shipment_id:, tag_name:, params: {}) response = @client.delete( path: "#{ShipEngine::Constants::PATHS.v1.shipments.root}/#{shipment_id}/tags/#{tag_name}", options: params ) Hashie::Mash.new(response.body) end |
#shipment_by_external_id(external_shipment_id:, params: {}) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/shipengine/domains/shipments.rb', line 30 def shipment_by_external_id(external_shipment_id:, params: {}) response = @client.get( path: "#{ShipEngine::Constants::PATHS.v1.shipments.shipment_by_external_id}/#{external_shipment_id}", options: params ) Hashie::Mash.new(response.body) end |
#shipment_by_id(shipment_id:, params: {}) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/shipengine/domains/shipments.rb', line 48 def shipment_by_id(shipment_id:, params: {}) response = @client.get( path: "#{ShipEngine::Constants::PATHS.v1.shipments.root}/#{shipment_id}", options: params ) Hashie::Mash.new(response.body) end |
#shipment_rates(shipment_id:, params: {}) ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/shipengine/domains/shipments.rb', line 75 def shipment_rates(shipment_id:, params: {}) response = @client.get( path: "#{ShipEngine::Constants::PATHS.v1.shipments.root}/#{shipment_id}/rates", options: params ) Hashie::Mash.new(response.body) end |
#update_shipment_by_id(shipment_id:, params: {}) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/shipengine/domains/shipments.rb', line 57 def update_shipment_by_id(shipment_id:, params: {}) response = @client.put( path: "#{ShipEngine::Constants::PATHS.v1.shipments.root}/#{shipment_id}", options: params ) Hashie::Mash.new(response.body) end |