Class: EasyPost::Batch

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

Instance Attribute Summary

Attributes inherited from EasyPostObject

#api_key, #name, #parent, #unsaved_values

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 = {}, api_key = nil) ⇒ Object



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

def self.create_and_buy(params={}, api_key=nil)
  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



33
34
35
36
37
38
# File 'lib/easypost/batch.rb', line 33

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

#buy(params = {}) ⇒ Object



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

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

  return self
end

#create_scan_form(params = {}) ⇒ Object



46
47
48
49
50
# File 'lib/easypost/batch.rb', line 46

def create_scan_form(params={})
  response, api_key = EasyPost.request(:post, url + '/scan_form', @api_key, params)

  return response
end

#label(params = {}) ⇒ Object



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

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



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

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

#stamp_and_barcode_by_reference(params = {}) ⇒ Object



40
41
42
43
44
# File 'lib/easypost/batch.rb', line 40

def stamp_and_barcode_by_reference(params={})
  response, api_key = EasyPost.request(:get, url + '/stamp_and_barcode_by_reference', @api_key, params)

  return response
end