Class: CoderWally::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/coder_wally/client.rb

Overview

Client to access the API

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ Client

Instantiate class



5
6
7
8
9
# File 'lib/coder_wally/client.rb', line 5

def initialize(username)
  @api = API.new
  @builder = Builder.new
  @coder_wall = build_coder_wall_from_response(username)
end

Instance Method Details

#get_badges_for(*username) ⇒ Object

Get badges for given user and return has collection of ‘Badge`s



12
13
14
15
# File 'lib/coder_wally/client.rb', line 12

def get_badges_for(*username)
  deprecation_message("get_badges_for(#{username})",'user.badges')
  @coder_wall.user.badges
end

#get_details_for(*username) ⇒ Object

Get user details for given user and return a ‘User` object



18
19
20
21
# File 'lib/coder_wally/client.rb', line 18

def get_details_for(*username)
  deprecation_message("get_details_for(#{username})",'user.details')
  @coder_wall.user.details
end

#get_everything_for(*username) ⇒ Object

Get all the information available for a given user, returns a ‘CoderWall` object



25
26
27
28
# File 'lib/coder_wally/client.rb', line 25

def get_everything_for(*username)
  deprecation_message("get_everything_for(#{username})",'user')
  @coder_wall
end

#userObject

Get all the information for a given user Returns a user object



32
33
34
# File 'lib/coder_wally/client.rb', line 32

def user
  @coder_wall.user
end