Class: Rubyoverflow::RepChanges

Inherits:
PagedBase show all
Defined in:
lib/rubyoverflow/repChanges.rb

Instance Attribute Summary collapse

Attributes inherited from PagedBase

#page, #pagesize, #query_parameters, #request_path, #total

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PagedBase

#next_page_parameters, #perform_next_page_request

Methods inherited from Base

change_end_point, client, convert_if_array, convert_to_id_list, #find_parse_querystring, request, #request

Constructor Details

#initialize(hash, request_path = '') ⇒ RepChanges

Returns a new instance of RepChanges.



6
7
8
9
10
11
12
# File 'lib/rubyoverflow/repChanges.rb', line 6

def initialize(hash, request_path = '')
  dash = RepChangesDash.new hash
  super(dash, request_path)

  @rep_changes = Array.new
  dash.rep_changes.each{|repHash| @rep_changes.push(RepChange.new repHash)}
end

Instance Attribute Details

#rep_changesObject (readonly)

Returns the value of attribute rep_changes.



4
5
6
# File 'lib/rubyoverflow/repChanges.rb', line 4

def rep_changes
  @rep_changes
end

Class Method Details

.retrieve_by_user(id, parameters = {}) ⇒ Object

Retrieves all the rep_changes for a set of user(s) by their id(s)

id can be an int, string, or an array of ints or strings

Maps to ‘/usersid/reputation’



27
28
29
30
31
# File 'lib/rubyoverflow/repChanges.rb', line 27

def retrieve_by_user(id, parameters={})
  id = convert_to_id_list(id)
  hash, url = request('/users/' + id.to_s + '/reputation', parameters)
  RepChanges.new hash, url
end

Instance Method Details

#get_next_setObject

Retrieves the next set of RepChanges using the same parameters used to retrieve the current set



15
16
17
18
# File 'lib/rubyoverflow/repChanges.rb', line 15

def get_next_set
  hash,url = perform_next_page_request
  RepChanges.new hash,url
end