Class: EasyPost::Postage

Inherits:
Object
  • Object
show all
Defined in:
lib/easypost/postage.rb

Constant Summary collapse

@@type =
"postage"
@@usps_package_types =
%w(
  Card
  Letter
  Flat
  Parcel
  LargeParcel
  IrregularParcel
  FlatRateEnvelope
  FlatRateLegalEnvelope
  FlatRatePaddedEnvelope
  FlatRateGiftCardEnvelope
  FlatRateWindowEnvelope
  FlatRateCardboardEnvelope
  SmallFlatRateEnvelope
  SmallFlatRateBox
  MediumFlatRateBox
  LargeFlatRateBox
  RegionalRateBoxA
  RegionalRateBoxB
  RegionalRateBoxC
  LargeFlatRateBoardGameBox
)

Class Method Summary collapse

Class Method Details

.buy(data = {}) ⇒ Object



39
40
41
# File 'lib/easypost/postage.rb', line 39

def self.buy(data={})
  @rates = EasyPost.post(EasyPost.api_url(:type => @@type, :action => "buy"), data)
end

.compare(data = {}) ⇒ Object



35
36
37
# File 'lib/easypost/postage.rb', line 35

def self.compare(data={})
  return rates(data)
end

.get(filename) ⇒ Object



43
44
45
# File 'lib/easypost/postage.rb', line 43

def self.get(filename)
  @rates = EasyPost.get(EasyPost.api_url(:type => @@type, :action => "get"), :label_file_name => filename)
end

.listObject



47
48
49
# File 'lib/easypost/postage.rb', line 47

def self.list()
  @rates = EasyPost.get(EasyPost.api_url(:type => @@type, :action => "list"))
end

.rates(data = {}) ⇒ Object



31
32
33
# File 'lib/easypost/postage.rb', line 31

def self.rates(data={})
  @rates = EasyPost.get(EasyPost.api_url(:type => @@type, :action => "rates"), data)
end

.usps_package_typesObject



27
28
29
# File 'lib/easypost/postage.rb', line 27

def self.usps_package_types
  return @@usps_package_types
end