Class: Trackplus::Client
- Inherits:
-
Object
- Object
- Trackplus::Client
- Defined in:
- lib/trackplus/client.rb
Instance Method Summary collapse
- #couriers ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#tracking(courier:, tracking_no:) ⇒ Object
returns a collection of your account members.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 |
# File 'lib/trackplus/client.rb', line 5 def initialize( = {}) @max_retries = .fetch(:max_retries, 3) @api_key = .fetch(:api_key) { configuration_error 'Missing api_key argument' } @transform_to = Transformation.new([:transform_to]) end |
Instance Method Details
#couriers ⇒ Object
16 17 18 |
# File 'lib/trackplus/client.rb', line 16 def couriers @transform_to.apply(nil, get_request('couriers')['data']) end |
#tracking(courier:, tracking_no:) ⇒ Object
returns a collection of your account members
12 13 14 |
# File 'lib/trackplus/client.rb', line 12 def tracking(courier:, tracking_no:) @transform_to.apply(nil, get_request("trackings/#{courier}/#{tracking_no}")['data']) end |