Class: SpotifyWebApi::CursorPagingObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::CursorPagingObject
- Defined in:
- lib/spotify_web_api/models/cursor_paging_object.rb
Overview
CursorPagingObject Model.
Instance Attribute Summary collapse
-
#cursors ⇒ CursorObject
The cursors used to find the next set of items.
-
#href ⇒ String
A link to the Web API endpoint returning the full result of the request.
-
#limit ⇒ Integer
The maximum number of items in the response (as set in the query or by default).
-
#mnext ⇒ String
URL to the next page of items.
-
#total ⇒ Integer
The total number of items available to return.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(href = SKIP, limit = SKIP, mnext = SKIP, cursors = SKIP, total = SKIP) ⇒ CursorPagingObject
constructor
A new instance of CursorPagingObject.
Methods inherited from BaseModel
Constructor Details
#initialize(href = SKIP, limit = SKIP, mnext = SKIP, cursors = SKIP, total = SKIP) ⇒ CursorPagingObject
Returns a new instance of CursorPagingObject.
60 61 62 63 64 65 66 67 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 60 def initialize(href = SKIP, limit = SKIP, mnext = SKIP, cursors = SKIP, total = SKIP) @href = href unless href == SKIP @limit = limit unless limit == SKIP @mnext = mnext unless mnext == SKIP @cursors = cursors unless cursors == SKIP @total = total unless total == SKIP end |
Instance Attribute Details
#cursors ⇒ CursorObject
The cursors used to find the next set of items.
27 28 29 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 27 def cursors @cursors end |
#href ⇒ String
A link to the Web API endpoint returning the full result of the request.
14 15 16 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 14 def href @href end |
#limit ⇒ Integer
The maximum number of items in the response (as set in the query or by default).
19 20 21 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 19 def limit @limit end |
#mnext ⇒ String
URL to the next page of items. ( ‘null` if none)
23 24 25 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 23 def mnext @mnext end |
#total ⇒ Integer
The total number of items available to return.
31 32 33 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 31 def total @total end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. href = hash.key?('href') ? hash['href'] : SKIP limit = hash.key?('limit') ? hash['limit'] : SKIP mnext = hash.key?('next') ? hash['next'] : SKIP cursors = CursorObject.from_hash(hash['cursors']) if hash['cursors'] total = hash.key?('total') ? hash['total'] : SKIP # Create object from extracted values. CursorPagingObject.new(href, limit, mnext, cursors, total) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['href'] = 'href' @_hash['limit'] = 'limit' @_hash['mnext'] = 'next' @_hash['cursors'] = 'cursors' @_hash['total'] = 'total' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/spotify_web_api/models/cursor_paging_object.rb', line 45 def self.optionals %w[ href limit mnext cursors total ] end |