awscosts 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1 -1
  3. data/fixtures/vcr_cassettes/AWSCosts_EBS.yml +506 -202
  4. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_linux.yml +4588 -1270
  5. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_rhel.yml +4588 -1270
  6. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_sles.yml +4588 -1270
  7. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows.yml +4588 -1270
  8. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows_with_sql.yml +3538 -1270
  9. data/fixtures/vcr_cassettes/AWSCosts_EC2OnDemand/EC2_type_of_windows_with_sql_web.yml +4063 -1270
  10. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_linux.yml +5973 -2786
  11. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_rhel.yml +5972 -2785
  12. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_sles.yml +5972 -2785
  13. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_windows.yml +5973 -2786
  14. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_windows_with_sql.yml +5973 -2786
  15. data/fixtures/vcr_cassettes/AWSCosts_EC2ReservedInstances/Reserved_instances/in_the_us-east-1_region/EC2_type_of_windows_with_sql_web.yml +5972 -2785
  16. data/fixtures/vcr_cassettes/AWSCosts_ELB.yml +293 -96
  17. data/fixtures/vcr_cassettes/AWSCosts_EMR.yml +4963 -744
  18. data/fixtures/vcr_cassettes/AWSCosts_ElasticIPs.yml +386 -135
  19. data/fixtures/vcr_cassettes/AWSCosts_S3DataTransfer.yml +935 -346
  20. data/fixtures/vcr_cassettes/AWSCosts_S3Requests.yml +464 -147
  21. data/fixtures/vcr_cassettes/AWSCosts_S3Storage.yml +1406 -568
  22. data/lib/awscosts/ec2.rb +1 -1
  23. data/lib/awscosts/s3.rb +15 -4
  24. data/lib/awscosts/version.rb +1 -1
  25. data/spec/awscosts/ec2_ebs_spec.rb +27 -23
  26. data/spec/awscosts/ec2_elastic_ips_spec.rb +10 -6
  27. data/spec/awscosts/ec2_elb_spec.rb +2 -2
  28. data/spec/awscosts/ec2_on_demand_spec.rb +6 -3
  29. data/spec/awscosts/ec2_reserved_instances_spec.rb +4 -4
  30. data/spec/awscosts/ec2_spec.rb +6 -2
  31. data/spec/awscosts/s3_data_transfer_spec.rb +6 -2
  32. data/spec/awscosts/s3_requests_spec.rb +6 -3
  33. data/spec/awscosts/s3_storage_spec.rb +8 -3
  34. metadata +20 -40
@@ -16,7 +16,7 @@ class AWSCosts::EC2
16
16
  end
17
17
 
18
18
  def on_demand(type)
19
- AWSCosts::EC2OnDemand.fetch(TYPES[type], self.region.price_mapping)
19
+ AWSCosts::EC2OnDemand.fetch(TYPES[type], self.region.name)
20
20
  end
21
21
 
22
22
  def reserved(type, utilisation= :light)
@@ -6,20 +6,31 @@ class AWSCosts::S3
6
6
 
7
7
  attr_reader :region
8
8
 
9
+ REGION_MAPPING = {
10
+ 'us-east-1' => "us-std",
11
+ 'us-west-1' => "us-west-1",
12
+ 'us-west-2' => "us-west-2",
13
+ 'eu-west-1' => "eu-west-1",
14
+ 'ap-southeast-1' => "ap-southeast-1",
15
+ 'ap-southeast-2' =>"ap-southeast-2",
16
+ 'ap-northeast-1' =>"ap-northeast-1",
17
+ 'sa-east-1' => "sa-east-1"
18
+ }
19
+
9
20
  def initialize region
10
- @region = region
21
+ @region = REGION_MAPPING[region.name]
11
22
  end
12
23
 
13
24
  def storage
14
- AWSCosts::S3Storage.fetch(self.region.price_mapping)
25
+ AWSCosts::S3Storage.fetch(self.region)
15
26
  end
16
27
 
17
28
  def data_transfer
18
- AWSCosts::S3DataTransfer.fetch(self.region.price_mapping)
29
+ AWSCosts::S3DataTransfer.fetch(self.region)
19
30
  end
20
31
 
21
32
  def requests
22
- AWSCosts::S3Requests.fetch(self.region.price_mapping)
33
+ AWSCosts::S3Requests.fetch(self.region)
23
34
  end
24
35
  end
25
36
 
@@ -1,3 +1,3 @@
1
1
  module AWSCosts
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -3,37 +3,41 @@ require 'spec_helper'
3
3
  describe AWSCosts::EBS do
4
4
  use_vcr_cassette
5
5
 
6
- subject { AWSCosts.region('ap-southeast-2').ec2.ebs}
6
+ AWSCosts::Region::SUPPORTED.keys.each do |region|
7
+ context "in the region of #{region}" do
8
+ subject { AWSCosts.region(region).ec2.ebs}
7
9
 
