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


47
48
49
# File 'lib/travis/client/user.rb', line 47

def admin_access
  permissions['admin']
end

#admin_access?(repo) ⇒ Boolean

Returns:

  • (Boolean)

59
60
61
# File 'lib/travis/client/user.rb', line 59

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

#channelsObject


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

#permissionsObject


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

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

#pull_accessObject


43
44
45
# File 'lib/travis/client/user.rb', line 43

def pull_access
  permissions['pull']
end

#pull_access?(repo) ⇒ Boolean

Returns:

  • (Boolean)

55
56
57
# File 'lib/travis/client/user.rb', line 55

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

#push_accessObject


39
40
41
# File 'lib/travis/client/user.rb', line 39

def push_access
  permissions['push']
end

#push_access?(repo) ⇒ Boolean

Returns:

  • (Boolean)

51
52
53
# File 'lib/travis/client/user.rb', line 51

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

#repositoriesObject


35
36
37
# File 'lib/travis/client/user.rb', line 35

def repositories
  permissions['permissions']
end

#syncObject


17
18
19
20
# File 'lib/travis/client/user.rb', line 17

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