Sha256: 0dd0c7e20f39100e876e6a58633f26aa69e3654427df978c5054588b1327ef72

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

module Shipcloud
  module Operations
    module All
      module ClassMethods
        # Loads all Objects of the resource
        # @param [Hash] optional filter Filter the shipments list using one or more filter
        # creteria
        # @param [String] optional api_key The api key. If no api key is given, Shipcloud.api_key
        # will be used for the request
        def all(filter = {}, api_key: nil, affiliate_id: nil)
          response = Shipcloud.request(
            :get,
            base_url,
            filter,
            api_key: api_key,
            affiliate_id: affiliate_id,
          )
          if index_response_root
            response = response.fetch(index_response_root, [])
          end
          response.map { |hash| new(hash) }
        end
      end

      def self.included(base)
        base.extend(ClassMethods)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shipcloud-0.12.0 lib/shipcloud/operations/all.rb