Module: EasyPing::Model::List

Defined in:
lib/easy_ping/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#has_moreObject (readonly)

Returns the value of attribute has_more.



7
8
9
# File 'lib/easy_ping/model.rb', line 7

def has_more
  @has_more
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/easy_ping/model.rb', line 7

def url
  @url
end

Instance Method Details

#get_next_pageObject

Raises:



9
10
11
12
13
14
15
16
17
# File 'lib/easy_ping/model.rb', line 9

def get_next_page
  raise ParametersInvalid, 'cannot find the last item of this list' unless models.last
  starting_after = models.last.id
  params = extract_params
  params.delete 'ending_before'
  params.merge!({'starting_after' => starting_after})

  action_class.new(config).all(params)
end

#get_next_page!Object



19
20
21
# File 'lib/easy_ping/model.rb', line 19

def get_next_page!
  setup(get_next_page.response)
end

#get_prev_pageObject

Raises:



23
24
25
26
27
28
29
30
31
# File 'lib/easy_ping/model.rb', line 23

def get_prev_page
  raise ParametersInvalid, 'cannot find the first item of this list' unless models.first
  ending_before = models.first.id
  params = extract_params
  params.delete 'starting_after'
  params.merge!({'ending_before' => ending_before})

  action_class.new(config).all(params)
end

#get_prev_page!Object



33
34
35
# File 'lib/easy_ping/model.rb', line 33

def get_prev_page!
  setup(get_prev_page.response)
end