Sha256: 4f7f0ecedcf4f724cc1de16783b2aa2c8000a16d67019580ead3b70e7f8c794c

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

require File.expand_path('../request', __FILE__)
require File.expand_path('../../helpers/compute/data_helper', __dir__)

module Fog
  module Compute
    class ProfitBricks
      class Requests < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
        model Fog::Compute::ProfitBricks::Request

        def all
          result = service.get_all_requests

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

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

          Excon::Errors

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

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

          Excon::Errors

          new(flatten(request))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-profitbricks-2.0.1 lib/fog/profitbricks/models/compute/requests.rb