Sha256: b64c628d7d0a6aaa361bf91df4e5e93c1533d797eb65942d6383d2df2c3f5ad2

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

module StackExchange
  module StackOverflow
    class User < Base
      extend Forwardable

      def_delegators :@struct, :user_id, :user_type, :creation_date, :display_name,
                               :reputation, :email_hash, :age, :last_access_date,
                               :website_url, :location, :about_me, :question_count,
                               :answer_count, :view_count, :up_vote_count, :down_vote_count,
                               :user_questions_url, :user_answers_url, :user_favorites_url,
                               :user_tags_url, :user_badges_url, :user_timeline_url,
                               :user_mentioned_url, :user_comments_url, :user_reputation_url,
                               :badge_counts

      class << self 

        attr_reader :client

        def all(options = {})
          request('/users', nil, options)
        end

        def find_by_badge_id(id, options = {})
          request('/badges/:id', id, options)
        end

        def find(id, options = {})
          request('/users/:id', id, options).users.first
        end

        def parse(response)
          parse_with_class(response, 'users', User)
          OpenStruct.new response
        end
      end

      def initialize(hash)
        @struct = OpenStruct.new hash
      end

      def id
        @struct.user_id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pilha-0.1.6 lib/pilha/stack_overflow/user.rb