class EasyPost::Services::Tracker
Public Instance Methods
Source
# File lib/easypost/services/tracker.rb, line 22 def all(params = {}) filters = { key: 'trackers', tracking_code: params[:tracking_code], carrier: params[:carrier], } get_all_helper('trackers', MODEL_CLASS, params, filters) end
Retrieve a list of Trackers
Source
# File lib/easypost/services/tracker.rb, line 7 def create(params = {}) wrapped_params = { tracker: params } response = @client.make_request(:post, 'trackers', wrapped_params) EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Create a Tracker
Source
# File lib/easypost/services/tracker.rb, line 33 def get_next_page(collection, page_size = nil) raise EasyPost::Errors::EndOfPaginationError.new unless more_pages?(collection) params = { before_id: collection.trackers.last.id } params[:page_size] = page_size unless page_size.nil? params.merge!(collection[EasyPost::InternalUtilities::Constants::FILTERS_KEY]).delete(:key) all(params) end
Get the next page of trackers.
Source
# File lib/easypost/services/tracker.rb, line 15 def retrieve(id) response = @client.make_request(:get, "trackers/#{id}") EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS) end
Retrieve a Tracker