Class: Terraspace::Cloud::Comment
- Inherits:
-
Base
- Object
- Terraspace::CLI::Base
- Base
- Terraspace::Cloud::Comment
- Defined in:
- lib/terraspace/cloud/comment.rb
Instance Method Summary collapse
Methods inherited from Base
#cancelled?, #changes?, #clean_cache2_stage, #cloud_upload, #initialize, #record?, #sh, #stage_attrs, #success_status
Methods included from Util::Pretty
Methods included from Util::Sure
Methods included from Util::Logging
Methods included from Context
Methods included from Api::Validate
Methods included from Api::Concern
#api, #cloud_stack_name, #expander, #region
Methods included from Api::Concern::Errors
Methods inherited from Terraspace::CLI::Base
Constructor Details
This class inherits a constructor from Terraspace::Cloud::Base
Instance Method Details
#cani?(exit_on_error: true) ⇒ Boolean
24 25 26 |
# File 'lib/terraspace/cloud/comment.rb', line 24 def cani?(exit_on_error: true) api.create_cost(cani: 1, exit_on_error: exit_on_error) end |
#get(record, cost) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/terraspace/cloud/comment.rb', line 3 def get(record, cost) return unless Terraspace.cloud? params = {} params[:record_id] = record['data']['id'] params[:cost_id] = cost['data']['id'] if cost sleep 1 # delay a second since job is queued resp = nil Timeout::timeout(20) do loop do resp = api.get_comment(params) break if resp['data']['attributes']['status'] == 'completed' sleep 2 end end resp rescue Timeout::Error # nil end |