# File lib/fog/cloudsigma/compute.rb, line 80 def initialize(options={}) @init_options = options setup_connection(options) end
# File lib/fog/cloudsigma/compute.rb, line 91 def balance response = get_balance Balance.new(response.body) end
# File lib/fog/cloudsigma/compute.rb, line 103 def currency # Cache since currency does not change @currency ||= profile.currency end
# File lib/fog/cloudsigma/compute.rb, line 145 def current_pricing resp = get_pricing(currency) current_levels = resp.body['current'] current_prices = resp.body['objects'] current_pricing_pairs = current_levels.map do |resource, level| price_for_resource_and_level = current_prices.detect do |price| price['level'] == level && price['resource'] == resource end price_for_resource_and_level ||= {} [resource, price_for_resource_and_level] end Pricing.new(Hash[current_pricing_pairs]) end
# File lib/fog/cloudsigma/compute.rb, line 115 def current_pricing_levels resp = get_pricing(currency) resp.body['current'] end
# File lib/fog/cloudsigma/compute.rb, line 97 def current_usage response = get_current_usage CurrentUsage.new(response.body['usage']) end
# File lib/fog/cloudsigma/compute.rb, line 163 def next_pricing resp = get_pricing(currency) current_levels = resp.body['next'] current_prices = resp.body['objects'] current_pricing_pairs = current_levels.map do |resource, level| price_for_resource_and_level = current_prices.detect do |price| price['level'] == level && price['resource'] == resource end price_for_resource_and_level ||= {} [resource, price_for_resource_and_level] end Pricing.new(Hash[current_pricing_pairs]) end
# File lib/fog/cloudsigma/compute.rb, line 121 def next_pricing_levels resp = get_pricing(currency) resp.body['next'] end
# File lib/fog/cloudsigma/compute.rb, line 109 def pricing resp = get_princing(currency) resp.body['objects'] end
# File lib/fog/cloudsigma/compute.rb, line 86 def profile response = get_profile Profile.new(response.body) end
# File lib/fog/cloudsigma/compute.rb, line 127 def subscription_pricing resp = get_pricing(currency, true) current_levels = resp.body['current'] current_prices = resp.body['objects'] current_pricing_pairs = current_levels.map do |resource, level| price_for_resource_and_level = current_prices.detect do |price| price['resource'] == resource end price_for_resource_and_level ||= {} [resource, price_for_resource_and_level] end Pricing.new(Hash[current_pricing_pairs]) end