Class: Cookie::Models::OrderResponse

Inherits:
BaseResponse show all
Defined in:
lib/cookie/models/order_response.rb

Overview

Response containing order information and details

Examples:

orders = client.orders.get_hand_delivery("12345")
puts orders.total_order_count # => 119
puts orders.orders.first.order_number # => "132747574"

Defined Under Namespace

Classes: Order

Instance Attribute Summary collapse

Attributes inherited from BaseResponse

#error_code, #error_message, #expired, #type

Instance Method Summary collapse

Methods inherited from BaseResponse

#authentication_error?, #error?

Constructor Details

#initialize(attributes) ⇒ OrderResponse

Returns a new instance of OrderResponse.



14
15
16
17
18
19
# File 'lib/cookie/models/order_response.rb', line 14

def initialize(attributes)
  super
  @can_view_details = attributes["canViewDetails"]
  @total_order_count = attributes["totalOrderCount"]
  @orders = (attributes["orders"] || []).map { |order| Order.new(order) }
end

Instance Attribute Details

#can_view_detailsObject (readonly)

Returns the value of attribute can_view_details.



12
13
14
# File 'lib/cookie/models/order_response.rb', line 12

def can_view_details
  @can_view_details
end

#ordersObject (readonly)

Returns the value of attribute orders.



12
13
14
# File 'lib/cookie/models/order_response.rb', line 12

def orders
  @orders
end

#total_order_countObject (readonly)

Returns the value of attribute total_order_count.



12
13
14
# File 'lib/cookie/models/order_response.rb', line 12

def total_order_count
  @total_order_count
end