Class: CoderwallRuby::User
- Inherits:
-
Object
- Object
- CoderwallRuby::User
- Includes:
- HTTParty
- Defined in:
- lib/coderwall_ruby/user.rb
Instance Attribute Summary collapse
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(username) ⇒ User
constructor
A new instance of User.
- #method_missing(name, *args, &block) ⇒ Object
- #profile ⇒ Object
Constructor Details
#initialize(username) ⇒ User
Returns a new instance of User.
8 9 10 |
# File 'lib/coderwall_ruby/user.rb', line 8 def initialize(username) self.username = username end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/coderwall_ruby/user.rb', line 16 def method_missing(name, *args, &block) if profile.has_key?(name.to_s) profile[name.to_s] else super end end |
Instance Attribute Details
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/coderwall_ruby/user.rb', line 6 def username @username end |
Instance Method Details
#profile ⇒ Object
12 13 14 |
# File 'lib/coderwall_ruby/user.rb', line 12 def profile self.class.get "/#{ username }.json" end |