Module: Fog::Compute::CloudSigma::CommonMockAndReal
Instance Method Summary collapse
- #balance ⇒ Object
- #currency ⇒ Object
- #current_pricing ⇒ Object
- #current_pricing_levels ⇒ Object
- #current_usage ⇒ Object
- #initialize(options = {}) ⇒ Object
- #next_pricing ⇒ Object
- #next_pricing_levels ⇒ Object
- #pricing ⇒ Object
- #profile ⇒ Object
- #subscription_pricing ⇒ Object
Instance Method Details
#balance ⇒ Object
94 95 96 97 98 |
# File 'lib/fog/cloudsigma/compute.rb', line 94 def balance response = get_balance Balance.new(response.body) end |
#currency ⇒ Object
106 107 108 109 |
# File 'lib/fog/cloudsigma/compute.rb', line 106 def currency # Cache since currency does not change @currency ||= profile.currency end |
#current_pricing ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/fog/cloudsigma/compute.rb', line 147 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.find 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 |
#current_pricing_levels ⇒ Object
117 118 119 120 121 |
# File 'lib/fog/cloudsigma/compute.rb', line 117 def current_pricing_levels resp = get_pricing(currency) resp.body['current'] end |
#current_usage ⇒ Object
100 101 102 103 104 |
# File 'lib/fog/cloudsigma/compute.rb', line 100 def current_usage response = get_current_usage CurrentUsage.new(response.body['usage']) end |
#initialize(options = {}) ⇒ Object
83 84 85 86 87 |
# File 'lib/fog/cloudsigma/compute.rb', line 83 def initialize(={}) @init_options = setup_connection() end |
#next_pricing ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/fog/cloudsigma/compute.rb', line 165 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.find 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 |
#next_pricing_levels ⇒ Object
123 124 125 126 127 |
# File 'lib/fog/cloudsigma/compute.rb', line 123 def next_pricing_levels resp = get_pricing(currency) resp.body['next'] end |
#pricing ⇒ Object
111 112 113 114 115 |
# File 'lib/fog/cloudsigma/compute.rb', line 111 def pricing resp = get_princing(currency) resp.body['objects'] end |
#profile ⇒ Object
89 90 91 92 |
# File 'lib/fog/cloudsigma/compute.rb', line 89 def profile response = get_profile Profile.new(response.body) end |
#subscription_pricing ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/fog/cloudsigma/compute.rb', line 129 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.find 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 |