Class: Badges::CodeSchool
Instance Attribute Summary
Attributes inherited from Badge
#profile_url, #response, #user_id
Instance Method Summary
collapse
Constructor Details
#initialize(user_id) ⇒ CodeSchool
Returns a new instance of CodeSchool.
34
35
36
37
38
|
# File 'lib/badges.rb', line 34
def initialize(user_id)
super(user_id, 'http://www.codeschool.com/users/')
@response = nil if obtain_key(@response, 'error')
end
|
Instance Method Details
#avatar_url ⇒ Object
40
41
42
43
|
# File 'lib/badges.rb', line 40
def avatar_url
user = obtain_key @response, 'user' if @response
obtain_key user, 'avatar' if !user.blank?
end
|
#badges ⇒ Object
45
46
47
|
# File 'lib/badges.rb', line 45
def badges
obtain_key @response, 'badges' if @response
end
|
#courses_completed ⇒ Object
49
50
51
52
|
# File 'lib/badges.rb', line 49
def courses_completed
courses = obtain_key @response, 'courses' if @response
obtain_key courses, 'completed' if !courses.blank?
end
|
#courses_in_progress ⇒ Object
54
55
56
57
|
# File 'lib/badges.rb', line 54
def courses_in_progress
courses = obtain_key @response, 'courses' if @response
obtain_key courses, 'in_progress' if !courses.blank?
end
|
#member_since ⇒ Object
59
60
61
62
|
# File 'lib/badges.rb', line 59
def member_since
user = obtain_key @response, 'user' if @response
obtain_key user, 'member_since' if !user.blank?
end
|
#total_score ⇒ Object
64
65
66
67
|
# File 'lib/badges.rb', line 64
def total_score
user = obtain_key @response, 'user' if @response
obtain_key user, 'total_score' if !user.blank?
end
|