Class: ShipEngine::Domain::Batches
- Inherits:
-
Object
- Object
- ShipEngine::Domain::Batches
- Defined in:
- lib/shipengine/domains/batches.rb
Instance Method Summary collapse
- #add_to_batch(batch_id:, params: {}) ⇒ Object
- #batch_by_external_id(external_batch_id:, params: {}) ⇒ Object
- #batch_by_id(batch_id:, params: {}) ⇒ Object
- #batch_errors(batch_id:, params: {}) ⇒ Object
- #create_batch(params:) ⇒ Object
- #delete_batch_by_id(batch_id:, params: {}) ⇒ Object
-
#initialize ⇒ Batches
constructor
A new instance of Batches.
- #list_batches(params: {}) ⇒ Object
- #process_batch_id_labels(batch_id:, params: {}) ⇒ Object
- #remove_from_batch(batch_id:, params: {}) ⇒ Object
- #update_batch_by_id(batch_id:, params: {}) ⇒ Object
Constructor Details
#initialize ⇒ Batches
Returns a new instance of Batches.
8 9 10 |
# File 'lib/shipengine/domains/batches.rb', line 8 def initialize @client = ShipEngine::Client.new end |
Instance Method Details
#add_to_batch(batch_id:, params: {}) ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/shipengine/domains/batches.rb', line 66 def add_to_batch(batch_id:, params: {}) response = @client.post( path: "#{ShipEngine::Constants::PATHS.v1.batches.root}/#{batch_id}/add", options: params ) Hashie::Mash.new(response.body) end |
#batch_by_external_id(external_batch_id:, params: {}) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/shipengine/domains/batches.rb', line 30 def batch_by_external_id(external_batch_id:, params: {}) response = @client.get( path: "#{ShipEngine::Constants::PATHS.v1.batches.batch_by_external_id}/#{external_batch_id}", options: params ) Hashie::Mash.new(response.body) end |
#batch_by_id(batch_id:, params: {}) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/shipengine/domains/batches.rb', line 48 def batch_by_id(batch_id:, params: {}) response = @client.get( path: "#{ShipEngine::Constants::PATHS.v1.batches.root}/#{batch_id}", options: params ) Hashie::Mash.new(response.body) end |
#batch_errors(batch_id:, params: {}) ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/shipengine/domains/batches.rb', line 75 def batch_errors(batch_id:, params: {}) response = @client.get( path: "#{ShipEngine::Constants::PATHS.v1.batches.root}/#{batch_id}/errors", options: params ) Hashie::Mash.new(response.body) end |
#create_batch(params:) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/shipengine/domains/batches.rb', line 21 def create_batch(params:) response = @client.post( path: ShipEngine::Constants::PATHS.v1.batches.root, options: params ) Hashie::Mash.new(response.body) end |
#delete_batch_by_id(batch_id:, params: {}) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/shipengine/domains/batches.rb', line 39 def delete_batch_by_id(batch_id:, params: {}) response = @client.delete( path: "#{ShipEngine::Constants::PATHS.v1.batches.root}/#{batch_id}", options: params ) Hashie::Mash.new(response.body) end |
#list_batches(params: {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/shipengine/domains/batches.rb', line 12 def list_batches(params: {}) response = @client.get( path: ShipEngine::Constants::PATHS.v1.batches.root, options: params ) Hashie::Mash.new(response.body) end |
#process_batch_id_labels(batch_id:, params: {}) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/shipengine/domains/batches.rb', line 84 def process_batch_id_labels(batch_id:, params: {}) response = @client.post( path: "#{ShipEngine::Constants::PATHS.v1.batches.root}/#{batch_id}/process/labels", options: params ) Hashie::Mash.new(response.body) end |
#remove_from_batch(batch_id:, params: {}) ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/shipengine/domains/batches.rb', line 93 def remove_from_batch(batch_id:, params: {}) response = @client.post( path: "#{ShipEngine::Constants::PATHS.v1.batches.root}/#{batch_id}/remove", options: params ) Hashie::Mash.new(response.body) end |
#update_batch_by_id(batch_id:, params: {}) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/shipengine/domains/batches.rb', line 57 def update_batch_by_id(batch_id:, params: {}) response = @client.put( path: "#{ShipEngine::Constants::PATHS.v1.batches.root}/#{batch_id}", options: params ) Hashie::Mash.new(response.body) end |