Class: GunBroker::OrdersAsPage
- Inherits:
-
Object
- Object
- GunBroker::OrdersAsPage
- Defined in:
- lib/gun_broker/orders_as_page.rb
Overview
Represents a page of GunBroker orders.
Instance Method Summary collapse
- #fetch_orders ⇒ Array<Order>
-
#initialize(attributes = {}) ⇒ OrdersAsPage
constructor
A new instance of OrdersAsPage.
Constructor Details
#initialize(attributes = {}) ⇒ OrdersAsPage
Returns a new instance of OrdersAsPage.
6 7 8 |
# File 'lib/gun_broker/orders_as_page.rb', line 6 def initialize(attributes = {}) @attributes = attributes end |
Instance Method Details
#fetch_orders ⇒ Array<Order>
11 12 13 14 15 16 17 18 19 |
# File 'lib/gun_broker/orders_as_page.rb', line 11 def fetch_orders @attributes[:params].merge!({ 'PageIndex' => @attributes[:page_index], 'PageSize' => @attributes[:page_size], }) response = GunBroker::API.get(@attributes[:endpoint], @attributes[:params], @attributes[:token_header]) response['results'].map { |result| GunBroker::Order.new(result) } end |