Class: ContentNetwork::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/content_network/collection.rb

Instance Method Summary collapse

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

#dataObject



7
8
9
10
# File 'lib/content_network/collection.rb', line 7

def data
  return nil if error?
  parsed_response['data']
end

#errorObject



27
28
29
30
# File 'lib/content_network/collection.rb', line 27

def error
  parsed_response
  @error
end

#error?Boolean

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/content_network/collection.rb', line 22

def error?
  parsed_response
  @error.present?
end

#paginationObject



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

Returns:

  • (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