Class: Travis::Client::User
Constant Summary
Constants inherited from Entity
Instance Attribute Summary collapse
-
#correct_scopes ⇒ Object
(also: #correct_scopes?)
readonly
Returns the value of attribute correct_scopes.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#gravatar_id ⇒ Object
readonly
Returns the value of attribute gravatar_id.
-
#is_syncing ⇒ Object
(also: #syncing?)
readonly
Returns the value of attribute is_syncing.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#synced_at ⇒ Object
Returns the value of attribute synced_at.
Attributes inherited from Entity
#attributes, #curry, #id, #session
Instance Method Summary collapse
- #admin_access ⇒ Object
- #admin_access?(repo) ⇒ Boolean
- #channels ⇒ Object
- #permissions ⇒ Object
- #pull_access ⇒ Object
- #pull_access?(repo) ⇒ Boolean
- #push_access ⇒ Object
- #push_access?(repo) ⇒ Boolean
- #repositories ⇒ Object
- #sync ⇒ Object
Methods inherited from Entity
#[], #[]=, aka, #attribute_names, attributes, base_path, #cancelable?, cast_id, #complete?, has, has_singleton, id?, id_field, #include?, #initialize, #inspect, inspect_info, #load, many, #missing?, one, preloadable, preloadable?, relations, #relations, #reload, #restartable?, subclass_for, subclasses, time, #to_h, #update_attributes, weak?
Constructor Details
This class inherits a constructor from Travis::Client::Entity
Instance Attribute Details
#correct_scopes ⇒ Object (readonly) Also known as: correct_scopes?
Returns the value of attribute correct_scopes.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def correct_scopes @correct_scopes end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def email @email end |
#gravatar_id ⇒ Object (readonly)
Returns the value of attribute gravatar_id.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def gravatar_id @gravatar_id end |
#is_syncing ⇒ Object (readonly) Also known as: syncing?
Returns the value of attribute is_syncing.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def is_syncing @is_syncing end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def locale @locale end |
#login ⇒ Object (readonly)
Returns the value of attribute login.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def login @login end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def name @name end |
#synced_at ⇒ Object
Returns the value of attribute synced_at.
1 2 3 |
# File 'lib/travis/client/user.rb', line 1 def synced_at @synced_at end |
Instance Method Details
#admin_access ⇒ Object
47 48 49 |
# File 'lib/travis/client/user.rb', line 47 def admin_access ['admin'] end |
#admin_access?(repo) ⇒ Boolean
59 60 61 |
# File 'lib/travis/client/user.rb', line 59 def admin_access?(repo) admin_access.include? repo end |
#channels ⇒ Object
22 23 24 25 |
# File 'lib/travis/client/user.rb', line 22 def channels load_attribute(:is_syncing) # dummy to trigger load, as channels might not be included attributes['channels'] ||= ['common'] end |
#permissions ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/travis/client/user.rb', line 27 def attributes['permissions'] ||= begin repos = session.get('/users/permissions') repos.each_value { |r| r.compact! } repos end end |
#pull_access ⇒ Object
43 44 45 |
# File 'lib/travis/client/user.rb', line 43 def pull_access ['pull'] end |
#pull_access?(repo) ⇒ Boolean
55 56 57 |
# File 'lib/travis/client/user.rb', line 55 def pull_access?(repo) pull_access.include? repo end |
#push_access ⇒ Object
39 40 41 |
# File 'lib/travis/client/user.rb', line 39 def push_access ['push'] end |
#push_access?(repo) ⇒ Boolean
51 52 53 |
# File 'lib/travis/client/user.rb', line 51 def push_access?(repo) push_access.include? repo end |
#repositories ⇒ Object
35 36 37 |
# File 'lib/travis/client/user.rb', line 35 def repositories ['permissions'] end |
#sync ⇒ Object
17 18 19 20 |
# File 'lib/travis/client/user.rb', line 17 def sync session.post_raw('/users/sync') reload end |