Class: PacerApi::Immediate::PaginatedResponse
- Inherits:
-
Struct
- Object
- Struct
- PacerApi::Immediate::PaginatedResponse
show all
- Defined in:
- lib/pacer_api/immediate/paginated_response.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#payload ⇒ Object
Returns the value of attribute payload
5
6
7
|
# File 'lib/pacer_api/immediate/paginated_response.rb', line 5
def payload
@payload
end
|
Instance Method Details
#errors ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/pacer_api/immediate/paginated_response.rb', line 22
def errors
if payload.key?(:error)
payload.fetch(:error).map { |e| e.fetch(:messages) }.flatten
else
[]
end
end
|
#last? ⇒ Boolean
18
19
20
|
# File 'lib/pacer_api/immediate/paginated_response.rb', line 18
def last?
page_info(:last)
end
|
#page ⇒ Object
6
7
8
|
# File 'lib/pacer_api/immediate/paginated_response.rb', line 6
def page
page_info(:number)
end
|
#total_elements ⇒ Object
14
15
16
|
# File 'lib/pacer_api/immediate/paginated_response.rb', line 14
def total_elements
page_info(:total_elements)
end
|
#total_pages ⇒ Object
10
11
12
|
# File 'lib/pacer_api/immediate/paginated_response.rb', line 10
def total_pages
page_info(:total_pages)
end
|