Class: Raca::User

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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(, username, opts = {})
  @account, @username = , username
  @identity_url = @account.public_endpoint("identity")
  @logger = opts[:logger]
  @logger ||= Rails.logger if defined?(Rails)
end

Instance Attribute Details

#usernameObject (readonly)

Returns the value of attribute username.



8
9
10
# File 'lib/raca/user.rb', line 8

def username
  @username
end

Instance Method Details

#detailsObject



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

#inspectObject



22
23
24
# File 'lib/raca/user.rb', line 22

def inspect
  "#<Raca::User:#{__id__} @username=#{@username}>"
end