Class: Fog::Compute::ProfitBricks::Requests

Inherits:
Fog::Collection
  • Object
show all
Includes:
Helpers::ProfitBricks::DataHelper
Defined in:
lib/fog/profitbricks/models/compute/requests.rb

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Instance Method Details

#allObject



11
12
13
14
15
# File 'lib/fog/profitbricks/models/compute/requests.rb', line 11

def all
  result = service.get_all_requests

  load(result.body['items'].each { |request| flatten(request) })
end

#get(request_id) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/fog/profitbricks/models/compute/requests.rb', line 17

def get(request_id)
  request = service.get_request(request_id).body

  Excon::Errors

  new(flatten(request))
rescue Excon::Errors::NotFound
  nil
end

#get_status(request_id) ⇒ Object



27
28
29
30
31
# File 'lib/fog/profitbricks/models/compute/requests.rb', line 27

def get_status(request_id)
  request = service.get_request_status(request_id).body

  new(flatten(request))
end