Class: AxTrack::TrackerResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/ax_track/resources/tracker_resource.rb

Constant Summary

Constants inherited from Resource

Resource::ApiError, Resource::ApiRequestsQuotaReachedError, Resource::BadRequestError, Resource::ForbiddenError, Resource::HTTP_BAD_REQUEST_CODE, Resource::HTTP_FORBIDDEN_CODE, Resource::HTTP_NOT_FOUND_CODE, Resource::HTTP_OK_CODE, Resource::HTTP_UNAUTHORIZED_CODE, Resource::HTTP_UNPROCESSABLE_ENTITY_CODE, Resource::NotFoundError, Resource::UnauthorizedError, Resource::UnprocessableEntityError

Instance Attribute Summary

Attributes inherited from Resource

#client, #response

Instance Method Summary collapse

Methods inherited from Resource

#error_class, #initialize, #request, #response_successful?

Constructor Details

This class inherits a constructor from AxTrack::Resource

Instance Method Details

#list(per_page: nil, cursor: nil) ⇒ Object



4
5
6
7
8
9
# File 'lib/ax_track/resources/tracker_resource.rb', line 4

def list(per_page: nil, cursor: nil)
  Collection.from_response response = request(endpoint: "trackers",
                                              params: {per_page: per_page, cursor: cursor}.compact),
                           key: 'results',
                           type: Tracker
end

#retrieve(tracker_id) ⇒ Object



11
12
13
14
# File 'lib/ax_track/resources/tracker_resource.rb', line 11

def retrieve(tracker_id)
  Tracker.new request(http_method: :get,
                      endpoint: "trackers/#{tracker_id}").body
end