class Postmaster::Shipment

Public Class Methods

create(params={}) click to toggle source
# File lib/postmaster/shipment.rb, line 6
def self.create(params={})
  Util.normalize_address(params[:to])
  Util.normalize_address(params[:from])
  response = Postmaster.request(:post, self.url, params)
  self.construct_from(response)
end

Public Instance Methods

track() click to toggle source
# File lib/postmaster/shipment.rb, line 13
def track
  response = Postmaster.request(:get, url('track'))
  if response[:results].nil?
    return nil
  end
  response[:results].map { |i| Postmaster::Tracking.construct_from(i) }
end
void() click to toggle source
# File lib/postmaster/shipment.rb, line 21
def void
  response = Postmaster.request(:post, url('void'))
  refresh_from({})
  response[:message] == 'OK'
end