Sha256: d878c06fe7603998c7dc3da7627fae183beef5f72243941a0966b0b48b2a4922

Contents?: true

Size: 896 Bytes

Versions: 37

Compression:

Stored size: 896 Bytes

Contents

module GunBroker
  # Handles feedback about and by a {User}.
  class Feedback

    # @param user_id [Integer, String] Return feedback by this User's ID.
    # @return [Array<Feedback>] An array of the User's feedback.
    def self.all(user_id)
      response = GunBroker::API.get("/Feedback/#{user_id}")
      response['results'].map { |attrs| new(attrs) }
    end

    # @param user_id [Integer, String] Get feedback summary about the `user_id`.
    # @return [GunBroker::Response]
    def self.summary(user_id)
      GunBroker::API.get("/Feedback/Summary/#{user_id}")
    end

    # @param attrs [Hash] The JSON attributes from the API response.
    def initialize(attrs = {})
      @attrs = attrs
    end

    # @return [GunBroker::Item] The Item this feedback is about.
    #
    # See also: {GunBroker::Item.find}
    def item
      GunBroker::Item.find(@attrs['itemID'])
    end

  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
gun_broker-1.4.8 lib/gun_broker/feedback.rb
gun_broker-1.4.7 lib/gun_broker/feedback.rb
gun_broker-1.4.6 lib/gun_broker/feedback.rb
gun_broker-1.4.5 lib/gun_broker/feedback.rb
gun_broker-1.4.4 lib/gun_broker/feedback.rb
gun_broker-1.4.3 lib/gun_broker/feedback.rb
gun_broker-1.4.2 lib/gun_broker/feedback.rb
gun_broker-1.4.1 lib/gun_broker/feedback.rb
gun_broker-1.4.0 lib/gun_broker/feedback.rb
gun_broker-1.3.2 lib/gun_broker/feedback.rb
gun_broker-1.3.1 lib/gun_broker/feedback.rb
gun_broker-1.3.0 lib/gun_broker/feedback.rb
gun_broker-1.2.1.1 lib/gun_broker/feedback.rb
gun_broker-1.2.1 lib/gun_broker/feedback.rb
gun_broker-1.2.0 lib/gun_broker/feedback.rb
gun_broker-1.1.3.1 lib/gun_broker/feedback.rb
gun_broker-1.1.2 lib/gun_broker/feedback.rb
gun_broker-1.1.1 lib/gun_broker/feedback.rb
gun_broker-1.1.0 lib/gun_broker/feedback.rb
gun_broker-1.0.0 lib/gun_broker/feedback.rb