Class: CodewarsCli::User
- Inherits:
-
Object
- Object
- CodewarsCli::User
- Includes:
- GenericHelpers
- Defined in:
- lib/codewars_cli/user.rb
Instance Attribute Summary collapse
-
#username_or_id ⇒ Object
readonly
Returns the value of attribute username_or_id.
Class Method Summary collapse
Instance Method Summary collapse
- #get_user ⇒ Object
-
#initialize(username_or_id) ⇒ User
constructor
A new instance of User.
- #print_description ⇒ Object
Methods included from GenericHelpers
#check_for_api_key, #client, #error, #extend_object, included, #info, #presenter
Constructor Details
#initialize(username_or_id) ⇒ User
Returns a new instance of User.
10 11 12 |
# File 'lib/codewars_cli/user.rb', line 10 def initialize(username_or_id) @username_or_id = username_or_id end |
Instance Attribute Details
#username_or_id ⇒ Object (readonly)
Returns the value of attribute username_or_id.
9 10 11 |
# File 'lib/codewars_cli/user.rb', line 9 def username_or_id @username_or_id end |
Class Method Details
.fetch(username_or_id) ⇒ Object
4 5 6 7 |
# File 'lib/codewars_cli/user.rb', line 4 def self.fetch(username_or_id) check_for_api_key new(username_or_id) end |
Instance Method Details
#get_user ⇒ Object
14 15 16 |
# File 'lib/codewars_cli/user.rb', line 14 def get_user client.user(username_or_id: username_or_id) end |
#print_description ⇒ Object
18 19 20 |
# File 'lib/codewars_cli/user.rb', line 18 def print_description presenter.display_user_info(get_user) end |