Class: Cookie::Resources::Orders
- Inherits:
-
Object
- Object
- Cookie::Resources::Orders
- Defined in:
- lib/cookie/resources/orders.rb
Overview
Handles order-related operations with the Digital Cookie API
Instance Attribute Summary collapse
- #client ⇒ Object readonly
Instance Method Summary collapse
- #get_hand_delivery(troop_id) ⇒ Object
-
#initialize(client) ⇒ Orders
constructor
A new instance of Orders.
Constructor Details
#initialize(client) ⇒ Orders
Returns a new instance of Orders.
16 17 18 |
# File 'lib/cookie/resources/orders.rb', line 16 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
14 15 16 |
# File 'lib/cookie/resources/orders.rb', line 14 def client @client end |
Instance Method Details
#get_hand_delivery(troop_id) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cookie/resources/orders.rb', line 20 def get_hand_delivery(troop_id) response = @client.connection.get("getAllOrders/hand-delivery/#{troop_id}") order_response = Models::OrderResponse.new(response.body) if order_response.error? raise ApiError, order_response. end order_response rescue Faraday::Error => e raise ApiError, "Request failed: #{e.message}" end |