Class: Supai::OrdersResponse
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/supai/orders_response.rb
Instance Attribute Summary collapse
-
#total_orders ⇒ Object
Returns the value of attribute total_orders.
Instance Method Summary collapse
-
#initialize(hash, chain_id, store_id, params) ⇒ OrdersResponse
constructor
A new instance of OrdersResponse.
- #inspect ⇒ Object
- #next(token:, api: API.new) ⇒ Object
- #params ⇒ Object
Methods inherited from Resource
#as_json, attr_accessor, attr_collections, attr_objects, attr_timestamp_accessor, attributes, #parse_collection, #parse_object, #parse_timestamp, #set_attribute, #set_attributes, #underscore
Constructor Details
#initialize(hash, chain_id, store_id, params) ⇒ OrdersResponse
Returns a new instance of OrdersResponse.
13 14 15 16 17 18 |
# File 'lib/supai/orders_response.rb', line 13 def initialize(hash, chain_id, store_id, params) set_attributes(hash) @chain_id = chain_id @store_id = store_id @params = params end |
Instance Attribute Details
#total_orders ⇒ Object
Returns the value of attribute total_orders.
8 9 10 |
# File 'lib/supai/orders_response.rb', line 8 def total_orders @total_orders end |
Instance Method Details
#inspect ⇒ Object
32 33 34 |
# File 'lib/supai/orders_response.rb', line 32 def inspect "#<#{self.class} count: #{count}}>" end |
#next(token:, api: API.new) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/supai/orders_response.rb', line 24 def next(token:, api: API.new) skip = (@params[:skip] || 0) + count return nil if skip >= total_orders @params[:skip] = skip Order.all(chain_id: @chain_id, store_id: @store_id, params: @params, token: token, api: api) end |
#params ⇒ Object
20 21 22 |
# File 'lib/supai/orders_response.rb', line 20 def params @params end |