class GunBroker::Feedback

Handles feedback about and by a {User}.

Public Class Methods

all(user_id) click to toggle source

@param user_id [Integer, String] Return feedback by this User's ID. @return [Array<Feedback>] An array of the User's feedback.

# File lib/gun_broker/feedback.rb, line 7
def self.all(user_id)
  response = GunBroker::API.get("/Feedback/#{user_id}")
  response['results'].map { |attrs| new(attrs) }
end
new(attrs = {}) click to toggle source

@param attrs [Hash] The JSON attributes from the API response.

# File lib/gun_broker/feedback.rb, line 19
def initialize(attrs = {})
  @attrs = attrs
end
summary(user_id) click to toggle source

@param user_id [Integer, String] Get feedback summary about the `user_id`. @return [GunBroker::Response]

# File lib/gun_broker/feedback.rb, line 14
def self.summary(user_id)
  GunBroker::API.get("/Feedback/Summary/#{user_id}")
end

Public Instance Methods

item() click to toggle source

@return [GunBroker::Item] The Item this feedback is about.

See also: {GunBroker::Item.find}

# File lib/gun_broker/feedback.rb, line 26
def item
  GunBroker::Item.find(@attrs['itemID'])
end