Class: Travis::Client::Account
- Inherits:
-
Entity
- Object
- Entity
- Travis::Client::Account
show all
- Defined in:
- lib/travis/client/account.rb
Constant Summary
Constants inherited
from Entity
Entity::MAP
Instance Attribute Summary
Attributes inherited from Entity
#attributes, #curry, #id, #session
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Entity
#[], #[]=, aka, #attribute_names, attributes, base_path, #cancelable?, #complete?, has, has_singleton, 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?
Class Method Details
.cast_id(id) ⇒ Object
16
17
18
|
# File 'lib/travis/client/account.rb', line 16
def self.cast_id(id)
String(id)
end
|
.id?(object) ⇒ Boolean
20
21
22
|
# File 'lib/travis/client/account.rb', line 20
def self.id?(object)
object.is_a? String
end
|
Instance Method Details
#education ⇒ Object
28
29
30
|
# File 'lib/travis/client/account.rb', line 28
def education
load_attribute('education') { false } if member?
end
|
#member? ⇒ Boolean
44
45
46
|
# File 'lib/travis/client/account.rb', line 44
def member?
session.accounts.include? self
end
|
#on_trial? ⇒ Boolean
32
33
34
|
# File 'lib/travis/client/account.rb', line 32
def on_trial?
!subscribed? and !education?
end
|
#repos_count ⇒ Object
36
37
38
|
# File 'lib/travis/client/account.rb', line 36
def repos_count
load_attribute('repos_count') { repositories.count }
end
|
#repositories ⇒ Object
40
41
42
|
# File 'lib/travis/client/account.rb', line 40
def repositories
attributes['repositories'] ||= session.repos(owner_name: login)
end
|
#subscribed ⇒ Object
24
25
26
|
# File 'lib/travis/client/account.rb', line 24
def subscribed
load_attribute('subscribed') { true } if member?
end
|