Class: Fog::Compute::CloudSigma::PriceRecord

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Fog::CloudSigma::CloudsigmaModel

model_attribute, model_attribute_array

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#base_priceObject

The base price of the resource. This is the price for the base API unit which is byte for memory, data, etc. and MHz for CPU. Also the price is per second for time based resource (basically everything except data transfer which is not limited in time)



31
32
33
# File 'lib/fog/cloudsigma/models/price_record.rb', line 31

def base_price
  price / multiplier
end

#priceObject



15
16
17
18
19
20
21
# File 'lib/fog/cloudsigma/models/price_record.rb', line 15

def price
  if attributes[:price]
    BigDecimal(attributes[:price])
  else
    nil
  end
end

#price=(new_price) ⇒ Object



23
24
25
# File 'lib/fog/cloudsigma/models/price_record.rb', line 23

def price=(new_price)
  attributes[:price] = new_price.kind_of?(String) ? new_price : new_price.to_s('F')
end