Class: AppleMusic::Response
- Inherits:
-
Object
- Object
- AppleMusic::Response
- Defined in:
- lib/apple_music/response.rb
Overview
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#next ⇒ Object
readonly
Returns the value of attribute next.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(props = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(props = {}) ⇒ Response
Returns a new instance of Response.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/apple_music/response.rb', line 8 def initialize(props = {}) props ||= {} @data = Array(props['data']).map { |attrs| Resource.build(attrs) } @errors = Array(props['errors']).map { |attrs| Error.new(attrs) } @href = props['href'] @meta = props['meta'] @next = props['next'] @results = props['results'] raise_api_error unless success? end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/apple_music/response.rb', line 6 def data @data end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/apple_music/response.rb', line 6 def errors @errors end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
6 7 8 |
# File 'lib/apple_music/response.rb', line 6 def href @href end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
6 7 8 |
# File 'lib/apple_music/response.rb', line 6 def @meta end |
#next ⇒ Object (readonly)
Returns the value of attribute next.
6 7 8 |
# File 'lib/apple_music/response.rb', line 6 def next @next end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
6 7 8 |
# File 'lib/apple_music/response.rb', line 6 def results @results end |