Sha256: d463a61eef60cad94ec9133d83b5b2f6866ac7e842a97220db571449d8daae14

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 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 
        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 id
        @struct.user_id
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pilha-0.2.1 lib/pilha/stack_overflow/user.rb
pilha-0.2.0 lib/pilha/stack_overflow/user.rb
pilha-0.1.9 lib/pilha/stack_overflow/user.rb
pilha-0.1.8 lib/pilha/stack_overflow/user.rb
pilha-0.1.7 lib/pilha/stack_overflow/user.rb