Sha256: b2529a62f9af00f012582a38c84be4020dbcc21cbb8c00dd2a8117f05363faa3

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module Rubyoverflow
  class RepChanges < PagedBase
  
    attr_reader :rep_changes
  
    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
    
    #Retrieves the next set of RepChanges using the same parameters used to retrieve the current set
    def get_next_set
      hash,url = perform_next_page_request
      RepChanges.new hash,url
    end
    
    class << self
    
      #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 '/users{id}/reputation'
      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
    
    end
  
  end

  class RepChangesDash < PagedDash
    property :rep_changes
  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyoverflow-1.0.2 lib/rubyoverflow/repChanges.rb