Class: SpotifyWebApi::ErrorObject
- Defined in:
- lib/spotify_web_api/models/error_object.rb
Overview
ErrorObject Model.
Instance Attribute Summary collapse
-
#message ⇒ String
A short description of the cause of the error.
-
#status ⇒ Integer
The HTTP status code (also returned in the response header; see [Response Status Codes](/documentation/web-api/concepts/api-calls#response-status-codes) for more information).
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(status = nil, message = nil) ⇒ ErrorObject
constructor
A new instance of ErrorObject.
Methods inherited from BaseModel
Constructor Details
#initialize(status = nil, message = nil) ⇒ ErrorObject
Returns a new instance of ErrorObject.
41 42 43 44 |
# File 'lib/spotify_web_api/models/error_object.rb', line 41 def initialize(status = nil, = nil) @status = status @message = end |
Instance Attribute Details
#message ⇒ String
A short description of the cause of the error.
21 22 23 |
# File 'lib/spotify_web_api/models/error_object.rb', line 21 def @message end |
#status ⇒ Integer
The HTTP status code (also returned in the response header; see [Response Status Codes](/documentation/web-api/concepts/api-calls#response-status-codes) for more information).
17 18 19 |
# File 'lib/spotify_web_api/models/error_object.rb', line 17 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/spotify_web_api/models/error_object.rb', line 47 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. status = hash.key?('status') ? hash['status'] : nil = hash.key?('message') ? hash['message'] : nil # Create object from extracted values. ErrorObject.new(status, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 |
# File 'lib/spotify_web_api/models/error_object.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['status'] = 'status' @_hash['message'] = 'message' @_hash end |
.nullables ⇒ Object
An array for nullable fields
37 38 39 |
# File 'lib/spotify_web_api/models/error_object.rb', line 37 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 |
# File 'lib/spotify_web_api/models/error_object.rb', line 32 def self.optionals [] end |