Class: SpotifyWebApi::PagingArtistDiscographyAlbumObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::PagingArtistDiscographyAlbumObject
- Defined in:
- lib/spotify_web_api/models/paging_artist_discography_album_object.rb
Overview
PagingArtistDiscographyAlbumObject Model.
Instance Attribute Summary collapse
-
#href ⇒ String
A link to the Web API endpoint returning the full result of the request.
-
#items ⇒ Array[ArtistDiscographyAlbumObject]
The total number of items available to return.
-
#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.
-
#offset ⇒ Integer
The offset of the items returned (as set in the query or by default).
-
#previous ⇒ String
URL to the previous 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 = nil, limit = nil, mnext = nil, offset = nil, previous = nil, total = nil, items = nil) ⇒ PagingArtistDiscographyAlbumObject
constructor
A new instance of PagingArtistDiscographyAlbumObject.
Methods inherited from BaseModel
Constructor Details
#initialize(href = nil, limit = nil, mnext = nil, offset = nil, previous = nil, total = nil, items = nil) ⇒ PagingArtistDiscographyAlbumObject
Returns a new instance of PagingArtistDiscographyAlbumObject.
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 67 def initialize(href = nil, limit = nil, mnext = nil, offset = nil, previous = nil, total = nil, items = nil) @href = href @limit = limit @mnext = mnext @offset = offset @previous = previous @total = total @items = items end |
Instance Attribute Details
#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/paging_artist_discography_album_object.rb', line 14 def href @href end |
#items ⇒ Array[ArtistDiscographyAlbumObject]
The total number of items available to return.
39 40 41 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 39 def items @items 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/paging_artist_discography_album_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/paging_artist_discography_album_object.rb', line 23 def mnext @mnext end |
#offset ⇒ Integer
The offset of the items returned (as set in the query or by default)
27 28 29 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 27 def offset @offset end |
#previous ⇒ String
URL to the previous page of items. ( ‘null` if none)
31 32 33 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 31 def previous @previous end |
#total ⇒ Integer
The total number of items available to return.
35 36 37 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 35 def total @total end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. href = hash.key?('href') ? hash['href'] : nil limit = hash.key?('limit') ? hash['limit'] : nil mnext = hash.key?('next') ? hash['next'] : nil offset = hash.key?('offset') ? hash['offset'] : nil previous = hash.key?('previous') ? hash['previous'] : nil total = hash.key?('total') ? hash['total'] : nil # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (ArtistDiscographyAlbumObject.from_hash(structure) if structure) end end items = nil unless hash.key?('items') # Create object from extracted values. PagingArtistDiscographyAlbumObject.new(href, limit, mnext, offset, previous, total, items) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['href'] = 'href' @_hash['limit'] = 'limit' @_hash['mnext'] = 'next' @_hash['offset'] = 'offset' @_hash['previous'] = 'previous' @_hash['total'] = 'total' @_hash['items'] = 'items' @_hash end |
.nullables ⇒ Object
An array for nullable fields
60 61 62 63 64 65 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 60 def self.nullables %w[ mnext previous ] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 |
# File 'lib/spotify_web_api/models/paging_artist_discography_album_object.rb', line 55 def self.optionals [] end |