Sha256: ec00d8b26b590f7ea8108d9ecf1d38f93b44d4acac42132bf449e4851b0e2de4

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

module Shipcloud
  module Operations
    module Find
      module ClassMethods
        # Finds a given object
        #
        # @param [String] id The id of the object that should be found
        # @param \[String\] optional api_key The api key. If no api key is given, Shipcloud.api_key
        # will be used for the request
        # @return [Shipcloud::Base] The found object
        def find(id, api_key: nil, affiliate_id: nil)
          response = Shipcloud.request(
            :get,
            "#{base_url}/#{id}",
            {},
            api_key: api_key,
            affiliate_id: affiliate_id,
          )
          self.new(response)
        end
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shipcloud-0.11.0 lib/shipcloud/operations/find.rb
shipcloud-0.10.0 lib/shipcloud/operations/find.rb