Class: CoderWally::Client
- Inherits:
-
Object
- Object
- CoderWally::Client
- Defined in:
- lib/coder_wally/client.rb
Overview
Client to access the API
Instance Method Summary collapse
-
#build_coder_wall_from_response(username) ⇒ Object
Builds a CoderWall object.
-
#get_badges_for(username) ⇒ Object
Get badges for given user and return has collection of ‘Badge`s.
-
#get_details_for(username) ⇒ Object
Get user details for given user and return a
Userobject. -
#get_everything_for(username) ⇒ Object
Get all the information available for a given user, returns a
CoderWallobject. -
#initialize ⇒ Client
constructor
Instantiate class.
Constructor Details
#initialize ⇒ Client
Instantiate class
5 6 7 8 |
# File 'lib/coder_wally/client.rb', line 5 def initialize @api = API.new @builder = Builder.new end |
Instance Method Details
#build_coder_wall_from_response(username) ⇒ Object
Builds a CoderWall object
29 30 31 32 33 |
# File 'lib/coder_wally/client.rb', line 29 def build_coder_wall_from_response(username) json_response = @api.fetch(username) @builder.build(json_response) end |
#get_badges_for(username) ⇒ Object
Get badges for given user and return has collection of ‘Badge`s
11 12 13 14 |
# File 'lib/coder_wally/client.rb', line 11 def get_badges_for(username) coder_wall = build_coder_wall_from_response(username) coder_wall.badges end |
#get_details_for(username) ⇒ Object
Get user details for given user and return a User object
17 18 19 20 |
# File 'lib/coder_wally/client.rb', line 17 def get_details_for(username) coder_wall = build_coder_wall_from_response(username) coder_wall.user end |
#get_everything_for(username) ⇒ Object
Get all the information available for a given user, returns a CoderWall object
24 25 26 |
# File 'lib/coder_wally/client.rb', line 24 def get_everything_for(username) build_coder_wall_from_response(username) end |