Class: AnsibleTowerClient::Project
- Inherits:
-
BaseModel
show all
- Defined in:
- lib/ansible_tower_client/base_models/project.rb
Instance Attribute Summary
Attributes inherited from BaseModel
#api, #raw_hash
Instance Method Summary
collapse
Methods inherited from BaseModel
base_class, create, create!, #destroy, #destroy!, endpoint, #hashify, #initialize, #override_raw_attributes, #save, #save!, #update_attributes, #update_attributes!
Methods inherited from HashModel
#==, #[], #initialize, #inspect, #to_h, #to_json
Instance Method Details
#can_update? ⇒ Boolean
7
8
9
10
11
12
|
# File 'lib/ansible_tower_client/base_models/project.rb', line 7
def can_update?
response = api.get(related['update'].to_s).body
updatable = JSON.parse(response)
updatable['can_update']
end
|
#last_update ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/ansible_tower_client/base_models/project.rb', line 21
def last_update
return @last_update if defined? @last_update
return @last_update = nil unless related.raw_hash.key?('last_update')
return @last_update = nil if (update_id = related.last_update).blank?
if !numberish?(update_id)
if raw_hash.key?('summary_fields') && summary_fields.raw_hash.key?('last_update')
update_id = summary_fields.last_update.id
else
/\/(?'update_id'\d+)\/?\z/ =~ update_id
end
end
@last_update = update_id && api.project_updates.find(update_id)
end
|
#playbooks ⇒ Object
3
4
5
|
# File 'lib/ansible_tower_client/base_models/project.rb', line 3
def playbooks
Collection.new(api).find_all_by_url(related['playbooks'])
end
|
#update ⇒ Object
14
15
16
17
18
19
|
# File 'lib/ansible_tower_client/base_models/project.rb', line 14
def update
response = api.post(related['update'].to_s).body
update = JSON.parse(response)
api.project_updates.find(update['project_update'])
end
|