Sha256: 6ae9865bf4abc04dd1572ff0e8a258e38c83653407aeb98fd8ee0ce69fd19a79

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

# frozen_string_literal: true

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
          new(response)
        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/create.rb