Class: Strava::Api::Cursor
- Inherits:
-
Object
- Object
- Strava::Api::Cursor
- Includes:
- Enumerable
- Defined in:
- lib/strava/api/cursor.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(client, path, params = {}) ⇒ Cursor
constructor
A new instance of Cursor.
Constructor Details
#initialize(client, path, params = {}) ⇒ Cursor
10 11 12 13 14 |
# File 'lib/strava/api/cursor.rb', line 10 def initialize(client, path, params = {}) @client = client @path = path @params = params.key?(:limit) ? params.dup.tap { |p| p.delete :limit } : params end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/strava/api/cursor.rb', line 8 def client @client end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/strava/api/cursor.rb', line 8 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/strava/api/cursor.rb', line 8 def path @path end |
Instance Method Details
#each(&block) ⇒ Object
16 17 18 |
# File 'lib/strava/api/cursor.rb', line 16 def each(&block) params[:page_size] ? each_cursor(&block) : each_page(&block) end |