amazon-pricing 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,7 +3,10 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  group :test do
6
+ gem 'rake'
7
+ gem 'test-unit'
6
8
  gem 'rspec', '~> 2.11.0'
9
+ gem 'coveralls', require: false
7
10
  end
8
11
 
9
- # gem "rails"
12
+ # gem "rails"
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ amazon-pricing (0.1.16)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coveralls (0.7.0)
10
+ multi_json (~> 1.3)
11
+ rest-client
12
+ simplecov (>= 0.7)
13
+ term-ansicolor
14
+ thor
15
+ diff-lcs (1.1.3)
16
+ docile (1.1.0)
17
+ mime-types (2.0)
18
+ multi_json (1.8.2)
19
+ rake (10.1.0)
20
+ rest-client (1.6.7)
21
+ mime-types (>= 1.16)
22
+ rspec (2.11.0)
23
+ rspec-core (~> 2.11.0)
24
+ rspec-expectations (~> 2.11.0)
25
+ rspec-mocks (~> 2.11.0)
26
+ rspec-core (2.11.1)
27
+ rspec-expectations (2.11.3)
28
+ diff-lcs (~> 1.1.3)
29
+ rspec-mocks (2.11.3)
30
+ simplecov (0.8.2)
31
+ docile (~> 1.1.0)
32
+ multi_json
33
+ simplecov-html (~> 0.8.0)
34
+ simplecov-html (0.8.0)
35
+ term-ansicolor (1.2.2)
36
+ tins (~> 0.8)
37
+ test-unit (2.5.5)
38
+ thor (0.18.1)
39
+ tins (0.13.1)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ amazon-pricing!
46
+ coveralls
47
+ rake
48
+ rspec (~> 2.11.0)
49
+ test-unit
@@ -1,43 +1,50 @@
1
- = Amazon Web Services Pricing Ruby Gem
1
+ Amazon Web Services Pricing Ruby Gem
2
+ ====================================
2
3
 