8
- describe 'standard EBS volume' do
9
- let(:price) { subject.price(:standard) }
10
+ describe 'standard EBS volume' do
11
+ let(:price) { subject.price(:standard) }
10
12
 
11
- it 'should provide price per GB / month for provisioned storage' do
12
- price['perGBmoProvStorage'].should > 0
13
- end
13
+ it 'should provide price per GB / month for provisioned storage' do
14
+ price['perGBmoProvStorage'].should > 0
15
+ end
14
16
 
15
- it 'should provide price per Million requests per month' do
16
- price['perMMIOreq'].should > 0
17
- end
18
- end
17
+ it 'should provide price per Million requests per month' do
18
+ price['perMMIOreq'].should > 0
19
+ end
20
+ end
19
21
 
20
- describe 'provisioned IOPS price' do
21
- let(:price) { subject.price(:provisioned_iops) }
22
+ describe 'provisioned IOPS price' do
23
+ let(:price) { subject.price(:provisioned_iops) }
22
24
 
23
- it 'should provide price per GB / month for provisioned storage' do
24
- price['perGBmoProvStorage'].should > 0
25
- end
25
+ it 'should provide price per GB / month for provisioned storage' do
26
+ price['perGBmoProvStorage'].should > 0
27
+ end
26
28
 
27
- it 'should provide a price per PIOPS' do
28
- price['perPIOPSreq'].should > 0
29
- end
30
- end
29
+ it 'should provide a price per PIOPS' do
30
+ price['perPIOPSreq'].should > 0
31
+ end
32
+ end
31
33
 
32
- describe 'Snapshots to S3' do
33
- let(:price) { subject.price(:snapshots_to_s3) }
34
+ describe 'Snapshots to S3' do
35
+ let(:price) { subject.price(:snapshots_to_s3) }
34
36
 
35
- it 'should provide a price per GB stored / month' do
36
- price['perGBmoDataStored'].should > 0
37
+ it 'should provide a price per GB stored / month' do
38
+ price['perGBmoDataStored'].should > 0
39
+ end
40
+ end
37
41
  end
38
42
  end
39
43
 
@@ -3,13 +3,17 @@ require 'spec_helper'
3
3
  describe AWSCosts::ElasticIPs do
4
4
  use_vcr_cassette
5
5
 
6
- subject { AWSCosts.region('ap-southeast-2').ec2.elastic_ips}
6
+ AWSCosts::Region::SUPPORTED.keys.each do |region|
7
7
 
8
- its(:price_one) { should == 0 }
9
- its(:price_additional_per_hour) { should > 0 }
10
- its(:price_non_attached_per_hour) { should > 0 }
11
- its(:price_remap_first_100) { should == 0 }
12
- its(:price_remap_over_100) { should > 0 }
8
+ context "in the region of #{region}" do
9
+ subject { AWSCosts.region(region).ec2.elastic_ips}
13
10
 
11
+ it { expect(subject.price_one).to eql(0.0) }
12
+ it { expect(subject.price_additional_per_hour).to be > 0 }
13
+ it { expect(subject.price_non_attached_per_hour).to be > 0 }
14
+ it { expect(subject.price_remap_first_100).to eql(0.0) }
15
+ it { expect(subject.price_remap_over_100).to be > 0 }
16
+ end
17
+ end
14
18
  end
15
19
 
@@ -5,8 +5,8 @@ describe AWSCosts::ELB do
5
5
 
6
6
  subject { AWSCosts.region('ap-southeast-2').ec2.elb}
7
7
 
8
- its(:price_per_hour) { should > 0 }
9
- its(:price_per_gb) { should > 0 }
8
+ it { expect(subject.price_per_hour).to be > 0 }
9
+ it { expect(subject.price_per_gb).to be > 0 }
10
10
 
11
11
  end
12
12
 
@@ -6,9 +6,12 @@ describe AWSCosts::EC2OnDemand do
6
6
  context "EC2 type of #{type}" do
7
7
  use_vcr_cassette
8
8
 
9
- subject { AWSCosts.region('ap-southeast-2').ec2.on_demand(type)}
10
-
11
- its(:price) { should have_key('m1.small') }
9
+ AWSCosts::Region::SUPPORTED.keys.each do |region|
10
+ context "in the region of #{region}" do
11
+ subject { AWSCosts.region(region).ec2.on_demand(type)}
12
+ it {expect(subject.price).not_to be_empty }
13
+ end
14
+ end
12
15
  end
13
16
  end
14
17
  end
@@ -14,19 +14,19 @@ describe AWSCosts::EC2ReservedInstances do
14
14
  subject { AWSCosts.region(r).ec2.reserved(type)}
15
15
 
16
16
  it 'upfront price for 1 year term' do
17
- subject.upfront(:one_year).should have_key('m1.small')
17
+ subject.upfront(:one_year).should have_key('t2.small')
18
18
  end
19
19
 
20
20
  it 'upfront price for 3 year term' do
21
- subject.upfront(:three_year).should have_key('m1.small')
21
+ subject.upfront(:three_year).should have_key('t2.small')
22
22
  end
