aws-pricing 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'httparty'
4
+
5
+ group :development do
6
+ gem "rspec", "~> 2.8.0"
7
+ gem "rdoc", "~> 3.12"
8
+ gem "bundler", "~> 1.0.0"
9
+ gem "jeweler", "~> 1.8.3"
10
+ end
@@ -0,0 +1,37 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ httparty (0.8.1)
7
+ multi_json
8
+ multi_xml
9
+ jeweler (1.8.3)
10
+ bundler (~> 1.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ rdoc
14
+ json (1.6.6)
15
+ multi_json (1.2.0)
16
+ multi_xml (0.4.2)
17
+ rake (0.9.2.2)
18
+ rdoc (3.12)
19
+ json (~> 1.4)
20
+ rspec (2.8.0)
21
+ rspec-core (~> 2.8.0)
22
+ rspec-expectations (~> 2.8.0)
23
+ rspec-mocks (~> 2.8.0)
24
+ rspec-core (2.8.0)
25
+ rspec-expectations (2.8.0)
26
+ diff-lcs (~> 1.1.2)
27
+ rspec-mocks (2.8.0)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (~> 1.0.0)
34
+ httparty
35
+ jeweler (~> 1.8.3)
36
+ rdoc (~> 3.12)
37
+ rspec (~> 2.8.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Ian Morgan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,92 @@
1
+ = aws-pricing
2
+
3
+ Simpler interface to AWS pricing data.
4
+
5
+ == Scope of data available
6
+
7
+ Current pricing data available for services:
8
+
9
+ * EC2
10
+ * S3
11
+ * RDS
12
+ * Cloudfront
13
+ * Elastic MapReduce
14
+
15
+ == Installation
16
+
17
+ gem 'aws-pricing'
18
+
19
+ == Examples
20
+
21
+ >> pp AWSPricing::CloudFront.data_transfer
22
+ {"valueColumns"=>["us", "eur", "hk-sin", "jap", "sa", "reservedCapPricing"],
23
+ "rate"=>"perGB",
24
+ "currencies"=>["USD"],
25
+ "tiers"=>
26
+ [{"regions"=>
27
+ [{"name"=>"us", "prices"=>{"USD"=>"0.120"}},
28
+ {"name"=>"eur", "prices"=>{"USD"=>"0.120"}},
29
+ {"name"=>"hk-sin", "prices"=>{"USD"=>"0.190"}},
30
+ {"name"=>"jap", "prices"=>{"USD"=>"0.201"}},
31
+ {"name"=>"sa", "prices"=>{"USD"=>"0.250"}}],
32
+ "name"=>"first10TB"},
33
+ {"regions"=>
34
+ [{"name"=>"us", "prices"=>{"USD"=>"0.080"}},
35
+ {"name"=>"eur", "prices"=>{"USD"=>"0.080"}},
36
+ {"name"=>"hk-sin", "prices"=>{"USD"=>"0.140"}},
37
+ {"name"=>"jap", "prices"=>{"USD"=>"0.148"}},
38
+ {"name"=>"sa", "prices"=>{"USD"=>"0.200"}}],
39
+ "name"=>"next40TB"},
40
+ {"regions"=>
41
+ [{"name"=>"us", "prices"=>{"USD"=>"0.060"}},
42
+ {"name"=>"eur", "prices"=>{"USD"=>"0.060"}},
43
+ {"name"=>"hk-sin", "prices"=>{"USD"=>"0.120"}},
44
+ {"name"=>"jap", "prices"=>{"USD"=>"0.127"}},
45
+ {"name"=>"sa", "prices"=>{"USD"=>"0.180"}}],
46
+ "name"=>"next100TB"},
47
+ {"regions"=>
48
+ [{"name"=>"us", "prices"=>{"USD"=>"0.040"}},
49
+ {"name"=>"eur", "prices"=>{"USD"=>"0.040"}},
50
+ {"name"=>"hk-sin", "prices"=>{"USD"=>"0.100"}},
51
+ {"name"=>"jap", "prices"=>{"USD"=>"0.106"}},
52
+ {"name"=>"sa", "prices"=>{"USD"=>"0.160"}}],
53
+ "name"=>"next350TB"},
54
+ {"regions"=>
55
+ [{"name"=>"us", "prices"=>{"USD"=>"0.030"}},
56
+ {"name"=>"eur", "prices"=>{"USD"=>"0.030"}},
57
+ {"name"=>"hk-sin", "prices"=>{"USD"=>"0.080"}},
58
+ {"name"=>"jap", "prices"=>{"USD"=>"0.085"}},
59
+ {"name"=>"sa", "prices"=>{"USD"=>"0.140"}}],
60
+ "name"=>"next05PB"},
61
+ {"regions"=>
62
+ [{"name"=>"us", "prices"=>{"USD"=>"0.025"}},
63
+ {"name"=>"eur", "prices"=>{"USD"=>"0.025"}},
64
+ {"name"=>"hk-sin", "prices"=>{"USD"=>"0.070"}},
65
+ {"name"=>"jap", "prices"=>{"USD"=>"0.075"}},
66
+ {"name"=>"sa", "prices"=>{"USD"=>"0.130"}}],
67
+ "name"=>"next4PB"},
68
+ {"regions"=>
69
+ [{"name"=>"us", "prices"=>{"USD"=>"0.020"}},
70
+ {"name"=>"eur", "prices"=>{"USD"=>"0.020"}},
71
+ {"name"=>"hk-sin", "prices"=>{"USD"=>"0.060"}},
72
+ {"name"=>"jap", "prices"=>{"USD"=>"0.065"}},
73
+ {"name"=>"sa", "prices"=>{"USD"=>"0.125"}}],
74
+ "name"=>"over5PB"}]}
75
+
76
+
77
+
78
+ == Contributing to aws-pricing
79
+
80
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
81
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
82
+ * Fork the project.
83
+ * Start a feature/bugfix branch.
84
+ * Commit and push until you are happy with your contribution.
85
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
86
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
87
+
88
+ == Copyright
89
+
90
+ Copyright (c) 2012 Ian Morgan. See LICENSE.txt for
91
+ further details.
92
+
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "aws-pricing"
18
+ gem.homepage = "http://github.com/seeingidog/aws-pricing"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Simpler interface to AWS pricing data}
21
+ gem.description = %Q{Simpler interface to AWS pricing data}
22
+ gem.email = "ian@ruby-code.com"
23
+ gem.authors = ["Ian Morgan"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "aws-pricing #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,9 @@
1
+ require 'httparty'
2
+ dir = File.expand_path(File.join(File.dirname(__FILE__), 'aws-pricing'))
3
+ ['base', 'ec2','s3','cloudfront', 'emr', 'rds'].each do |req|
4
+ require File.join(dir, req)
5
+ end
6
+
7
+ module AWSPricing
8
+
9
+ end
@@ -0,0 +1,13 @@
1
+ module AWSPricing
2
+ class Base
3
+ include HTTParty
4
+ format :json
5
+ base_uri 'http://aws.amazon.com/'
6
+
7
+
8
+ def self.get(url)
9
+ super(url).parsed_response['config']
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module AWSPricing
2
+ class CloudFront < Base
3
+
4
+ def self.requests
5
+ Base.get('/cloudfront/pricing/pricing-cloudfront-requests.json')
6
+ end
7
+
8
+ def self.data_transfer
9
+ Base.get('/cloudfront/pricing/pricing-cloudfront-on-demand.json')
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ module AWSPricing
2
+ class EC2 < Base
3
+ def self.instances
4
+ Base.get('/ec2/pricing/pricing-on-demand-instances.json')
5
+ end
6
+
7
+ def self.ebs
8
+ Base.get('/ec2/pricing/pricing-ebs.json')
9
+ end
10
+
11
+ def self.data_transfer
12
+ Base.get('/ec2/pricing/pricing-data-transfer.json')
13
+ end
14
+
15
+ def self.elastic_ips
16
+ Base.get('/ec2/pricing/pricing-elastic-ips.json')
17
+ end
18
+
19
+ def self.cloud_watch
20
+ Base.get('/ec2/pricing/pricing-cloudwatch.json')
21
+ end
22
+
23
+ def self.elb
24
+ Base.get('/ec2/pricing/pricing-elb.json')
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ module AWSPricing
2
+ class EMR < Base
3
+ def self.pricing
4
+ Base.get('/elasticmapreduce/pricing/pricing-emr.json')
5
+ end
6
+
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ #http://aws.amazon.com/rds/pricing/mysql/pricing-standard-deployments.json
2
+ #http://aws.amazon.com/rds/pricing/mysql/pricing-multiAZ-deployments.json
3
+
4
+ module AWSPricing
5
+ class RDS < Base
6
+
7
+ def self.standard
8
+ Base.get('/rds/pricing/mysql/pricing-standard-deployments.json')
9
+ end
10
+
11
+ def self.multi_az
12
+ Base.get('/rds/pricing/mysql/pricing-multiAZ-deployments.json')
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module AWSPricing
2
+ class S3 < Base
3
+ def self.storage
4
+ Base.get('/s3/pricing/pricing-storage.json')
5
+ end
6
+
7
+ def self.data_transfer
8
+ Base.get('/s3/pricing/pricing-data-transfer.json')
9
+ end
10
+
11
+ def self.requests
12
+ Base.get('/s3/pricing/pricing-requests.json')
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,71 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "AwsPricing" do
4
+
5
+ describe "EC2 pricing" do
6
+ it "returns a hash of instance pricing" do
7
+ AWSPricing::EC2.instances.class.should == Hash
8
+ end
9
+
10
+ it "returns a hash of ebs pricing" do
11
+ AWSPricing::EC2.ebs.class.should == Hash
12
+ end
13
+
14
+ it "returns a hash of data transfer pricing" do
15
+ AWSPricing::EC2.data_transfer.class.should == Hash
16
+ end
17
+
18
+ it "returns a hash of elb pricing" do
19
+ AWSPricing::EC2.elb.class.should == Hash
20
+ end
21
+
22
+ it "returns a hash of cloudwatch pricing" do
23
+ AWSPricing::EC2.cloud_watch.class.should == Hash
24
+ end
25
+
26
+ it "returns a hash of elastic ip pricing" do
27
+ AWSPricing::EC2.elastic_ips.class.should == Hash
28
+ end
29
+
30
+
31
+ end
32
+
33
+ describe "S3 Pricing" do
34
+ it "returns a hash of storage pricing" do
35
+ AWSPricing::S3.storage.class.should == Hash
36
+ end
37
+ it "returns a hash of data transfer pricing" do
38
+ AWSPricing::S3.data_transfer.class.should == Hash
39
+ end
40
+ it "returns a hash of requests pricing" do
41
+ AWSPricing::S3.requests.class.should == Hash
42
+ end
43
+ end
44
+
45
+ describe "Cloudfront pricing" do
46
+ it "returns a hash of requests pricing" do
47
+ AWSPricing::CloudFront.data_transfer.class.should == Hash
48
+ end
49
+ it "returns a hash of requests pricing" do
50
+ AWSPricing::CloudFront.requests.class.should == Hash
51
+ end
52
+ end
53
+
54
+ describe "Elastic Mapreduce pricing" do
55
+ it "returns a hash of pricing" do
56
+ AWSPricing::EMR.pricing.class.should == Hash
57
+ end
58
+ end
59
+
60
+ describe "RDS pricing" do
61
+ it "returns a hash of standard deployment pricing" do
62
+ AWSPricing::RDS.standard.class.should == Hash
63
+ end
64
+
65
+ it "returns a hash of multi-az deployment pricing" do
66
+ AWSPricing::RDS.multi_az.class.should == Hash
67
+ end
68
+
69
+ end
70
+ end
71
+
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'aws-pricing'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-pricing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ian Morgan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-16 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: &2154847880 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2154847880
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2154846840 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.8.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2154846840
36
+ - !ruby/object:Gem::Dependency
37
+ name: rdoc
38
+ requirement: &2154846220 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '3.12'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2154846220
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &2154845480 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2154845480
58
+ - !ruby/object:Gem::Dependency
59
+ name: jeweler
60
+ requirement: &2154844780 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.8.3
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2154844780
69
+ description: Simpler interface to AWS pricing data
70
+ email: ian@ruby-code.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files:
74
+ - LICENSE.txt
75
+ - README.rdoc
76
+ files:
77
+ - .document
78
+ - .rspec
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE.txt
82
+ - README.rdoc
83
+ - Rakefile
84
+ - VERSION
85
+ - lib/aws-pricing.rb
86
+ - lib/aws-pricing/base.rb
87
+ - lib/aws-pricing/cloudfront.rb
88
+ - lib/aws-pricing/ec2.rb
89
+ - lib/aws-pricing/emr.rb
90
+ - lib/aws-pricing/rds.rb
91
+ - lib/aws-pricing/s3.rb
92
+ - spec/aws-pricing_spec.rb
93
+ - spec/spec_helper.rb
94
+ homepage: http://github.com/seeingidog/aws-pricing
95
+ licenses:
96
+ - MIT
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ segments:
108
+ - 0
109
+ hash: 3541120567702074028
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 1.8.10
119
+ signing_key:
120
+ specification_version: 3
121
+ summary: Simpler interface to AWS pricing data
122
+ test_files: []