Class: CDEKApiClient::API::Order
- Inherits:
-
Object
- Object
- CDEKApiClient::API::Order
- Defined in:
- lib/cdek_api_client/api/order.rb
Overview
Handles order-related API requests.
Instance Method Summary collapse
-
#create(order_data) ⇒ Hash
Creates a new order.
-
#initialize(client) ⇒ Order
constructor
Initializes the Order object.
-
#track(order_uuid) ⇒ Hash
Tracks an order by its UUID.
Constructor Details
#initialize(client) ⇒ Order
Initializes the Order object.
10 11 12 |
# File 'lib/cdek_api_client/api/order.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#create(order_data) ⇒ Hash
Creates a new order.
18 19 20 21 |
# File 'lib/cdek_api_client/api/order.rb', line 18 def create(order_data) response = @client.request('post', 'orders', body: order_data) handle_response(response) end |
#track(order_uuid) ⇒ Hash
Tracks an order by its UUID.
27 28 29 30 |
# File 'lib/cdek_api_client/api/order.rb', line 27 def track(order_uuid) response = @client.request('get', "orders/#{order_uuid}") handle_response(response) end |