Class: EasyPost::Printer

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

Instance Attribute Summary

Attributes inherited from EasyPostObject

#api_key, #name, #parent, #unsaved_values

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

Instance Method Details

#jobObject



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

def job
  response, api_key = EasyPost.request(
    :get, url + '/jobs', @api_key
  )
  return EasyPost::Util::convert_to_easypost_object(response, api_key)
end


11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/easypost/printer.rb', line 11

def print(params={})
  if params.instance_of?(EasyPost::PostageLabel)
    temp = params.clone
    params = {}
    params[:postage_label] = temp
  end

  response, api_key = EasyPost.request(
    :post, url + '/print_postage_label', @api_key, params
  )
  return true
rescue
  return false
end