amazon-pricing 0.1.50 → 0.1.51

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWYyNTc2ZDU0NDkyY2UzZDdkM2E2YzhiODljNTNmNTdlZTE3MGQyMw==
4
+ ZWEzNTE0ZTc2NmY3ZGVmMGUzZTJmZTAwYWVjN2QwMWJjYzY2NDA0Nw==
5
5
  data.tar.gz: !binary |-
6
- ZWU3YjdlYTY1MGJiMDI2ZWNmMDEyMWI2ZmVjNjgyZmIzYWY2NDgyZQ==
6
+ YjYzZDRiODEyNWFjNjM3MTcwNzY4NWU5Mjc0ZDI2YTc2NmRiNjM5OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGJiMDBhNDliZGMzZWQ1OTE0Mzk2NDM2MmYxMTkxYThkMzBiOTk3YzViYmE1
10
- ZWY3ZmYzNGE5OGNkOTg1NzU0N2RjMmM0ODk3OTc1Yjg0ZWQxOTViMjg4OThm
11
- ZmY1YjVhMDI5ZDhmZjg5MDZjZjhiMmIxOGZhNDQyN2IzMDYxNjc=
9
+ MDliMjdiNWVjMzUxYzM3YWJjZDIwZDQxNzYzZTA0NmEwYTRiNjcyZTgyZWYy
10
+ MTcwMDBhYmRkYTAxMzk3OWExMzJlNTE1ZWIyMjllNWRiYWQ2ZjM4ZjFkNTdl
11
+ ZTU4OTUyNjYzZGUyN2I3MTRjYzgxNjYyODU0ZDUyNjhiOTM2MjY=
12
12
  data.tar.gz: !binary |-
13
- ZTA1Mjk4MjNmODc2OGJkMzMxOWI3NDFkOTVkNDlkNzRkOWM3YWZhN2NiM2E0
14
- ZjdjOTNmYTIzMGMxYzhhOGJmZjhkNjRmMTk1YmYzYjM4YWJkMjc0YWFiZDFl
15
- NDc1YzZlNWU3MDFlYWRjMDM5NTIxYjAzN2ZiMGFlNjJhZGE1N2M=
13
+ YTU2NjZmYWQ0YjM0NTg1N2FjNzk5YmFmYzBkNjkwN2M1MzQ4MmY3NDZhNzQy
14
+ N2E2NDdlOWU3MDk1NTYwMzYzMWI4MWFkOTQ4M2U4NTI4YTI1OWRiMzVjMjYz
15
+ MDE0NGZkMTZkZWU2ZmRhZGM1YjZjY2IxZGJiZmJjNDk5ZWJiNDU=
@@ -1,32 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- amazon-pricing (0.1.49)
4
+ amazon-pricing (0.1.22)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  diff-lcs (1.1.3)
10
- domain_name (0.5.18)
11
- unf (>= 0.0.5, < 1.0.0)
12
- http-cookie (1.0.2)
13
- domain_name (~> 0.5)
14
- mechanize (2.7.3)
15
- domain_name (~> 0.5, >= 0.5.1)
16
- http-cookie (~> 1.0)
17
- mime-types (~> 2.0)
18
- net-http-digest_auth (~> 1.1, >= 1.1.1)
19
- net-http-persistent (~> 2.5, >= 2.5.2)
20
- nokogiri (~> 1.4)
21
- ntlm-http (~> 0.1, >= 0.1.1)
22
- webrobots (>= 0.0.9, < 0.2)
23
- mime-types (2.2)
24
- mini_portile (0.5.3)
25
- net-http-digest_auth (1.4)
26
- net-http-persistent (2.9.4)
27
- nokogiri (1.6.1)
28
- mini_portile (~> 0.5.0)
29
- ntlm-http (0.1.1)
30
10
  rake (10.1.0)
31
11
  rspec (2.11.0)
32
12
  rspec-core (~> 2.11.0)
@@ -37,17 +17,12 @@ GEM
37
17
  diff-lcs (~> 1.1.3)
38
18
  rspec-mocks (2.11.3)
39
19
  test-unit (2.5.5)
40
- unf (0.1.4)
41
- unf_ext
42
- unf_ext (0.0.6)
43
- webrobots (0.1.1)
44
20
 
45
21
  PLATFORMS
46
22
  ruby
47
23
 
48
24
  DEPENDENCIES
49
25
  amazon-pricing!
50
- mechanize (~> 2.7.3)
51
26
  rake
52
27
  rspec (~> 2.11.0)
53
28
  test-unit
@@ -18,6 +18,26 @@ module AwsPricing
18
18
  :partialupfront_price_per_hour_1_year, :partialupfront_prepay_1_year, :partialupfront_price_per_hour_3_year, :partialupfront_prepay_3_year,
19
19
  :noupfront_price_per_hour_1_year, :noupfront_price_per_hour_3_year
20
20
 
21
+ def allupfront_effective_rate_1_year
22
+ allupfront_prepay_1_year / 365 / 24
23
+ end
24
+
25
+ def allupfront_effective_rate_3_year
26
+ allupfront_prepay_3_year / 3 / 365 / 24
27
+ end
28
+
29
+ def partialupfront_effective_rate_1_year
30
+ partialupfront_prepay_1_year / 365 / 24 + partialupfront_price_per_hour_1_year
31
+ end
32
+
33
+ def partialupfront_effective_rate_3_year
34
+ partialupfront_prepay_3_year / 3 / 365 / 24 + partialupfront_price_per_hour_3_year
35
+ end
36
+
37
+ def noupfront_effective_rate_1_year
38
+ noupfront_price_per_hour_1_year
39
+ end
40
+
21
41
  def initialize(instance_type=nil, name=nil)
22
42
  @instance_type = instance_type
23
43
  @name = name
@@ -8,5 +8,5 @@
8
8
  # Home:: http://github.com/CloudHealth/amazon-pricing
9
9
  #++
10
10
  module AwsPricing
11
- VERSION = '0.1.50'
11
+ VERSION = '0.1.51'
12
12
  end
@@ -103,6 +103,22 @@ class TestEc2InstanceTypes < Test::Unit::TestCase
103
103
  assert instance.virtual_cores == 2
104
104
  end
105
105
 
106
+ def test_new_reservation_types
107
+ region = @@ec2_pricing.get_region('us-east')
108
+ instance = region.get_ec2_instance_type('c3.large')
109
+ os = instance.get_operating_system(:linux)
110
+ assert os.ondemand_price_per_hour == 0.105
111
+ assert os.partialupfront_prepay_1_year == 326
112
+ assert os.allupfront_prepay_1_year == 542
113
+ assert os.partialupfront_prepay_3_year == 508
114
+ assert os.allupfront_prepay_3_year == 1020
115
+ assert os.noupfront_effective_rate_1_year.round(4) == 0.0730
116
+ assert os.partialupfront_effective_rate_1_year.round(4) == 0.0632
117
+ assert os.allupfront_effective_rate_1_year.round(4) == 0.0619
118
+ assert os.partialupfront_effective_rate_3_year.round(4) == 0.0413
119
+ assert os.allupfront_effective_rate_3_year.round(4) == 0.0388
120
+ end
121
+
106
122
  def test_bad_data
107
123
  # 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
108
124
  @@ec2_pricing.regions.each do |region|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.50
4
+ version: 0.1.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Kinsella
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-05 00:00:00.000000000 Z
11
+ date: 2014-12-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby library for retrieving pricing for Amazon Web Services
14
14
  email: