Class: Hipmost::Hipchat::UserRepository::User
- Inherits:
-
Object
- Object
- Hipmost::Hipchat::UserRepository::User
show all
- Defined in:
- lib/hipmost/hipchat/user_repository.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(attrs) ⇒ User
38
39
40
41
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 38
def initialize(attrs)
@id = attrs["id"]
@attrs = attrs
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
52
53
54
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 52
def method_missing(method)
attrs[method.to_s]
end
|
Instance Attribute Details
#attrs ⇒ Object
Returns the value of attribute attrs.
42
43
44
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 42
def attrs
@attrs
end
|
#id ⇒ Object
Returns the value of attribute id.
42
43
44
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 42
def id
@id
end
|
Instance Method Details
#email ⇒ Object
60
61
62
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 60
def email
attrs["email"] || "#{username}@orbitalimpact.com"
end
|
#guest? ⇒ Boolean
44
45
46
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 44
def guest?
attrs["account_type"] == "guest"
end
|
#inactive? ⇒ Boolean
48
49
50
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 48
def inactive?
attrs["is_deleted"]
end
|
#teams ⇒ Object
64
65
66
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 64
def teams
[]
end
|
#to_jsonl ⇒ Object
68
69
70
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 68
def to_jsonl
%[{ "type": "user", "user": { "username": "#{username}", "email": "#{email}", "teams": #{teams.inspect} } }]
end
|
#username ⇒ Object
56
57
58
|
# File 'lib/hipmost/hipchat/user_repository.rb', line 56
def username
attrs["mention_name"]
end
|