amazon-pricing 0.1.35 → 0.1.36
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.
- data/Gemfile.lock +1 -1
- data/lib/amazon-pricing.rb +5 -3
- data/lib/amazon-pricing/ebs-price.rb +8 -4
- data/lib/amazon-pricing/version.rb +1 -1
- data/test/ec2_instance_types_test.rb +4 -7
- data/test/govcloud_test.rb +2 -4
- metadata +13 -6
- checksums.yaml +0 -15
data/Gemfile.lock
CHANGED
data/lib/amazon-pricing.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
require 'json'
|
2
3
|
require 'net/http'
|
3
4
|
require 'mechanize'
|
@@ -181,11 +182,12 @@ module AwsPricing
|
|
181
182
|
ebs_costs = page.search("//div[@class='text section']//li")
|
182
183
|
@_regions.values.each do |region|
|
183
184
|
region.ebs_price = EbsPrice.new(region)
|
184
|
-
region.ebs_price.standard_per_gb = get_ebs_price(ebs_costs[0])
|
185
|
-
region.ebs_price.standard_per_million_io = get_ebs_price(ebs_costs[1])
|
186
185
|
region.ebs_price.preferred_per_gb = get_ebs_price(ebs_costs[2])
|
187
186
|
region.ebs_price.preferred_per_iops = get_ebs_price(ebs_costs[3])
|
188
|
-
region.ebs_price.
|
187
|
+
region.ebs_price.standard_per_gb = get_ebs_price(ebs_costs[4])
|
188
|
+
region.ebs_price.standard_per_million_io = get_ebs_price(ebs_costs[5])
|
189
|
+
region.ebs_price.ssd_per_gb = nil
|
190
|
+
region.ebs_price.s3_snaps_per_gb = get_ebs_price(ebs_costs[6])
|
189
191
|
end
|
190
192
|
|
191
193
|
end
|
@@ -10,22 +10,26 @@
|
|
10
10
|
module AwsPricing
|
11
11
|
|
12
12
|
class EbsPrice
|
13
|
-
attr_accessor :standard_per_gb, :standard_per_million_io,
|
14
|
-
:preferred_per_gb, :preferred_per_iops,
|
13
|
+
attr_accessor :standard_per_gb, :standard_per_million_io, :s3_snaps_per_gb,
|
14
|
+
:preferred_per_gb, :preferred_per_iops,
|
15
|
+
:ssd_per_gb
|
15
16
|
|
16
17
|
def initialize(region)
|
17
18
|
#@region = region
|
18
19
|
end
|
19
20
|
|
21
|
+
# e.g http://a0.awsstatic.com/pricing/1/ebs/pricing-ebs.min.js
|
20
22
|
def update_from_json(json)
|
21
23
|
json["types"].each do |t|
|
22
24
|
case t["name"]
|
23
|
-
when "
|
25
|
+
when "Amazon EBS Magnetic volumes"
|
24
26
|
@standard_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
|
25
27
|
@standard_per_million_io = t["values"].select{|v| v["rate"] == "perMMIOreq" }.first["prices"].values.first.to_f
|
26
|
-
when "
|
28
|
+
when "Amazon EBS Provisioned IOPS (SSD) volumes"
|
27
29
|
@preferred_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
|
28
30
|
@preferred_per_iops = t["values"].select{|v| v["rate"] == "perPIOPSreq" }.first["prices"].values.first.to_f
|
31
|
+
when "Amazon EBS General Purpose (SSD) volumes"
|
32
|
+
@ssd_per_gb = t["values"].select{|v| v["rate"] == "perGBmoProvStorage" }.first["prices"].values.first.to_f
|
29
33
|
when "ebsSnapsToS3"
|
30
34
|
@s3_snaps_per_gb = t["values"].select{|v| v["rate"] == "perGBmoDataStored" }.first["prices"].values.first.to_f
|
31
35
|
end
|
@@ -12,14 +12,12 @@
|
|
12
12
|
|
13
13
|
$: << File.expand_path(File.dirname(__FILE__))
|
14
14
|
require 'helper'
|
15
|
-
require 'test
|
15
|
+
require 'test-unit'
|
16
16
|
|
17
17
|
class TestEc2InstanceTypes < Test::Unit::TestCase
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
@@ec2_pricing = AwsPricing::Ec2PriceList.new
|
22
|
-
end
|
18
|
+
def setup
|
19
|
+
#This is expensive, so only do once.
|
20
|
+
@@ec2_pricing ||= AwsPricing::Ec2PriceList.new
|
23
21
|
end
|
24
22
|
|
25
23
|
def test_name_lookup
|
@@ -110,7 +108,6 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
|
|
110
108
|
@@ec2_pricing.regions.each do |region|
|
111
109
|
region.ec2_instance_types.each do |instance|
|
112
110
|
instance.operating_systems.each do |os|
|
113
|
-
puts os.class.name
|
114
111
|
#assert os.ondemand_price_per_hour.nil? && (!os.light_price_per_hour_1_year.nil? || !os.medium_price_per_hour_1_year.nil? || !os.heavy_price_per_hour_1_year.nil?)
|
115
112
|
end
|
116
113
|
end
|
data/test/govcloud_test.rb
CHANGED
@@ -15,11 +15,9 @@ require 'helper'
|
|
15
15
|
require 'test/unit'
|
16
16
|
|
17
17
|
class TestGovCloud < Test::Unit::TestCase
|
18
|
-
|
19
|
-
|
20
|
-
#This is expensive, so only do once.
|
18
|
+
def setup
|
19
|
+
#This is expensive, so only do once.
|
21
20
|
@@ec2_pricing = AwsPricing::GovCloudEc2PriceList.new
|
22
|
-
end
|
23
21
|
end
|
24
22
|
|
25
23
|
def test_cc8xlarge_issue
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
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.36
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Joe Kinsella
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-23 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
14
|
description: A Ruby library for retrieving pricing for Amazon Web Services
|
14
15
|
email:
|
@@ -51,7 +52,6 @@ files:
|
|
51
52
|
homepage: http://github.com/CloudHealth/amazon-pricing
|
52
53
|
licenses:
|
53
54
|
- MIT
|
54
|
-
metadata: {}
|
55
55
|
post_install_message:
|
56
56
|
rdoc_options:
|
57
57
|
- --title
|
@@ -62,20 +62,28 @@ rdoc_options:
|
|
62
62
|
require_paths:
|
63
63
|
- lib
|
64
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
65
66
|
requirements:
|
66
67
|
- - ! '>='
|
67
68
|
- !ruby/object:Gem::Version
|
68
69
|
version: '0'
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
hash: 87748617366120623
|
69
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
70
75
|
requirements:
|
71
76
|
- - ! '>='
|
72
77
|
- !ruby/object:Gem::Version
|
73
78
|
version: '0'
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
hash: 87748617366120623
|
74
82
|
requirements: []
|
75
83
|
rubyforge_project: amazon-pricing
|
76
|
-
rubygems_version:
|
84
|
+
rubygems_version: 1.8.25
|
77
85
|
signing_key:
|
78
|
-
specification_version:
|
86
|
+
specification_version: 3
|
79
87
|
summary: Amazon Web Services Pricing Ruby gem
|
80
88
|
test_files:
|
81
89
|
- spec/instance_type_spec.rb
|
@@ -86,4 +94,3 @@ test_files:
|
|
86
94
|
- test/ec2_instance_types_test.rb
|
87
95
|
- test/govcloud_test.rb
|
88
96
|
- test/helper.rb
|
89
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NWEyYWY0MGUxMjVkOGQ2MzM4MjNiZTljY2M4MjRkMzlmMDU5MTRmNw==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MDM1YmNmNmQzNTA0ZDhhOWRmNzBlZWZlODM2MDNlYzdiNDMxMDMyNA==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
Mzc1MjBiM2FlOGQ2Y2QyZjViM2IwYmQzMTM4ZDM4ZmIxMzRkMmNmMzExZTdj
|
10
|
-
ZThmMWQ0NWE5OWE3NDljZTJjNDJkMGQ4Y2E0N2JhODIxOWI0YWQ0OTdmMGEx
|
11
|
-
ZmVmNDE0NjBlMjdjOWQ1ZTBhY2UwNDRmODVmY2EyNTQ4NmZiOGY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NWJlODk4YmJjMTk0NzBhMDQ0MzFkNTc3NjRlMTdlZjk2MTVmMDcwNTUyMzQ4
|
14
|
-
ODY5ZWMyYmZhZDQwODU4ZWMyZmQ3ZDViYTcwZTliMzBmOTFjMTYxYWIxNmFm
|
15
|
-
NTc5ZmNkZWRiMWM0YmM0OTQ1NGRhMWVkNWQ0Y2M5YTYyZWE5M2Q=
|