Class: Fog::Compute::CloudSigma::Subscription

Inherits:
Fog::CloudSigma::CloudsigmaModel show all
Defined in:
lib/fog/cloudsigma/models/subscription.rb

Instance Method Summary collapse

Methods inherited from Fog::CloudSigma::CloudsigmaModel

model_attribute, model_attribute_array

Instance Method Details

#createObject



28
29
30
31
32
33
34
35
# File 'lib/fog/cloudsigma/models/subscription.rb', line 28

def create
  requires :resource, :amount
  data = attributes

  response = service.create_subscription(data)
  new_attributes = response.body['objects'].first
  merge_attributes(new_attributes)
end

#extend(period = nil, end_time = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fog/cloudsigma/models/subscription.rb', line 37

def extend(period=nil, end_time=nil)
  requires :identity
  data = {}
  if period
    data[:period] = period
  elsif end_time
    data[:end_time] = end_time
  end
  response = service.extend_subscription(identity, data)

  self.class.new(response.body)
end

#saveObject



24
25
26
# File 'lib/fog/cloudsigma/models/subscription.rb', line 24

def save
  create
end