Class: SpotifyWebApi::ExternalIdObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::ExternalIdObject
- Defined in:
- lib/spotify_web_api/models/external_id_object.rb
Overview
ExternalIdObject Model.
Instance Attribute Summary collapse
-
#ean ⇒ String
[International Article Number](en.wikipedia.org/wiki/International_Article_Number_%28EAN%2 9).
-
#isrc ⇒ String
[International Standard Recording Code](en.wikipedia.org/wiki/International_Standard_Recording_Code).
-
#upc ⇒ String
[Universal Product Code](en.wikipedia.org/wiki/Universal_Product_Code).
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(isrc = SKIP, ean = SKIP, upc = SKIP) ⇒ ExternalIdObject
constructor
A new instance of ExternalIdObject.
Methods inherited from BaseModel
Constructor Details
#initialize(isrc = SKIP, ean = SKIP, upc = SKIP) ⇒ ExternalIdObject
Returns a new instance of ExternalIdObject.
51 52 53 54 55 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 51 def initialize(isrc = SKIP, ean = SKIP, upc = SKIP) @isrc = isrc unless isrc == SKIP @ean = ean unless ean == SKIP @upc = upc unless upc == SKIP end |
Instance Attribute Details
#ean ⇒ String
[International Article Number](en.wikipedia.org/wiki/International_Article_Number_%28EAN%2 9)
21 22 23 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 21 def ean @ean end |
#isrc ⇒ String
[International Standard Recording Code](en.wikipedia.org/wiki/International_Standard_Recording_Code)
15 16 17 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 15 def isrc @isrc end |
#upc ⇒ String
[Universal Product Code](en.wikipedia.org/wiki/Universal_Product_Code)
26 27 28 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 26 def upc @upc end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 58 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. isrc = hash.key?('isrc') ? hash['isrc'] : SKIP ean = hash.key?('ean') ? hash['ean'] : SKIP upc = hash.key?('upc') ? hash['upc'] : SKIP # Create object from extracted values. ExternalIdObject.new(isrc, ean, upc) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['isrc'] = 'isrc' @_hash['ean'] = 'ean' @_hash['upc'] = 'upc' @_hash end |
.nullables ⇒ Object
An array for nullable fields
47 48 49 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 47 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
38 39 40 41 42 43 44 |
# File 'lib/spotify_web_api/models/external_id_object.rb', line 38 def self.optionals %w[ isrc ean upc ] end |