Class: AfterShip::V4::Courier

Inherits:
Base
  • Object
show all
Defined in:
lib/aftership/v4/courier.rb

Constant Summary

Constants inherited from Base

Base::CALL_SLEEP, Base::MAX_TRIAL

Instance Attribute Summary

Attributes inherited from Base

#body, #end_point, #http_verb_method, #query

Class Method Summary collapse

Methods inherited from Base

#call, #initialize

Constructor Details

This class inherits a constructor from AfterShip::V4::Base

Class Method Details

.detect(tracking = nil) ⇒ Object

POST /couriers/detect Return a list of matched couriers based on tracking number format and selected couriers or a list of couriers.



21
22
23
24
25
26
27
# File 'lib/aftership/v4/courier.rb', line 21

def self.detect(tracking = nil)
  if tracking == nil
    raise ArgumentError.new('tracking object is required.')
  else
    new(:post, 'couriers/detect', {}, {:tracking => tracking}).call
  end
end

.getObject

GET /couriers Return a list of couriers activated at your AfterShip account.



9
10
11
# File 'lib/aftership/v4/courier.rb', line 9

def self.get
  new(:get, 'couriers').call
end

.get_allObject

GET /couriers/all Return a list of all couriers.



15
16
17
# File 'lib/aftership/v4/courier.rb', line 15

def self.get_all
  new(:get, 'couriers/all').call
end