Class: SpotifyWebApi::Meta

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

Overview

Meta Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(analyzer_version = SKIP, platform = SKIP, detailed_status = SKIP, status_code = SKIP, timestamp = SKIP, analysis_time = SKIP, input_process = SKIP) ⇒ Meta

Returns a new instance of Meta.



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/spotify_web_api/models/meta.rb', line 73

def initialize(analyzer_version = SKIP, platform = SKIP,
               detailed_status = SKIP, status_code = SKIP, timestamp = SKIP,
               analysis_time = SKIP, input_process = SKIP)
  @analyzer_version = analyzer_version unless analyzer_version == SKIP
  @platform = platform unless platform == SKIP
  @detailed_status = detailed_status unless detailed_status == SKIP
  @status_code = status_code unless status_code == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @analysis_time = analysis_time unless analysis_time == SKIP
  @input_process = input_process unless input_process == SKIP
end

Instance Attribute Details

#analysis_timeFloat

The amount of time taken to analyze this track.

Returns:

  • (Float)


36
37
38
# File 'lib/spotify_web_api/models/meta.rb', line 36

def analysis_time
  @analysis_time
end

#analyzer_versionString

The version of the Analyzer used to analyze this track.

Returns:

  • (String)


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

def analyzer_version
  @analyzer_version
end

#detailed_statusString

A detailed status code for this track. If analysis data is missing, this code may explain why.

Returns:

  • (String)


23
24
25
# File 'lib/spotify_web_api/models/meta.rb', line 23

def detailed_status
  @detailed_status
end

#input_processString

The method used to read the track’s audio data.

Returns:

  • (String)


40
41
42
# File 'lib/spotify_web_api/models/meta.rb', line 40

def input_process
  @input_process
end

#platformString

The platform used to read the track’s audio data.

Returns:

  • (String)


18
19
20
# File 'lib/spotify_web_api/models/meta.rb', line 18

def platform
  @platform
end

#status_codeInteger

The return code of the analyzer process. 0 if successful, 1 if any errors occurred.

Returns:

  • (Integer)


28
29
30
# File 'lib/spotify_web_api/models/meta.rb', line 28

def status_code
  @status_code
end

#timestampInteger

The Unix timestamp (in seconds) at which this track was analyzed.

Returns:

  • (Integer)


32
33
34
# File 'lib/spotify_web_api/models/meta.rb', line 32

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/meta.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  analyzer_version =
    hash.key?('analyzer_version') ? hash['analyzer_version'] : SKIP
  platform = hash.key?('platform') ? hash['platform'] : SKIP
  detailed_status =
    hash.key?('detailed_status') ? hash['detailed_status'] : SKIP
  status_code = hash.key?('status_code') ? hash['status_code'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  analysis_time = hash.key?('analysis_time') ? hash['analysis_time'] : SKIP
  input_process = hash.key?('input_process') ? hash['input_process'] : SKIP

  # Create object from extracted values.
  Meta.new(analyzer_version,
           platform,
           detailed_status,
           status_code,
           timestamp,
           analysis_time,
           input_process)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/spotify_web_api/models/meta.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['analyzer_version'] = 'analyzer_version'
  @_hash['platform'] = 'platform'
  @_hash['detailed_status'] = 'detailed_status'
  @_hash['status_code'] = 'status_code'
  @_hash['timestamp'] = 'timestamp'
  @_hash['analysis_time'] = 'analysis_time'
  @_hash['input_process'] = 'input_process'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/spotify_web_api/models/meta.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/spotify_web_api/models/meta.rb', line 56

def self.optionals
  %w[
    analyzer_version
    platform
    detailed_status
    status_code
    timestamp
    analysis_time
    input_process
  ]
end