Class: EcwidApi::Api::Orders

Inherits:
Base
  • Object
show all
Defined in:
lib/ecwid_api/api/orders.rb

Overview

Public: This is the Ecwid API for Orders. It abstracts the end-points of the Ecwid API that deal with orders.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from EcwidApi::Api::Base

Instance Method Details

#all(params = {}) ⇒ Object

Public: Gets Orders from the Ecwid API

params - optional parameters that can be used to filter the request.

For a list of params, please refer to the API documentation:
http://kb.ecwid.com/w/page/43697230/Order%20API
Note that the limit and offset parameters will be overridden
since all orders will be returned and enumerated

Returns a PagedEnumerator of ‘EcwidApi::Order` objects



17
18
19
20
21
# File 'lib/ecwid_api/api/orders.rb', line 17

def all(params = {})
  PagedEcwidResponse.new(client, "orders", params) do |order_hash|
    Order.new(order_hash, client: client)
  end
end

#find(id) ⇒ Object

Public: Finds a an Order given an Ecwid id

id - an Integer that is the Ecwid Order number

Returns an EcwidApi::Order if found, nil if not



28
29
30
31
32
33
# File 'lib/ecwid_api/api/orders.rb', line 28

def find(id)
  response = client.get("orders/#{id}")
  if response.success?
    Order.new(response.body, client: client)
  end
end