Class: YouTrack::Client::User
- Defined in:
- lib/you_track/client/models/user.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#admin? ⇒ Boolean
just try to make a request to the admin api and see what happens.
- #save ⇒ Object
Methods inherited from Model
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
17 18 19 |
# File 'lib/you_track/client/models/user.rb', line 17 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
17 18 19 |
# File 'lib/you_track/client/models/user.rb', line 17 def username @username end |
Instance Method Details
#admin? ⇒ Boolean
just try to make a request to the admin api and see what happens
10 11 12 13 14 15 |
# File 'lib/you_track/client/models/user.rb', line 10 def admin? # just try to make a request to the admin api and see what happens return @admin if defined?(@admin) # i love how ||= doesn't work when a variable is false @admin = !!service.get_admin_user(self.id).body rescue Faraday::ResourceNotFound @admin = false end |
#save ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/you_track/client/models/user.rb', line 19 def save if new_record? requires :username, :email service.create_user( "email" => self.email, "fullName" => self.name, "jabber" => self.jabber, "login" => self.username, "password" => self.password, ) merge_attributes( :identity => self.username, ) else raise NotImplementedError end end |