class EasyPost::Services::Service

The base class for all services in the library.

Public Class Methods

new(client) click to toggle source
# File lib/easypost/services/base.rb, line 7
def initialize(client)
  @client = client
end

Protected Instance Methods

get_all_helper(endpoint, cls, params, filters = nil, beta = false) click to toggle source
# File lib/easypost/services/base.rb, line 13
def get_all_helper(endpoint, cls, params, filters = nil, beta = false)
  response = @client.make_request(
    :get, endpoint, params,
    beta ? 'beta' : EasyPost::InternalUtilities::Constants::API_VERSION,
  )

  response[EasyPost::InternalUtilities::Constants::FILTERS_KEY] = filters unless filters.nil?

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, cls)
end
more_pages?(collection) click to toggle source
# File lib/easypost/services/base.rb, line 24
def more_pages?(collection)
  collection&.has_more
end