3
- == About amazon-pricing
4
+ [![](https://api.tddium.com:443/cloudhealthtech/amazon-pricing/badges/48071.png?badge_token=26071a8988b20f68cb9723defd7012fc33a180bc)](https://api.tddium.com:443/cloudhealthtech/amazon-pricing/suites/48071)
5
+ [![Gem Version](https://badge.fury.io/rb/amazon-pricing.png)](http://badge.fury.io/rb/amazon-pricing)
6
+ [![Code Climate](https://codeclimate.com/github/CloudHealth/amazon-pricing.png)](https://codeclimate.com/github/CloudHealth/amazon-pricing)
7
+ [![Coverage Status](https://coveralls.io/repos/CloudHealth/amazon-pricing/badge.png?branch=master)](https://coveralls.io/r/CloudHealth/amazon-pricing?branch=master)
4
8
 
5
- Amazon Web Services offers cloud-based on demand compute, storage and application services. Due to the number of services, and the number of pricing variables in each service, the pricing model is very complex. In addition, this pricing changes periodically. The amazon-pricing Ruby Gem is an interface library that simplifies the real-time retrieval of pricing information from Amazon.
9
+ About amazon-pricing
10
+ --------------------
6
11
 
12
+ Amazon Web Services offers cloud-based on demand compute, storage and application services. Due to the number of services, and the number of pricing variables in each service, the pricing model is very complex. In addition, this pricing changes periodically. The amazon-pricing Ruby Gem is an interface library that simplifies the real-time retrieval of pricing information from Amazon.
7
13
 
8
14
  For the most complete and up-to date README information please visit the project homepage at:
9
15
 
10
16
  http://github.com/CloudHealth/amazon-pricing/tree/master
11
17
 
12
-
13
- == Installation
18
+ Installation
19
+ ------------
14
20
 
15
21
  This gem follows the standard conventions for installation on any system with Ruby and RubyGems installed and uses Bundler for gem installation and build management.
16
22
 
17
- === Get an AWS account
23
+ ### Get an AWS account
18
24
 
19
25
  Before you can make use of this gem you will need an Amazon Web Services account.
20
26
 
21
- === Install the amazon-pricing gem (Canonical Release)
27
+ ### Install the amazon-pricing gem (Canonical Release)
22
28
 
23
29
  This is the standard install for stable releases from RubyGems.
24
30
 
25
- # Install the gem
26
- [sudo] gem install amazon-pricing
31
+ * Install the gem: `[sudo] gem install amazon-pricing`
27
32
 
28
- === Install from local Git clone (for amazon-pricing developers)
33
+ ### Install from local Git clone (for amazon-pricing developers)
29
34
 
30
35
  To install from git for adding features or fixing bugs, you'll need to clone and build.
31
36
 
32
- git clone git://github.com/CloudHealth/amazon-pricing.git
33
- cd amazon-pricing
34
- bundle install
35
- rake test
36
- rake build
37
- rake install
37
+ ```
38
+ git clone git://github.com/CloudHealth/amazon-pricing.git
39
+ cd amazon-pricing
40
+ bundle install
41
+ rake test
42
+ rake build
43
+ rake install
44
+ ```
38
45
 
39
-
40
- == Using amazon-pricing
46
+ Using amazon-pricing
47
+ --------------------
41
48
 
42
49
  The library exposes one main interface class AwsPricing::PriceList that allows you to retrieve pricing information from Amazon. The information is retrieved using undocumented json APIs - so has the potential to undergo change from time to time.
43
50
 
@@ -45,30 +52,36 @@ The following article provides a good introduction to using the gem:
45
52
 
46
53
  http://www.hightechinthehub.com/2012/03/programmatically-retrieving-aws-pricing/
47
54
 
48
- === The Basics
55
+ ### The Basics
49
56
 
50
57
  The library exposes one main interface module
51
58
 
52
- AwsPricing::PriceList
59
+ ```
60
+ AwsPricing::PriceList
61
+ ```
53
62
 
54
- == Additional Resources
63
+ Additional Resources
64
+ --------------------
55
65
 
56
- === Project Websites
66
+ ### Project Websites
57
67
 
58
68
  * Project Home : http://github.com/CloudHealth/amazon-pricing/tree/master
59
69
  * API Documentation : http://rdoc.info/projects/CloudHealth/amazon-pricing
60
70
  * Report Bugs / Request Features : http://github.com/CloudHealth/amazon-pricing/issues
61
71
  * Amazon Web Services : http://aws.amazon.com
62
72
 
63
- == Credits
73
+ Credits
74
+ -------
64
75
 
65
76
  Thanks for Amazon developers for provided Json APIs to the pricing data (albeit undocumented).
66
77
 
67
- == Contact
78
+ Contact
79
+ -------
68
80
 
69
81
  Comments, patches, Git pull requests and bug reports are welcome. Send an email to mailto:joe.kinsella@gmail.com.
70
82
 
71
- == Patches & Pull Requests
83
+ Patches & Pull Requests
84
+ -----------------------
72
85
 
73
86
  Please follow these steps if you want to send a patch or a GitHub pull request:
74
87
 
@@ -81,8 +94,6 @@ Please follow these steps if you want to send a patch or a GitHub pull request:
81
94
  * Open an Issue on GitHub referencing your branch and send a pull request.
82
95
  * Please do not push to `master` on your fork. Using a feature/bugfix branch will make everyone’s life easier.
83
96
 
84
-
85
97
  Enjoy!
86
98
 
87
99
  CloudHealth
88
-
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ task :install => :gem do
28
28
  end
29
29
 
30
30
  task :test do
31
- ruby "test/test-ec2-instance-types.rb"
31
+ ruby 'test/ec2_instance_types_test.rb'
32
32
  end
33
33
 
34
34
  desc "Prints current EC2 pricing in CSV format"
@@ -1,28 +1,25 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path(File.join("..","lib"), __FILE__)
3
- require "amazon-pricing/version"
2
+ $:.push File.expand_path(File.join('..', 'lib'), __FILE__)
3
+ require 'amazon-pricing/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "amazon-pricing"
6
+ s.name = 'amazon-pricing'
7
7
  s.version = AwsPricing::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Joe Kinsella"]
10
- s.email = ["joe.kinsella@gmail.com"]
11
- s.homepage = "http://github.com/CloudHealth/amazon-pricing"
12
- s.summary = "Amazon Web Services Pricing Ruby gem"
13
- s.description = "A Ruby library for retrieving pricing for Amazon Web Services"
9
+ s.authors = ['Joe Kinsella']
10
+ s.email = %w(joe.kinsella@gmail.com)
11
+ s.homepage = 'http://github.com/CloudHealth/amazon-pricing'
12
+ s.summary = 'Amazon Web Services Pricing Ruby gem'
13
+ s.description = 'A Ruby library for retrieving pricing for Amazon Web Services'
14
14
  s.license = 'MIT'
15
15
 
16
- s.rubyforge_project = "amazon-pricing"
16
+ s.rubyforge_project = 'amazon-pricing'
17
17
 
18
- s.rdoc_options = ["--title", "amazon-pricing documentation", "--line-numbers", "--main", "README"]
19
- s.extra_rdoc_files = [
20
- "LICENSE",
21
- "README"
22
- ]
18
+ s.rdoc_options = ['--title', 'amazon-pricing documentation', '--line-numbers', '--main', 'README.md']
19
+ s.extra_rdoc_files = %w(LICENSE README.md)
23
20
 
24
21
  s.files = `git ls-files`.split("\n")
25
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
23
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
- s.require_paths = ["lib"]
24
+ s.require_paths = %w(lib)
28
25
  end
@@ -10,50 +10,78 @@
10
10
  module AwsPricing
11
11
  class DatabaseType < CategoryType
12
12
 
13
- @@Database_Name_Lookup = {
14
- 'mysql_standard'=> 'MySQL Community Edition',
15
- 'mysql_multiaz'=> 'MySQL Community Edition (Multi-AZ)',
16
- 'postgresql_standard'=> 'PostgreSql Community Edition(Beta)',
17
- 'postgresql_multiaz'=> 'PostgreSql Community Edition(Beta) (Multi-AZ)',
18
- 'oracle_se1_standard'=> 'Oracle Database Standard Edition One',
19
- 'oracle_se1_multiaz'=> 'Oracle Database Standard Edition One (Multi-AZ)',
20
- 'oracle_se1_byol'=> 'Oracle Database Standard Edition One (BYOL)',
21
- 'oracle_se1_byol_multiaz'=> 'Oracle Database Standard Edition One (BYOL Multi-AZ)',
22
- 'oracle_se_byol'=> 'Oracle Database Standard Edition (BYOL)',
23
- 'oracle_se_byol_multiaz'=> 'Oracle Database Standard Edition (BYOL Multi-AZ)',
24
- 'oracle_ee_byol'=> 'Oracle Database Enterprise Edition (BYOL)',
25
- 'oracle_ee_byol_multiaz'=> 'Oracle Database Enterprise Edition (BYOL Multi-AZ)',
26
- 'sqlserver_ex'=> 'Microsoft SQL Server Express Edition',
27
- 'sqlserver_web'=> 'Microsoft SQL Server Web Edition',
28
- 'sqlserver_se_standard'=> 'Microsoft SQL Server Standard Edition',
29
- 'sqlserver_se_byol'=> 'Microsoft SQL Server Standard Edition (BYOL)',
30
- 'sqlserver_ee_byol'=> 'Microsoft SQL Server Enterprise Edition (BYOL)'
31
- }
13
+ @@Database_Name_Lookup = {
14
+ 'mysql_standard' => 'MySQL Community Edition',
15
+ 'mysql_multiaz' => 'MySQL Community Edition (Multi-AZ)',
16
+ 'postgresql_standard' => 'PostgreSql Community Edition(Beta)',
17
+ 'postgresql_multiaz' => 'PostgreSql Community Edition(Beta) (Multi-AZ)',
18
+ 'oracle_se1_standard' => 'Oracle Database Standard Edition One',
19
+ 'oracle_se1_multiaz' => 'Oracle Database Standard Edition One (Multi-AZ)',
20
+ 'oracle_se1_byol' => 'Oracle Database Standard Edition One (BYOL)',
21
+ 'oracle_se1_byol_multiaz' => 'Oracle Database Standard Edition One (BYOL Multi-AZ)',
22
+ 'oracle_se_byol' => 'Oracle Database Standard Edition (BYOL)',
23
+ 'oracle_se_byol_multiaz' => 'Oracle Database Standard Edition (BYOL Multi-AZ)',
24
+ 'oracle_ee_byol' => 'Oracle Database Enterprise Edition (BYOL)',
25
+ 'oracle_ee_byol_multiaz' => 'Oracle Database Enterprise Edition (BYOL Multi-AZ)',
26
+ 'sqlserver_ex' => 'Microsoft SQL Server Express Edition',
27
+ 'sqlserver_web' => 'Microsoft SQL Server Web Edition',
28
+ 'sqlserver_se_standard' => 'Microsoft SQL Server Standard Edition',
29
+ 'sqlserver_se_byol' => 'Microsoft SQL Server Standard Edition (BYOL)',
30
+ 'sqlserver_ee_byol' => 'Microsoft SQL Server Enterprise Edition (BYOL)'
31
+ }
32
+
33
+ @@ProductDescription = {
34
+ 'mysql' => 'mysql_standard',
35
+ 'mysql_multiaz' => 'mysql_multiaz',
36
+ 'postgres' => 'postgresql_standard',
37
+ 'postgres_multiaz' => 'postgresql_multiaz',
38
+ 'oracle-se1(li)' => 'oracle_se1_standard',
39
+ 'oracle-se1(byol)' => 'oracle_se1_byol',
40
+ 'oracle-se1(li)_multiaz' => 'oracle_se1_multiaz',
41
+ 'oracle-se1(byol)_multiaz' => 'oracle_se1_byol_multiaz',
42
+ 'oracle-se(byol)' => 'oracle_se_byol',
43
+ 'oracle-ee(byol)' => 'oracle_ee_byol',
44
+ 'oracle-se(byol)_multiaz' => 'oracle_se_byol_multiaz',
45
+ 'oracle-ee(byol)_multiaz' => 'oracle_ee_byol_multiaz',
46
+ 'sqlserver-ee(byol)' => 'sqlserver_ee_byol',
47
+ 'sqlserver-ex(li)' => 'sqlserver_ex',
48
+ 'sqlserver-se(byol)' => 'sqlserver_se_byol',
49
+ 'sqlserver-se(li)' => 'sqlserver_se_standard',
50
+ 'sqlserver-web(li)' => 'sqlserver_web',
51
+ }
32
52
 
33
53
  @@DB_Deploy_Types = {
34
- :mysql=>[:standard, :multiaz],
35
- :postgresql=>[:standard, :multiaz],
36
- :oracle_se1=>[:standard, :multiaz, :byol, :byol_multiaz],
37
- :oracle_se=>[:byol, :byol_multiaz],
38
- :oracle_ee=>[:byol, :byol_multiaz],
39
- :sqlserver_se=>[:standard, :byol],
40
- :sqlserver_ee=>[:byol]
54
+ :mysql => [:standard, :multiaz],
55
+ :postgresql => [:standard, :multiaz],
56
+ :oracle_se1 => [:standard, :multiaz, :byol, :byol_multiaz],
57
+ :oracle_se => [:byol, :byol_multiaz],
58
+ :oracle_ee => [:byol, :byol_multiaz],
59
+ :sqlserver_se => [:standard, :byol],
60
+ :sqlserver_ee => [:byol]
41
61
  }
42
62
 
43
63
  def self.display_name(name)
44
- @@Database_Name_Lookup[name]
64
+ @@Database_Name_Lookup[name]
45
65
  end
46
66
 
47
67
  def self.get_database_name
48
- [:mysql, :postgresql, :oracle_se1, :oracle_se, :oracle_ee, :sqlserver_ex, :sqlserver_web, :sqlserver_se, :sqlserver_ee]
68
+ [:mysql, :postgresql, :oracle_se1, :oracle_se, :oracle_ee, :sqlserver_ex, :sqlserver_web, :sqlserver_se, :sqlserver_ee]
49
69
  end
50
70
 
51
71
  def self.get_available_types(db)
52
- @@DB_Deploy_Types[db]
72
+ @@DB_Deploy_Types[db]
53
73
  end
54
74
 
75
+ def self.db_mapping(product, is_multi_az)
76
+ if is_multi_az
77
+ display_name(@@ProductDescription["#{product}_multiaz"])
78
+ else
79
+ display_name(@@ProductDescription["#{product}"])
80
+ end
81
+ end
82
+
55
83
  def display_name
56
- self.class.display_name(name)
57
- end
84
+ self.class.display_name(name)
85
+ end
58
86
  end
59
- end
87
+ end
@@ -82,6 +82,15 @@ module AwsPricing
82
82
  cat.get_breakeven_month(type_of_instance, term) unless cat.nil?
83
83
  end
84
84
 
85
+ def self.service_type(category)
86
+ case category
87
+ when 'os'; 'ec2'
88
+ when 'db'; 'rds'
89
+ else
90
+ ''
91
+ end
92
+ end
93
+
85
94
  protected
86
95
 
87
96
  def coerce_price(price)
@@ -8,5 +8,5 @@
8
8
  # Home:: http://github.com/CloudHealth/amazon-pricing
9
9
  #++
10
10
  module AwsPricing
11
- VERSION = '0.1.16'
11
+ VERSION = '0.1.17'
12
12
  end
@@ -1,11 +1,12 @@
1
- require 'amazon-pricing/instance-type'
2
-
3
- describe AwsPricing::InstanceType do
4
- describe '::get_api_name' do
5
- it "raises an UnknownTypeError on an unexpected instance type" do
6
- expect {
7
- AwsPricing::InstanceType::get_name 'QuantumODI', 'huge'
8
- }.to raise_error(AwsPricing::UnknownTypeError)
9
- end
10
- end
11
- end
1
+ #require 'amazon-pricing/instance-type'
2
+ #
3
+ # THIS TEST IS NO LONGER VALID
4
+ #describe AwsPricing::InstanceType do
5
+ # describe '::get_values' do
6
+ # it 'raises an UnknownTypeError on an unexpected instance type' do
7
+ # expect {
8
+ # AwsPricing::InstanceType::get_values 'QuantumODI', 'huge'
9
+ # }.to raise_error(AwsPricing::UnknownTypeError)
10
+ # end
11
+ # end
12
+ #end
@@ -1,4 +1,5 @@
1
1
  require 'amazon-pricing'
2
+ require 'spec_helper'
2
3
 
3
4
  describe AwsPricing::PriceList do
4
5
 
@@ -1,26 +1,26 @@
1
1
  require 'amazon-pricing'
2
2
  require File.join('amazon-pricing', 'database-type')
3
+ require 'spec_helper'
3
4
 
4
5
  describe AwsPricing::RdsPriceList do
5
-
6
- before do
7
- @region_name = ['us-east', 'us-west', 'us-west-2', 'eu-ireland', 'apac-sin', 'apac-syd', 'apac-tokyo', 'sa-east-1']
8
- @db_types = [:mysql, :oracle, :oracle_byol, :sqlserver, :sqlserver_express, :sqlserver_web, :sqlserver_byol]
6
+ before(:all) do
7
+ @pricing = AwsPricing::RdsPriceList.new
8
+ @region_name = %w(us-east us-west us-west-2 eu-ireland apac-sin apac-syd apac-tokyo sa-east-1)
9
+ @db_types = [:mysql, :oracle, :oracle_byol, :sqlserver, :sqlserver_express, :sqlserver_web, :sqlserver_byol]
9
10
  end
10
11
 
11
12
  describe 'new' do
12
13
  it 'RdsPriceList.new should return the valid response' do
13
- result = AwsPricing::RdsPriceList.new
14
- result.regions.each do |region|
15
- # response should have valid region
16
- expect(@region_name).to include(region.name)
17
- # Result have valid db name
18
- expect(@db_types).to include(region.rds_instance_types.first.category_types.first.name)
19
- # values should not be nil
20
- region.rds_instance_types.first.category_types.first.ondemand_price_per_hour.should_not be_nil
21
- region.rds_instance_types.first.category_types.first.light_price_per_hour_1_year.should_not be_nil
22
- region.rds_instance_types.first.category_types.first.medium_price_per_hour_1_year.should_not be_nil
23
- region.rds_instance_types.first.category_types.first.heavy_price_per_hour_1_year.should_not be_nil
14
+ @pricing.regions.each do |region|
15
+ # response should have valid region
16
+ expect(@region_name).to include(region.name)
17
+ # Result have valid db name
18
+ expect(@db_types).to include(region.rds_instance_types.first.category_types.first.name)
19
+ # values should not be nil
20
+ region.rds_instance_types.first.category_types.first.ondemand_price_per_hour.should_not be_nil
21
+ region.rds_instance_types.first.category_types.first.light_price_per_hour_1_year.should_not be_nil
22
+ region.rds_instance_types.first.category_types.first.medium_price_per_hour_1_year.should_not be_nil
23
+ region.rds_instance_types.first.category_types.first.heavy_price_per_hour_1_year.should_not be_nil
24
24
  end
25
25
  end
26
26
  end
@@ -35,8 +35,7 @@ describe AwsPricing::RdsPriceList do
35
35
 
36
36
  describe 'get_breakeven_months' do
37
37
  it "test_fetch_all_breakeven_months" do
38
- pricing = AwsPricing::RdsPriceList.new
39
- pricing.regions.each do |region|
38
+ @pricing.regions.each do |region|
40
39
  region.rds_instance_types.each do |instance|
41
40
  [:year1, :year3].each do |term|
42
41
  [:light, :medium, :heavy].each do |res_type|
@@ -0,0 +1,4 @@
1
+ #BROKEN IN TDDIUM: Dir.glob('spec/support/**/*.rb').sort.each {|f| require f}
2
+ #ENV['TDDIUM_REPO_ROOT']
3
+ require 'coveralls'
4
+ Coveralls.wear!
File without changes
@@ -15,15 +15,20 @@ require 'helper'
15
15
  require 'test/unit'
16
16
 
17
17
  class TestEc2InstanceTypes < Test::Unit::TestCase
18
+ class << self
19
+ def startup
20
+ #This is expensive, so only do once.
21
+ @@ec2_pricing = AwsPricing::Ec2PriceList.new
22
+ end
23
+ end
24
+
18
25
  def test_cc8xlarge_issue
19
- pricing = AwsPricing::Ec2PriceList.new
20
- obj = pricing.get_instance_type('us-east', 'cc2.8xlarge')
26
+ obj = @@ec2_pricing.get_instance_type('us-east', 'cc2.8xlarge')
21
27
  assert obj.api_name == 'cc2.8xlarge'
22
28
  end
23
29
 
24
30
  def test_name_lookup
25
- pricing = AwsPricing::Ec2PriceList.new
26
- pricing.regions.each do |region|
31
+ @@ec2_pricing.regions.each do |region|
27
32
  assert_not_nil region.name
28
33
 
29
34
  region.ec2_instance_types.each do |instance|
@@ -43,14 +48,12 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
43
48
 
44
49
  def test_available
45
50
  # Validate instance types in specific regions are available
46
- pricing = AwsPricing::Ec2PriceList.new
47
- region = pricing.get_region('us-east')
51
+ region = @@ec2_pricing.get_region('us-east')
48
52
  assert region.instance_type_available?('m1.large')
49
53
  end
50
54
 
51
55
  def test_fetch_all_breakeven_months
52
- pricing = AwsPricing::Ec2PriceList.new
53
- pricing.regions.each do |region|
56
+ @@ec2_pricing.regions.each do |region|
54
57
  region.ec2_instance_types.each do |instance|
55
58
  instance.operating_systems.each do |os|
56
59
  [:light, :medium, :heavy].each do |res_type|
@@ -64,8 +67,7 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
64
67
  end
65
68
 
66
69
  def test_breakeven_month
67
- pricing = AwsPricing::Ec2PriceList.new
68
- region = pricing.get_region('us-east')
70
+ region = @@ec2_pricing.get_region('us-east')
69
71
  instance = region.get_ec2_instance_type('m1.large')
70
72
  bem = instance.get_breakeven_month(:linux, :heavy, :year1)
71
73
  assert bem == 6
@@ -73,22 +75,19 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
73
75
 
74
76
  def test_memory
75
77
  # Validate instance types in specific regions are available
76
- pricing = AwsPricing::Ec2PriceList.new
77
- region = pricing.get_region('us-east')
78
+ region = @@ec2_pricing.get_region('us-east')
78
79
  instance = region.get_ec2_instance_type('m1.large')
79
80
  assert instance.memory_in_mb == 7500
80
81
  end
81
82
 
82
83
  def test_non_standard_region_name
83
- pricing = AwsPricing::Ec2PriceList.new
84
- region = pricing.get_region('eu-west-1')
84
+ region = @@ec2_pricing.get_region('eu-west-1')
85
85
  instance = region.get_ec2_instance_type('m1.large')
86
86
  assert instance.memory_in_mb == 7500
87
87
  end
88
88
 
89
89
  def test_ebs
90
- pricing = AwsPricing::Ec2PriceList.new
91
- region = pricing.get_region('us-east')
90
+ region = @@ec2_pricing.get_region('us-east')
92
91
  assert region.ebs_price.standard_per_gb == 0.10
93
92
  assert region.ebs_price.standard_per_million_io == 0.10
94
93
  assert region.ebs_price.preferred_per_gb == 0.125
@@ -97,8 +96,7 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
97
96
  end
98
97
 
99
98
  def test_ebs_not_null
100
- pricing = AwsPricing::Ec2PriceList.new
101
- pricing.regions.each do |region|
99
+ @@ec2_pricing.regions.each do |region|
102
100
  # Everyone should have standard pricing
103
101
  assert_not_nil region.ebs_price.standard_per_gb
104
102
  assert_not_nil region.ebs_price.standard_per_million_io
@@ -107,8 +105,7 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
107
105
  end
108
106
 
109
107
  def test_virtual_cores
110
- pricing = AwsPricing::Ec2PriceList.new
111
- region = pricing.get_region('us-east')
108
+ region = @@ec2_pricing.get_region('us-east')
112
109
  instance = region.get_ec2_instance_type('m1.large')
113
110
  assert instance.virtual_cores == 2
114
111
  end
@@ -10,3 +10,6 @@
10
10
 
11
11
  require 'rubygems'
12
12
  require File.dirname(__FILE__) + '/../lib/amazon-pricing'
13
+
14
+ require 'coveralls'
15
+ Coveralls.wear!
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
5
- prerelease:
4
+ version: 0.1.17
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Joe Kinsella
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-24 00:00:00.000000000 Z
12
+ date: 2013-11-27 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby library for retrieving pricing for Amazon Web Services
15
15
  email:
@@ -18,12 +18,13 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files:
20
20
  - LICENSE
21
- - README
21
+ - README.md
22
22
  files:
23
23
  - CHANGELOG
24
24
  - Gemfile
25
+ - Gemfile.lock
25
26
  - LICENSE
26
- - README
27
+ - README.md
27
28
  - Rakefile
28
29
  - amazon-pricing.gemspec
29
30
  - lib/amazon-pricing.rb
@@ -38,43 +39,41 @@ files:
38
39
  - lib/amazon-pricing/version.rb
39
40
  - spec/instance_type_spec.rb
40
41
  - spec/price_list_spec.rb
41
- - spec/rds-amazon-pricing-spec.rb
42
+ - spec/rds_pricing_spec.rb
43
+ - spec/spec_helper.rb
44
+ - spec/support/.gitignore
45
+ - test/ec2_instance_types_test.rb
42
46
  - test/helper.rb
43
- - test/test-ec2-instance-types.rb
44
47
  homepage: http://github.com/CloudHealth/amazon-pricing
45
48
  licenses:
46
49
  - MIT
47
- post_install_message:
50
+ post_install_message:
48
51
  rdoc_options:
49
- - --title
52
+ - "--title"
50
53
  - amazon-pricing documentation
51
- - --line-numbers
52
- - --main
53
- - README
54
+ - "--line-numbers"
55
+ - "--main"
56
+ - README.md
54
57
  require_paths:
55
58
  - lib
56
59
  required_ruby_version: !ruby/object:Gem::Requirement
57
- none: false
58
60
  requirements:
59
- - - ! '>='
61
+ - - ">="
60
62
  - !ruby/object:Gem::Version
61
- version: '0'
62
- required_rubygems_version: !ruby/object:Gem::Requirement
63
+ version: !binary |-
64
+ MA==
63
65
  none: false
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
67
  requirements:
65
- - - ! '>='
68
+ - - ">="
66
69
  - !ruby/object:Gem::Version
67
- version: '0'
70
+ version: !binary |-
71
+ MA==
72
+ none: false
68
73
  requirements: []
69
74
  rubyforge_project: amazon-pricing
70
- rubygems_version: 1.8.25
71
- signing_key:
75
+ rubygems_version: 1.8.24
76
+ signing_key:
72
77
  specification_version: 3
73
78
  summary: Amazon Web Services Pricing Ruby gem
74
- test_files:
75
- - spec/instance_type_spec.rb
76
- - spec/price_list_spec.rb
77
- - spec/rds-amazon-pricing-spec.rb
78
- - test/helper.rb
79
- - test/test-ec2-instance-types.rb
80
- has_rdoc:
79
+ test_files: []