Sha256: 4632bc14d2db5189e0239185a1539a29d1f2bfcd916dafc5d6cf2fb6869e0d32

Contents?: true

Size: 585 Bytes

Versions: 7

Compression:

Stored size: 585 Bytes

Contents

# frozen_string_literal: true

class EasyPost::Services::CarrierMetadata < EasyPost::Services::Service
  # Retrieve metadata for carrier(s).
  def retrieve(carriers = [], types = [])
    path = '/metadata/carriers?'
    params = {}

    if carriers.length.positive?
      params[:carriers] = carriers.join(',')
    end

    if types.length.positive?
      params[:types] = types.join(',')
    end

    path += URI.encode_www_form(params)
    response = @client.make_request(:get, path, params)

    EasyPost::InternalUtilities::Json.convert_json_to_object(response).carriers
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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