Sha256: 78cd2c3f004df3c95728a0d1eb2a26504b37571c612ce3f96b43551baf6b937b

Contents?: true

Size: 771 Bytes

Versions: 8

Compression:

Stored size: 771 Bytes

Contents

module ShopifyAPI
  class Order < Base
    include Events
    include Metafields

    def close
      load_attributes_from_response(post(:close, {}, only_id))
    end

    def open
      load_attributes_from_response(post(:open, {}, only_id))
    end

    def cancel(options = {})
      load_attributes_from_response(post(:cancel, {}, options.to_json))
    end

    def transactions
      Transaction.find(:all, :params => { :order_id => id })
    end

    def capture(amount = "", currency: nil)
      capture_transaction = {
        amount: amount,
        kind: "capture",
        order_id: id,
      }
      capture_transaction[:currency] = currency if currency

      Transaction.create(capture_transaction)
    end

    class ClientDetails < Base
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shopify_api-8.1.0 lib/shopify_api/resources/order.rb
shopify_api-8.0.0 lib/shopify_api/resources/order.rb
shopify_api-7.1.0 lib/shopify_api/resources/order.rb
shopify_api-7.0.2 lib/shopify_api/resources/order.rb
shopify_api-7.0.1 lib/shopify_api/resources/order.rb
shopify_api-7.0.0 lib/shopify_api/resources/order.rb
shopify_api-6.0.0 lib/shopify_api/resources/order.rb
shopify_api-5.2.4 lib/shopify_api/resources/order.rb