Sha256: 25deac492a9b5309b63e6eaf989bdd2183296bea1833648963b868def64fa50a

Contents?: true

Size: 690 Bytes

Versions: 6

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

require_relative '../internal_utilities'

# The base class for all services in the library.
class EasyPost::Services::Service
  def initialize(client)
    @client = client
  end

  protected

  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

  def more_pages?(collection)
    collection&.has_more
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
easypost-6.4.1 lib/easypost/services/base.rb
easypost-6.4.0 lib/easypost/services/base.rb
easypost-6.3.0 lib/easypost/services/base.rb
easypost-6.2.0 lib/easypost/services/base.rb
easypost-6.1.1 lib/easypost/services/base.rb
easypost-6.1.0 lib/easypost/services/base.rb