Class: Travis::Client::User

Inherits:
Entity
  • Object
show all
Defined in:
lib/travis/client/user.rb

Constant Summary

Constants inherited from Entity

Entity::MAP

Instance Attribute Summary collapse

Attributes inherited from Entity

#attributes, #curry, #id, #session

Instance Method Summary collapse

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_scopesObject (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

#emailObject (readonly)

Returns the value of attribute email.



1
2
3
# File 'lib/travis/client/user.rb', line 1

def email
  @email
end

#gravatar_idObject (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_syncingObject (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

#localeObject (readonly)

Returns the value of attribute locale.



1
2
3
# File 'lib/travis/client/user.rb', line 1

def locale
  @locale
end

#loginObject (readonly)

Returns the value of attribute login.



1
2
3
# File 'lib/travis/client/user.rb', line 1

def 
  @login
end

#nameObject (readonly)

Returns the value of attribute name.



1
2
3
# File 'lib/travis/client/user.rb', line 1

def name
  @name
end

#synced_atObject

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_accessObject



49
50
51
# File 'lib/travis/client/user.rb', line 49

def admin_access
  permissions['admin']
end

#admin_access?(repo) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/travis/client/user.rb', line 61

def admin_access?(repo)
  admin_access.include? repo
end

#channelsObject



24
25
26
27
# File 'lib/travis/client/user.rb', line 24

def channels
  load_attribute(:is_syncing) # dummy to trigger load, as channels might not be included
  attributes['channels'] ||= ['common']
end

#permissionsObject



29
30
31
32
33
34
35
# File 'lib/travis/client/user.rb', line 29

def permissions
  attributes['permissions'] ||= begin
    repos = session.get('/users/permissions')
    repos.each_value { |r| r.compact! }
    repos
  end
end

#pull_accessObject



45
46
47
# File 'lib/travis/client/user.rb', line 45

def pull_access
  permissions['pull']
end

#pull_access?(repo) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/travis/client/user.rb', line 57

def pull_access?(repo)
  pull_access.include? repo
end

#push_accessObject



41
42
43
# File 'lib/travis/client/user.rb', line 41

def push_access
  permissions['push']
end

#push_access?(repo) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/travis/client/user.rb', line 53

def push_access?(repo)
  push_access.include? repo
end

#repositoriesObject



37
38
39
# File 'lib/travis/client/user.rb', line 37

def repositories
  permissions['permissions']
end

#syncObject



19
20
21
22
# File 'lib/travis/client/user.rb', line 19

def sync
  session.post_raw('/users/sync')
  reload
end