Class: ContentNetwork::Collection
- Inherits:
-
Object
- Object
- ContentNetwork::Collection
- Defined in:
- lib/content_network/collection.rb
Instance Method Summary collapse
- #data ⇒ Object
- #error ⇒ Object
- #error? ⇒ Boolean
-
#initialize(response) ⇒ Collection
constructor
A new instance of Collection.
- #pagination ⇒ Object
- #pagination? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Collection
Returns a new instance of Collection.
3 4 5 |
# File 'lib/content_network/collection.rb', line 3 def initialize(response) @response = response end |
Instance Method Details
#data ⇒ Object
7 8 9 10 |
# File 'lib/content_network/collection.rb', line 7 def data return nil if error? parsed_response['data'] end |
#error ⇒ Object
27 28 29 30 |
# File 'lib/content_network/collection.rb', line 27 def error parsed_response @error end |
#error? ⇒ Boolean
22 23 24 25 |
# File 'lib/content_network/collection.rb', line 22 def error? parsed_response @error.present? end |
#pagination ⇒ Object
17 18 19 20 |
# File 'lib/content_network/collection.rb', line 17 def pagination return nil unless pagination? parsed_response['meta']['pagination'] end |
#pagination? ⇒ Boolean
12 13 14 15 |
# File 'lib/content_network/collection.rb', line 12 def pagination? return false if error? parsed_response['meta'].has_key?('pagination') end |