amazon-pricing 0.1.52 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/amazon-pricing/version.rb +1 -1
- data/lib/ec2-price-list.rb +8 -0
- data/test/ec2_instance_types_test.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTE5NzY3ZTgxMWJiMzJlN2E5ZjEyN2U0YjZmYTQxODE5OGU0ZjY4Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDkxOTg3NzlkMGVlNmEwNTRiNjUzZTVlYTlhYTUxMGE3NjYwMmZmYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWRlOWM5NDk2NzFjMzUxYzRjNWM3OTIwMTNkMzJmNWQ0OTQ2NzYxY2E3MWQ4
|
10
|
+
MDI2N2FjOWEwZmUzOTU4YjM4NGU4MzAyZjhkOTY3YzBhZjU1Zjc5NjM0NTMz
|
11
|
+
ZWUwZTU2MjIzZTFiNzFmMDgyYjg0MTg4MjQ4OTNmNGNlOGE2Mjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWQyYWI5MjcyYmVhOGIxYjE2NDIyMzFhNWFiMTYwZGUzMjllNDVhNDdjYWNk
|
14
|
+
NDQ4OGRhNzJkYTk2ZWQyOTgzMDQyZWJiN2FmNWNjNjQ3YjNiMTVhYTU4YjQz
|
15
|
+
NDQ5ODJkM2NlNjU5ZmY2ZGMyOGZjNzEyM2MwZWQyYzgzMjBhYTg=
|
data/lib/ec2-price-list.rb
CHANGED
@@ -47,6 +47,14 @@ module AwsPricing
|
|
47
47
|
url = "#{EC2_BASE_URL}ri-v2/#{target}-shared.min.js"
|
48
48
|
fetch_ec2_instance_pricing_ri_v2(url, operating_system)
|
49
49
|
end
|
50
|
+
|
51
|
+
# I give up on finding a pattern so just iterating over known URLs
|
52
|
+
page_targets = {"linux-unix" => :linux, "red-hat-enterprise-linux" => :rhel, "suse-linux" => :sles, "windows" => :mswin, "windows-with-sql-server-standard" => :mswinSQL, "windows-with-sql-server-web" => :mswinSQLWeb}
|
53
|
+
page_targets.each_pair do |target, operating_system|
|
54
|
+
url = "#{EC2_BASE_URL}previous-generation/ri-v2/#{target}-shared.min.js"
|
55
|
+
fetch_ec2_instance_pricing_ri_v2(url, operating_system)
|
56
|
+
end
|
57
|
+
|
50
58
|
end
|
51
59
|
|
52
60
|
# Retrieves the EC2 on-demand instance pricing.
|
@@ -119,6 +119,22 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
119
119
|
assert os.allupfront_effective_rate_3_year == 0.0388
|
120
120
|
end
|
121
121
|
|
122
|
+
def test_new_reservation_types_for_legacy_instance
|
123
|
+
region = @@ec2_pricing.get_region('us-east')
|
124
|
+
instance = region.get_ec2_instance_type('m2.4xlarge')
|
125
|
+
os = instance.get_operating_system(:linux)
|
126
|
+
assert os.ondemand_price_per_hour == 0.980
|
127
|
+
assert os.partialupfront_prepay_1_year == 1894
|
128
|
+
assert os.allupfront_prepay_1_year == 3255
|
129
|
+
assert os.partialupfront_prepay_3_year == 2875
|
130
|
+
assert os.allupfront_prepay_3_year == 5839
|
131
|
+
assert os.noupfront_effective_rate_1_year == 0.444
|
132
|
+
assert os.partialupfront_effective_rate_1_year == 0.3792
|
133
|
+
assert os.allupfront_effective_rate_1_year == 0.3716
|
134
|
+
assert os.partialupfront_effective_rate_3_year == 0.2364
|
135
|
+
assert os.allupfront_effective_rate_3_year == 0.2222
|
136
|
+
end
|
137
|
+
|
122
138
|
def test_bad_data
|
123
139
|
# Someone at AWS is fat fingering the pricing data and putting the text "os" where there should be the actual operating system (e.g. "linux") - see http://a0.awsstatic.com/pricing/1/ec2/linux-od.min.js
|
124
140
|
@@ec2_pricing.regions.each do |region|
|