23
23
 
24
24
  it 'hourly price for 1 year term' do
25
- subject.hourly(:one_year).should have_key('m1.small')
25
+ subject.hourly(:one_year).should have_key('t2.small')
26
26
  end
27
27
 
28
28
  it 'hourly price for 3 year term' do
29
- subject.hourly(:three_year).should have_key('m1.small')
29
+ subject.hourly(:three_year).should have_key('t2.small')
30
30
  end
31
31
  end
32
32
  end
@@ -2,9 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe AWSCosts::EC2 do
4
4
 
5
- subject { AWSCosts::EC2.new('us-east-1') }
5
+ AWSCosts::Region::SUPPORTED.keys.each do |region|
6
+ context "in the region of #{region}" do
7
+ subject { AWSCosts::EC2.new(region) }
6
8
 
7
- it { should respond_to(:region) }
9
+ it { should respond_to(:region) }
10
+ end
11
+ end
8
12
 
9
13
 
10
14
  end
@@ -3,9 +3,13 @@ require 'spec_helper'
3
3
  describe AWSCosts::S3DataTransfer do
4
4
  use_vcr_cassette
5
5
 
6
- subject { AWSCosts.region('ap-northeast-1').s3.data_transfer}
6
+ AWSCosts::Region::SUPPORTED.keys.each do |region|
7
+ context "in the region of #{region}" do
8
+ subject { AWSCosts.region(region).s3.data_transfer}
7
9
 
8
- its(:price) { should have_key('dataXferInS3') }
10
+ it { expect(subject.price).to have_key('dataXferInS3') }
11
+ end
12
+ end
9
13
  end
10
14
 
11
15
 
@@ -3,8 +3,11 @@ require 'spec_helper'
3
3
  describe AWSCosts::S3Requests do
4
4
  use_vcr_cassette
5
5
 
6
- subject { AWSCosts.region('ap-northeast-1').s3.requests}
7
-
8
- its(:price) { should have_key('putcopypost') }
6
+ AWSCosts::Region::SUPPORTED.keys.each do |region|
7
+ context "in the region of #{region}" do
8
+ subject { AWSCosts.region(region).s3.requests}
9
+ it { expect(subject.price).to have_key('putcopypost') }
10
+ end
11
+ end
9
12
  end
10
13
 
@@ -3,10 +3,15 @@ require 'spec_helper'
3
3
  describe AWSCosts::S3Storage do
4
4
  use_vcr_cassette
5
5
 
6
- subject { AWSCosts.region('ap-northeast-1').s3.storage}
6
+ AWSCosts::Region::SUPPORTED.keys.each do |region|
7
+ context "in the region of #{region}" do
8
+ subject { AWSCosts.region(region).s3.storage}
7
9
 
8
- its(:price) { should have_key('firstTBstorage') }
9
- its(:price) { should have_key('next49TBstorage') }
10
+ it { expect(subject.price).to have_key('firstTBstorage') }
11
+ it { expect(subject.price).to have_key('next49TBstorage') }
12
+ end
13
+ end
10
14
  end
11
15
 
12
16
 
17
+
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awscosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Stephen Bartlett
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-03-23 00:00:00.000000000 Z
11
+ date: 2015-06-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.11.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.11.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '1.3'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '1.3'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: vcr
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: fakeweb
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  description: AWSCosts provides an easier way to calculate the costs of running your
@@ -115,7 +102,7 @@ executables: []
115
102
  extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
118
- - .gitignore
105
+ - ".gitignore"
119
106
  - Gemfile
120
107
  - LICENSE.txt
121
108
  - README.md
@@ -170,33 +157,26 @@ files:
170
157
  homepage: https://github.com/srbartlett/awscosts
171
158
  licenses:
172
159
  - MIT
160
+ metadata: {}
173
161
  post_install_message:
174
162
  rdoc_options: []
175
163
  require_paths:
176
164
  - lib
177
165
  required_ruby_version: !ruby/object:Gem::Requirement
178
- none: false
179
166
  requirements:
180
- - - ! '>='
167
+ - - ">="
181
168
  - !ruby/object:Gem::Version
182
169
  version: '0'
183
- segments:
184
- - 0
185
- hash: -374550561017871658
186
170
  required_rubygems_version: !ruby/object:Gem::Requirement
187
- none: false
188
171
  requirements:
189
- - - ! '>='
172
+ - - ">="
190
173
  - !ruby/object:Gem::Version
191
174
  version: '0'
192
- segments:
193
- - 0
194
- hash: -374550561017871658
195
175
  requirements: []
196
176
  rubyforge_project:
197
- rubygems_version: 1.8.23
177
+ rubygems_version: 2.4.5
198
178
  signing_key:
199
- specification_version: 3
179
+ specification_version: 4
200
180
  summary: Programmatic access to AWS pricing
201
181
  test_files:
202
182
  - spec/awscosts/ec2_ebs_spec.rb