Class: ShiprocketAPI::ReturnOrderCollection
- Inherits:
-
ActiveResource::Collection
- Object
- ActiveResource::Collection
- ShiprocketAPI::ReturnOrderCollection
- Defined in:
- lib/shiprocket_api/return_order_collection.rb
Instance Method Summary collapse
- #fetch_next_page ⇒ Object
- #fetch_previous_page ⇒ Object
-
#initialize(args) ⇒ ReturnOrderCollection
constructor
A new instance of ReturnOrderCollection.
- #next_page? ⇒ Boolean
- #previous_page? ⇒ Boolean
Constructor Details
#initialize(args) ⇒ ReturnOrderCollection
Returns a new instance of ReturnOrderCollection.
3 4 5 6 7 8 |
# File 'lib/shiprocket_api/return_order_collection.rb', line 3 def initialize(args) @per_page = args.dig('meta', 'pagination', 'per_page') @next_url = args.dig('meta', 'pagination', 'links', 'next') @previous_url = args.dig('meta', 'pagination', 'links', 'previous') super(args['data']) end |
Instance Method Details
#fetch_next_page ⇒ Object
18 19 20 |
# File 'lib/shiprocket_api/return_order_collection.rb', line 18 def fetch_next_page fetch_page(next_url) end |
#fetch_previous_page ⇒ Object
22 23 24 |
# File 'lib/shiprocket_api/return_order_collection.rb', line 22 def fetch_previous_page fetch_page(previous_url) end |
#next_page? ⇒ Boolean
14 15 16 |
# File 'lib/shiprocket_api/return_order_collection.rb', line 14 def next_page? next_url.present? end |
#previous_page? ⇒ Boolean
10 11 12 |
# File 'lib/shiprocket_api/return_order_collection.rb', line 10 def previous_page? previous_url.present? end |