Module: Marvel::Response
- Included in:
- Request
- Defined in:
- lib/marvel/error.rb,
lib/marvel/response.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#etag ⇒ Object
readonly
Returns the value of attribute etag.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Class Method Summary collapse
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
18 19 20 |
# File 'lib/marvel/response.rb', line 18 def code @code end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
18 19 20 |
# File 'lib/marvel/response.rb', line 18 def count @count end |
#etag ⇒ Object (readonly)
Returns the value of attribute etag.
18 19 20 |
# File 'lib/marvel/response.rb', line 18 def etag @etag end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
18 19 20 |
# File 'lib/marvel/response.rb', line 18 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
18 19 20 |
# File 'lib/marvel/response.rb', line 18 def offset @offset end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
18 19 20 |
# File 'lib/marvel/response.rb', line 18 def status @status end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
18 19 20 |
# File 'lib/marvel/response.rb', line 18 def total @total end |
Class Method Details
.create(response_hash) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/marvel/response.rb', line 3 def self.create(response_hash) results = response_hash.data.results.dup rescue response_hash results.extend(self) results.instance_exec do @code = response_hash.code @status = response_hash.status @etag = response_hash.etag @offset = response_hash.data.offset @limit = response_hash.data.limit @total = response_hash.data.total @count = response_hash.data.count end results end |