Class: JsonApiReader::PageResult

Inherits:
Object
  • Object
show all
Defined in:
lib/json_api_reader/page_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(result_hash) ⇒ PageResult

Returns a new instance of PageResult.



3
4
5
# File 'lib/json_api_reader/page_result.rb', line 3

def initialize(result_hash)
  @result_hash = result_hash
end

Instance Method Details

#attributesObject



7
8
9
# File 'lib/json_api_reader/page_result.rb', line 7

def attributes
  @attributes ||= data.collect { |data_att| data_att['attributes'] }
end

#attributes_by_type(the_type) ⇒ Object



11
12
13
14
15
# File 'lib/json_api_reader/page_result.rb', line 11

def attributes_by_type(the_type)
  attributes.select do |att|
    the_type == att['type']
  end
end

#next_urlObject



17
18
19
# File 'lib/json_api_reader/page_result.rb', line 17

def next_url
  links['next']
end

#self_urlObject



21
22
23
# File 'lib/json_api_reader/page_result.rb', line 21

def self_url
  links['self']
end