Class: Raca::User
- Inherits:
-
Object
- Object
- Raca::User
- Defined in:
- lib/raca/user.rb
Overview
Represents a single user within the current account.
You probably don’t want to instantiate this directly, see Raca::Account#users
Instance Attribute Summary collapse
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #details ⇒ Object
-
#initialize(account, username, opts = {}) ⇒ User
constructor
A new instance of User.
- #inspect ⇒ Object
Constructor Details
#initialize(account, username, opts = {}) ⇒ User
Returns a new instance of User.
10 11 12 13 14 15 |
# File 'lib/raca/user.rb', line 10 def initialize(account, username, opts = {}) @account, @username = account, username @identity_url = @account.public_endpoint("identity") @logger = opts[:logger] @logger ||= Rails.logger if defined?(Rails) end |
Instance Attribute Details
#username ⇒ Object (readonly)
Returns the value of attribute username.
8 9 10 |
# File 'lib/raca/user.rb', line 8 def username @username end |
Instance Method Details
#details ⇒ Object
17 18 19 20 |
# File 'lib/raca/user.rb', line 17 def details response = identity_client.get(user_path) JSON.load(response.body)["user"] end |
#inspect ⇒ Object
22 23 24 |
# File 'lib/raca/user.rb', line 22 def inspect "#<Raca::User:#{__id__} @username=#{@username}>" end |