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, #deconstruct_keys, #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



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

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

  return EasyPost::Util.convert_to_easypost_object(response, api_key)
end

Instance Method Details

#add_shipments(params = {}) ⇒ Object



31
32
33
34
35
36
# File 'lib/easypost/batch.rb', line 31

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

  return self
end

#buy(params = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/easypost/batch.rb', line 10

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

  return self
end

#create_scan_form(params = {}) ⇒ Object



44
45
46
47
48
# File 'lib/easypost/batch.rb', line 44

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

  return response
end

#label(params = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/easypost/batch.rb', line 17

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

  return self
end

#remove_shipments(params = {}) ⇒ Object



24
25
26
27
28
29
# File 'lib/easypost/batch.rb', line 24

def remove_shipments(params={})
  response = EasyPost.make_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



38
39
40
41
42
# File 'lib/easypost/batch.rb', line 38

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

  return response
end