Class: Badges::Treehouse
Instance Attribute Summary collapse
-
#profile_name ⇒ Object
readonly
Returns the value of attribute profile_name.
-
#profile_url ⇒ Object
readonly
Returns the value of attribute profile_url.
Instance Method Summary collapse
- #badges ⇒ Object
- #gravatar_url ⇒ Object
-
#initialize(profile_name) ⇒ Treehouse
constructor
A new instance of Treehouse.
- #name ⇒ Object
- #points ⇒ Object
- #points_total ⇒ Object
Constructor Details
#initialize(profile_name) ⇒ Treehouse
Returns a new instance of Treehouse.
81 82 83 84 85 86 |
# File 'lib/badges.rb', line 81 def initialize(profile_name) @profile_name = profile_name @profile_url = 'http://teamtreehouse.com/' + @profile_name @response = get(@profile_url + '.json') end |
Instance Attribute Details
#profile_name ⇒ Object (readonly)
Returns the value of attribute profile_name.
79 80 81 |
# File 'lib/badges.rb', line 79 def profile_name @profile_name end |
#profile_url ⇒ Object (readonly)
Returns the value of attribute profile_url.
79 80 81 |
# File 'lib/badges.rb', line 79 def profile_url @profile_url end |
Instance Method Details
#badges ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/badges.rb', line 88 def badges begin @response['badges'] rescue nil end end |
#gravatar_url ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/badges.rb', line 96 def gravatar_url begin @response['gravatar_url'] rescue nil end end |
#name ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/badges.rb', line 104 def name begin @response['name'] rescue nil end end |
#points ⇒ Object
112 113 114 115 116 117 118 |
# File 'lib/badges.rb', line 112 def points begin @response['points'] rescue nil end end |
#points_total ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/badges.rb', line 120 def points_total begin @response['points']['total'] rescue nil end end |