Class: EasyPost::Batch

Inherits:
Resource show all
Defined in:
lib/easypost/batch.rb

Instance Attribute Summary

Attributes inherited from EasyPostObject

#api_key

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

all, class_name, create, #delete, #refresh, retrieve, #save, url, #url

Methods inherited from EasyPostObject

#[], #[]=, #as_json, construct_from, #each, #id, #id=, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from EasyPost::EasyPostObject

Class Method Details

.create_and_buy(params = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/easypost/batch.rb', line 4

def self.create_and_buy(params={})
  wrapped_params = {}
  wrapped_params[self.class_name().to_sym] = params
  response, api_key = EasyPost.request(:post, url + '/create_and_buy', @api_key, wrapped_params)

  return Util.convert_to_easypost_object(response, api_key)
end

Instance Method Details

#add_shipments(params = {}) ⇒ Object



26
27
28
29
30
31
# File 'lib/easypost/batch.rb', line 26

def add_shipments(params={})
  response, api_key = EasyPost.request(:post, url + '/add_shipments', @api_key, params)
  self.refresh_from(response, @api_key, true)
  
  return self
end

#label(params = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/easypost/batch.rb', line 12

def label(params={})
  response, api_key = EasyPost.request(:post, url + '/label', @api_key, params)
  self.refresh_from(response, @api_key, true)
  
  return self
end

#remove_shipments(params = {}) ⇒ Object



19
20
21
22
23
24
# File 'lib/easypost/batch.rb', line 19

def remove_shipments(params={})
  response, api_key = EasyPost.request(:post, url + '/remove_shipments', @api_key, params)
  self.refresh_from(response, @api_key, true)
  
  return self
end