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
14
15
16
|
# File 'lib/travis/client/account.rb', line 14
def self.cast_id(id)
String(id)
end
|
.id?(object) ⇒ Boolean
18
19
20
|
# File 'lib/travis/client/account.rb', line 18
def self.id?(object)
object.is_a? String
end
|
Instance Method Details
#education ⇒ Object
26
27
28
|
# File 'lib/travis/client/account.rb', line 26
def education
load_attribute('education') { false } if member?
end
|
#member? ⇒ Boolean
42
43
44
|
# File 'lib/travis/client/account.rb', line 42
def member?
session.accounts.include? self
end
|
#on_trial? ⇒ Boolean
30
31
32
|
# File 'lib/travis/client/account.rb', line 30
def on_trial?
!subscribed? and !education?
end
|
#repos_count ⇒ Object
34
35
36
|
# File 'lib/travis/client/account.rb', line 34
def repos_count
load_attribute("repos_count") { repositories.count }
end
|
#repositories ⇒ Object
38
39
40
|
# File 'lib/travis/client/account.rb', line 38
def repositories
attributes['repositories'] ||= session.repos(:owner_name => login)
end
|
#subscribed ⇒ Object
22
23
24
|
# File 'lib/travis/client/account.rb', line 22
def subscribed
load_attribute('subscribed') { true } if member?
end
|