Class: Teamtailor::PageResult
- Inherits:
-
Object
- Object
- Teamtailor::PageResult
- Defined in:
- lib/teamtailor/page_result.rb
Instance Method Summary collapse
- #data ⇒ Object
- #first_page_url ⇒ Object
- #has_next_page? ⇒ Boolean
-
#initialize(response_body) ⇒ PageResult
constructor
A new instance of PageResult.
- #last_page_url ⇒ Object
- #next_page_url ⇒ Object
- #page_count ⇒ Object
- #record_count ⇒ Object
- #records ⇒ Object
Constructor Details
#initialize(response_body) ⇒ PageResult
Returns a new instance of PageResult.
7 8 9 |
# File 'lib/teamtailor/page_result.rb', line 7 def initialize(response_body) @json_response = JSON.parse(response_body) end |
Instance Method Details
#data ⇒ Object
15 16 17 |
# File 'lib/teamtailor/page_result.rb', line 15 def data json_response.dig('data') end |
#first_page_url ⇒ Object
31 32 33 |
# File 'lib/teamtailor/page_result.rb', line 31 def first_page_url json_response.dig('links', 'first') end |
#has_next_page? ⇒ Boolean
39 40 41 |
# File 'lib/teamtailor/page_result.rb', line 39 def has_next_page? !next_page_url.nil? end |
#last_page_url ⇒ Object
35 36 37 |
# File 'lib/teamtailor/page_result.rb', line 35 def last_page_url json_response.dig('links', 'last') end |
#next_page_url ⇒ Object
27 28 29 |
# File 'lib/teamtailor/page_result.rb', line 27 def next_page_url json_response.dig('links', 'next') end |
#page_count ⇒ Object
19 20 21 |
# File 'lib/teamtailor/page_result.rb', line 19 def page_count json_response.dig('meta', 'page-count') end |
#record_count ⇒ Object
23 24 25 |
# File 'lib/teamtailor/page_result.rb', line 23 def record_count json_response.dig('meta', 'record-count') end |
#records ⇒ Object
11 12 13 |
# File 'lib/teamtailor/page_result.rb', line 11 def records Teamtailor::Parser.parse json_response end |