Class: PacerApi::Immediate::PaginatedResponse

Inherits:
Struct
  • Object
show all
Defined in:
lib/pacer_api/immediate/paginated_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#payloadObject

Returns the value of attribute payload

Returns:

  • (Object)

    the current value of payload



5
6
7
# File 'lib/pacer_api/immediate/paginated_response.rb', line 5

def payload
  @payload
end

Instance Method Details

#errorsObject



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

Returns:

  • (Boolean)


18
19
20
# File 'lib/pacer_api/immediate/paginated_response.rb', line 18

def last?
  page_info(:last)
end

#pageObject



6
7
8
# File 'lib/pacer_api/immediate/paginated_response.rb', line 6

def page
  page_info(:number)
end

#total_elementsObject



14
15
16
# File 'lib/pacer_api/immediate/paginated_response.rb', line 14

def total_elements
  page_info(:total_elements)
end

#total_pagesObject



10
11
12
# File 'lib/pacer_api/immediate/paginated_response.rb', line 10

def total_pages
  page_info(:total_pages)
end