Class: Cased::CollectionResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/cased/collection_response.rb

Instance Attribute Summary

Attributes inherited from Response

#body, #exception

Instance Method Summary collapse

Methods inherited from Response

#error, #error?, #initialize, #success?

Constructor Details

This class inherits a constructor from Cased::Response

Instance Method Details

#first_pageObject



65
66
67
# File 'lib/cased/collection_response.rb', line 65

def first_page
  page_from(:first)
end

#first_page?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/cased/collection_response.rb', line 69

def first_page?
  first_page.present?
end

#first_page_urlObject



61
62
63
# File 'lib/cased/collection_response.rb', line 61

def first_page_url
  links[:first]
end

#first_page_url?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/cased/collection_response.rb', line 57

def first_page_url?
  first_page_url.present?
end

#last_pageObject



81
82
83
# File 'lib/cased/collection_response.rb', line 81

def last_page
  page_from(:last)
end

#last_page?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/cased/collection_response.rb', line 85

def last_page?
  last_page.present?
end

#last_page_urlObject



77
78
79
# File 'lib/cased/collection_response.rb', line 77

def last_page_url
  links[:last]
end

#last_page_url?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/cased/collection_response.rb', line 73

def last_page_url?
  last_page_url.present?
end

#next_pageObject



33
34
35
# File 'lib/cased/collection_response.rb', line 33

def next_page
  page_from(:next)
end

#next_page?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/cased/collection_response.rb', line 37

def next_page?
  next_page.present?
end

#next_page_urlObject



29
30
31
# File 'lib/cased/collection_response.rb', line 29

def next_page_url
  links[:next]
end

#next_page_url?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/cased/collection_response.rb', line 25

def next_page_url?
  next_page_url.present?
end

#previous_pageObject



49
50
51
# File 'lib/cased/collection_response.rb', line 49

def previous_page
  page_from(:prev)
end

#previous_page?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/cased/collection_response.rb', line 53

def previous_page?
  previous_page.present?
end

#previous_page_urlObject



45
46
47
# File 'lib/cased/collection_response.rb', line 45

def previous_page_url
  links[:prev]
end

#previous_page_url?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/cased/collection_response.rb', line 41

def previous_page_url?
  previous_page_url.present?
end

#resultsObject



7
8
9
10
11
# File 'lib/cased/collection_response.rb', line 7

def results
  return [] unless body

  body['results']
end

#total_countObject



13
14
15
16
17
# File 'lib/cased/collection_response.rb', line 13

def total_count
  return unless body

  body['total_count']
end

#total_pagesObject



19
20
21
22
23
# File 'lib/cased/collection_response.rb', line 19

def total_pages
  return unless body

  body['total_pages']
end