amazon-pricing 0.1.32 → 0.1.33
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/lib/amazon-pricing/ec2-instance-type.rb +10 -1
- data/lib/amazon-pricing/version.rb +1 -1
- data/test/govcloud_test.rb +14 -4
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
amazon-pricing (0.1.
|
4
|
+
amazon-pricing (0.1.33)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -27,7 +27,7 @@ GEM
|
|
27
27
|
nokogiri (1.6.1)
|
28
28
|
mini_portile (~> 0.5.0)
|
29
29
|
ntlm-http (0.1.1)
|
30
|
-
rake (10.
|
30
|
+
rake (10.1.0)
|
31
31
|
rspec (2.11.0)
|
32
32
|
rspec-core (~> 2.11.0)
|
33
33
|
rspec-expectations (~> 2.11.0)
|
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'amazon-pricing/instance-type'
|
2
2
|
module AwsPricing
|
3
3
|
class Ec2InstanceType < InstanceType
|
4
|
+
|
5
|
+
# Returns OperatingSystem pricing
|
6
|
+
# e.g. :linux
|
7
|
+
def get_operating_system(type)
|
8
|
+
get_category_type(type)
|
9
|
+
end
|
4
10
|
|
5
11
|
# Returns whether an instance_type is available.
|
6
12
|
# operating_system = :linux, :mswin, :rhel, :sles, :mswinSQL, :mswinSQLWeb
|
@@ -23,7 +29,10 @@ module AwsPricing
|
|
23
29
|
if type_of_instance == :ondemand
|
24
30
|
# e.g. {"size"=>"sm", "valueColumns"=>[{"name"=>"linux", "prices"=>{"USD"=>"0.060"}}]}
|
25
31
|
values = Ec2InstanceType::get_values(json, operating_system)
|
26
|
-
|
32
|
+
category = operating_system.to_s
|
33
|
+
# 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
|
34
|
+
category = "os" if values.has_key?("os")
|
35
|
+
price = coerce_price(values[category])
|
27
36
|
os.set_price_per_hour(type_of_instance, nil, price)
|
28
37
|
else
|
29
38
|
json['valueColumns'].each do |val|
|
data/test/govcloud_test.rb
CHANGED
@@ -23,20 +23,20 @@ class TestGovCloud < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_cc8xlarge_issue
|
26
|
-
obj = @@ec2_pricing.get_instance_type('us-gov-west-1', '
|
27
|
-
assert obj.api_name == '
|
26
|
+
obj = @@ec2_pricing.get_instance_type('us-gov-west-1', 'm3.large')
|
27
|
+
assert obj.api_name == 'm3.large'
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_memory
|
31
31
|
# Validate instance types in specific regions are available
|
32
32
|
region = @@ec2_pricing.get_region('us-gov-west-1')
|
33
|
-
instance = region.get_ec2_instance_type('
|
33
|
+
instance = region.get_ec2_instance_type('m3.large')
|
34
34
|
assert instance.memory_in_mb == 7500
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_virtual_cores
|
38
38
|
region = @@ec2_pricing.get_region('us-gov-west-1')
|
39
|
-
instance = region.get_ec2_instance_type('
|
39
|
+
instance = region.get_ec2_instance_type('m3.large')
|
40
40
|
assert instance.virtual_cores == 2
|
41
41
|
end
|
42
42
|
|
@@ -49,4 +49,14 @@ class TestGovCloud < Test::Unit::TestCase
|
|
49
49
|
assert region.ebs_price.s3_snaps_per_gb == 0.125
|
50
50
|
end
|
51
51
|
|
52
|
+
# Defect found in which ordering of price per hour and upfront get reversed
|
53
|
+
def test_ri_pricing
|
54
|
+
region = @@ec2_pricing.get_region('us-gov-west-1')
|
55
|
+
instance = region.get_ec2_instance_type('m3.large')
|
56
|
+
os = instance.get_operating_system(:linux)
|
57
|
+
assert os.ondemand_price_per_hour == 0.168
|
58
|
+
assert os.light_prepay_1_year == 300.0
|
59
|
+
assert os.light_price_per_hour_1_year == 0.167
|
60
|
+
end
|
61
|
+
|
52
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-pricing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.33
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby library for retrieving pricing for Amazon Web Services
|
15
15
|
email:
|
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
65
|
version: '0'
|
66
66
|
segments:
|
67
67
|
- 0
|
68
|
-
hash: -
|
68
|
+
hash: -1176722608496314632
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
none: false
|
71
71
|
requirements:
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
segments:
|
76
76
|
- 0
|
77
|
-
hash: -
|
77
|
+
hash: -1176722608496314632
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project: amazon-pricing
|
80
80
|
rubygems_version: 1.8.25
|