Sha256: bf8efdf0c11dd70e4b8dddf40a7346a6743c6b16d2ca00a1bda8eda9a1340f69

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

module Shipcloud
  module Operations
    module Create
      module ClassMethods
        # Creates a new object
        #
        # @param [Hash] attributes The attributes of the created object
        # @param \[String\] optional api_key The api key. If no api key is given, Shipcloud.api_key
        # will be used for the request
        def create(attributes, api_key: nil, affiliate_id: nil)
          response = Shipcloud.request(
            :post,
            base_url,
            attributes,
            api_key: api_key,
            affiliate_id: affiliate_id,
          )
          if create_response_root
            response = response.fetch(create_response_root, {})
          end
          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/create.rb
shipcloud-0.10.0 lib/shipcloud/operations/create.rb