Class: JsonApiReader::PageResult
- Inherits:
-
Object
- Object
- JsonApiReader::PageResult
- Defined in:
- lib/json_api_reader/page_result.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #attributes_by_type(the_type) ⇒ Object
-
#initialize(result_hash) ⇒ PageResult
constructor
A new instance of PageResult.
- #next_url ⇒ Object
- #self_url ⇒ Object
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
#attributes ⇒ Object
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_url ⇒ Object
17 18 19 |
# File 'lib/json_api_reader/page_result.rb', line 17 def next_url links['next'] end |
#self_url ⇒ Object
21 22 23 |
# File 'lib/json_api_reader/page_result.rb', line 21 def self_url links['self'] end |