Class: SpotifyWebApi::CopyrightObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/spotify_web_api/models/copyright_object.rb

Overview

CopyrightObject Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(text = SKIP, type = SKIP) ⇒ CopyrightObject

Returns a new instance of CopyrightObject.



42
43
44
45
# File 'lib/spotify_web_api/models/copyright_object.rb', line 42

def initialize(text = SKIP, type = SKIP)
  @text = text unless text == SKIP
  @type = type unless type == SKIP
end

Instance Attribute Details

#textString

The copyright text for this content.

Returns:

  • (String)


14
15
16
# File 'lib/spotify_web_api/models/copyright_object.rb', line 14

def text
  @text
end

#typeString

The type of copyright: ‘C` = the copyright, `P` = the sound recording (performance) copyright.

Returns:

  • (String)


19
20
21
# File 'lib/spotify_web_api/models/copyright_object.rb', line 19

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/spotify_web_api/models/copyright_object.rb', line 48

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  text = hash.key?('text') ? hash['text'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP

  # Create object from extracted values.
  CopyrightObject.new(text,
                      type)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/spotify_web_api/models/copyright_object.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['text'] = 'text'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/spotify_web_api/models/copyright_object.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
35
# File 'lib/spotify_web_api/models/copyright_object.rb', line 30

def self.optionals
  %w[
    text
    type
  ]
end