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