Class: TrueTrial::Resources::Orders
- Inherits:
-
Object
- Object
- TrueTrial::Resources::Orders
- Defined in:
- lib/truetrial/resources/orders.rb
Overview
Provides access to order-related API endpoints.
Instance Method Summary collapse
-
#create(data) ⇒ Hash
Creates a new order.
-
#get(id) ⇒ Hash
Retrieves a single order by ID.
-
#initialize(http_client) ⇒ Orders
constructor
A new instance of Orders.
-
#list(filters = {}) ⇒ Hash
Lists orders with optional filters.
-
#status(id) ⇒ Hash
Retrieves the current status of an order.
Constructor Details
#initialize(http_client) ⇒ Orders
Returns a new instance of Orders.
7 8 9 |
# File 'lib/truetrial/resources/orders.rb', line 7 def initialize(http_client) @http = http_client end |
Instance Method Details
#create(data) ⇒ Hash
Creates a new order.
23 24 25 |
# File 'lib/truetrial/resources/orders.rb', line 23 def create(data) @http.post("/orders", body: data) end |
#get(id) ⇒ Hash
Retrieves a single order by ID.
31 32 33 |
# File 'lib/truetrial/resources/orders.rb', line 31 def get(id) @http.get("/orders/#{id}") end |
#list(filters = {}) ⇒ Hash
Lists orders with optional filters.
15 16 17 |
# File 'lib/truetrial/resources/orders.rb', line 15 def list(filters = {}) @http.get("/orders", params: filters) end |
#status(id) ⇒ Hash
Retrieves the current status of an order.
39 40 41 |
# File 'lib/truetrial/resources/orders.rb', line 39 def status(id) @http.get("/orders/#{id}/status") end |