Class: AWSCosts::ElasticIPs
- Inherits:
-
Object
- Object
- AWSCosts::ElasticIPs
- Defined in:
- lib/awscosts/ec2_elastic_ips.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ ElasticIPs
constructor
A new instance of ElasticIPs.
- #price_additional_per_hour ⇒ Object
- #price_non_attached_per_hour ⇒ Object
- #price_one ⇒ Object
- #price_remap_first_100 ⇒ Object
- #price_remap_over_100 ⇒ Object
Constructor Details
#initialize(data) ⇒ ElasticIPs
Returns a new instance of ElasticIPs.
3 4 5 |
# File 'lib/awscosts/ec2_elastic_ips.rb', line 3 def initialize data @data= data end |
Class Method Details
.fetch(region) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/awscosts/ec2_elastic_ips.rb', line 27 def self.fetch region transformed = AWSCosts::Cache.get_jsonp('/pricing/1/ec2/pricing-elastic-ips.min.js') do |data| result = {} data['config']['regions'].each do |r| container = {} r['types'].each do |type| type['values'].each do |value| container[value['rate']] = value['prices']['USD'].to_f end end result[r['region']] = container end result end self.new(transformed[region]) end |
Instance Method Details
#price_additional_per_hour ⇒ Object
11 12 13 |
# File 'lib/awscosts/ec2_elastic_ips.rb', line 11 def price_additional_per_hour @data['perAdditionalEIPPerHour'] end |
#price_non_attached_per_hour ⇒ Object
15 16 17 |
# File 'lib/awscosts/ec2_elastic_ips.rb', line 15 def price_non_attached_per_hour @data['perNonAttachedPerHour'] end |
#price_one ⇒ Object
7 8 9 |
# File 'lib/awscosts/ec2_elastic_ips.rb', line 7 def price_one @data['oneEIP'] end |
#price_remap_first_100 ⇒ Object
19 20 21 |
# File 'lib/awscosts/ec2_elastic_ips.rb', line 19 def price_remap_first_100 @data['perRemapFirst100'] end |
#price_remap_over_100 ⇒ Object
23 24 25 |
# File 'lib/awscosts/ec2_elastic_ips.rb', line 23 def price_remap_over_100 @data['perRemapOver100'] end |