Class: Acquia::Cloud::Task
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
- #completed ⇒ Object
- #created ⇒ Object
- #description ⇒ Object
- #id ⇒ Object
-
#initialize(cloud, site, task) ⇒ Task
constructor
A new instance of Task.
- #logs ⇒ Object
- #queue ⇒ Object
- #started ⇒ Object
- #state ⇒ Object
- #wait_for_completion(message = nil) ⇒ Object
Methods inherited from Entity
Constructor Details
#initialize(cloud, site, task) ⇒ Task
Returns a new instance of Task.
6 7 8 9 10 11 |
# File 'lib/acquia/cloud/task.rb', line 6 def initialize(cloud, site, task) @cloud = cloud @site = site @data = task @url = "/sites/#{@site}/tasks/#{@data['id']}" end |
Instance Method Details
#completed ⇒ Object
37 38 39 |
# File 'lib/acquia/cloud/task.rb', line 37 def completed Time.at(data['completed'].to_i) end |
#created ⇒ Object
29 30 31 |
# File 'lib/acquia/cloud/task.rb', line 29 def created Time.at(data['created'].to_i) end |
#description ⇒ Object
25 26 27 |
# File 'lib/acquia/cloud/task.rb', line 25 def description data['description'] end |
#id ⇒ Object
13 14 15 |
# File 'lib/acquia/cloud/task.rb', line 13 def id data['id'] end |
#logs ⇒ Object
41 42 43 |
# File 'lib/acquia/cloud/task.rb', line 41 def logs data['logs'] end |
#queue ⇒ Object
17 18 19 |
# File 'lib/acquia/cloud/task.rb', line 17 def queue data['queue'] end |
#started ⇒ Object
33 34 35 |
# File 'lib/acquia/cloud/task.rb', line 33 def started Time.at(data['started'].to_i) end |
#state ⇒ Object
21 22 23 |
# File 'lib/acquia/cloud/task.rb', line 21 def state data['state'].to_sym end |
#wait_for_completion(message = nil) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/acquia/cloud/task.rb', line 45 def wait_for_completion( = nil) print if loop do # This will take several minutes, don't spam Acquia too hard while waiting. sleep 15 print '.' if refresh unless [:started].include? state puts if break end end self end |