amazon-pricing 0.1.49 → 0.1.50

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWYyNTc2ZDU0NDkyY2UzZDdkM2E2YzhiODljNTNmNTdlZTE3MGQyMw==
5
+ data.tar.gz: !binary |-
6
+ ZWU3YjdlYTY1MGJiMDI2ZWNmMDEyMWI2ZmVjNjgyZmIzYWY2NDgyZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZGJiMDBhNDliZGMzZWQ1OTE0Mzk2NDM2MmYxMTkxYThkMzBiOTk3YzViYmE1
10
+ ZWY3ZmYzNGE5OGNkOTg1NzU0N2RjMmM0ODk3OTc1Yjg0ZWQxOTViMjg4OThm
11
+ ZmY1YjVhMDI5ZDhmZjg5MDZjZjhiMmIxOGZhNDQyN2IzMDYxNjc=
12
+ data.tar.gz: !binary |-
13
+ ZTA1Mjk4MjNmODc2OGJkMzMxOWI3NDFkOTVkNDlkNzRkOWM3YWZhN2NiM2E0
14
+ ZjdjOTNmYTIzMGMxYzhhOGJmZjhkNjRmMTk1YmYzYjM4YWJkMjc0YWFiZDFl
15
+ NDc1YzZlNWU3MDFlYWRjMDM5NTIxYjAzN2ZiMGFlNjJhZGE1N2M=
@@ -14,9 +14,9 @@ module AwsPricing
14
14
  :ondemand_price_per_hour, :light_price_per_hour_1_year, :medium_price_per_hour_1_year, :heavy_price_per_hour_1_year,
15
15
  :light_price_per_hour_3_year, :medium_price_per_hour_3_year, :heavy_price_per_hour_3_year,
16
16
  :light_prepay_1_year, :light_prepay_3_year, :medium_prepay_1_year, :medium_prepay_3_year, :heavy_prepay_1_year, :heavy_prepay_3_year,
17
- :allupfront_price_per_hour_1_year, :allupfront_prepay_1_year, :allupfront_price_per_hour_3_year, :allupfront_prepay_3_year,
17
+ :allupfront_prepay_1_year, :allupfront_prepay_3_year,
18
18
  :partialupfront_price_per_hour_1_year, :partialupfront_prepay_1_year, :partialupfront_price_per_hour_3_year, :partialupfront_prepay_3_year,
19
- :noupfront_price_per_hour_1_year, :noupfront_prepay_1_year, :noupfront_price_per_hour_3_year, :noupfront_prepay_3_year
19
+ :noupfront_price_per_hour_1_year, :noupfront_price_per_hour_3_year
20
20
 
21
21
  def initialize(instance_type=nil, name=nil)
22
22
  @instance_type = instance_type
@@ -65,12 +65,6 @@ module AwsPricing
65
65
  elsif term == :year3
66
66
  @partialupfront_prepay_3_year
67
67
  end
68
- when :noupfront
69
- if term == :year1
70
- @noupfront_prepay_1_year
71
- elsif term == :year3
72
- @noupfront_prepay_3_year
73
- end
74
68
  end
75
69
  end
76
70
 
@@ -108,14 +102,8 @@ module AwsPricing
108
102
  elsif term == :year3
109
103
  @partialupfront_prepay_3_year = price
110
104
  end
111
- when :noupfront
112
- if term == :year1
113
- @noupfront_prepay_1_year = price
114
- elsif term == :year3
115
- @noupfront_prepay_3_year = price
116
- end
117
105
  else
118
- raise "Unable to set prepay for #{type_of_instance} : #{term} to #{price}"
106
+ raise "Unable to set prepay for #{instance_type.api_name} : #{name} : #{type_of_instance} : #{term} to #{price}"
119
107
  end
120
108
  end
121
109
 
@@ -143,12 +131,6 @@ module AwsPricing
143
131
  elsif term == :year3
144
132
  @heavy_price_per_hour_3_year
145
133
  end
146
- when :allupfront
147
- if term == :year1
148
- @allupfront_price_per_hour_1_year
149
- elsif term == :year3
150
- @allupfront_price_per_hour_3_year
151
- end
152
134
  when :partialupfront
153
135
  if term == :year1
154
136
  @partialupfront_price_per_hour_1_year
@@ -188,12 +170,6 @@ module AwsPricing
188
170
  elsif term == :year3
189
171
  @heavy_price_per_hour_3_year = price_per_hour
190
172
  end
191
- when :allupfront
192
- if term == :year1
193
- @allupfront_price_per_hour_1_year = price_per_hour
194
- elsif term == :year3
195
- @allupfront_price_per_hour_3_year = price_per_hour
196
- end
197
173
  when :partialupfront
198
174
  if term == :year1
199
175
  @partialupfront_price_per_hour_1_year = price_per_hour
@@ -8,5 +8,5 @@
8
8
  # Home:: http://github.com/CloudHealth/amazon-pricing
9
9
  #++
10
10
  module AwsPricing
11
- VERSION = '0.1.49'
11
+ VERSION = '0.1.50'
12
12
  end
@@ -138,9 +138,11 @@ module AwsPricing
138
138
  duration = term["term"]
139
139
  prices = option["valueColumns"]
140
140
  upfront = prices.select{|i| i["name"] == "upfront"}.first
141
- instance_type.update_pricing_new(operating_system, reservation_type, upfront["prices"]["USD"].to_f, duration, true) unless upfront.nil?
141
+ price = upfront["prices"]["USD"]
142
+ instance_type.update_pricing_new(operating_system, reservation_type, price.to_f, duration, true) unless reservation_type == :noupfront || price == "N/A"
142
143
  hourly = prices.select{|i| i["name"] == "monthlyStar"}.first
143
- instance_type.update_pricing_new(operating_system, reservation_type, hourly["prices"]["USD"].to_f, duration, false)
144
+ price = hourly["prices"]["USD"]
145
+ instance_type.update_pricing_new(operating_system, reservation_type, price.to_f * 12 / 365 / 24, duration, false) unless reservation_type == :allupfront || price == "N/A"
144
146
  end
145
147
  end
146
148
 
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.49
5
- prerelease:
4
+ version: 0.1.50
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joe Kinsella
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A Ruby library for retrieving pricing for Amazon Web Services
15
14
  email:
@@ -57,6 +56,7 @@ files:
57
56
  homepage: http://github.com/CloudHealth/amazon-pricing
58
57
  licenses:
59
58
  - MIT
59
+ metadata: {}
60
60
  post_install_message:
61
61
  rdoc_options:
62
62
  - --title
@@ -67,28 +67,20 @@ rdoc_options:
67
67
  require_paths:
68
68
  - lib
69
69
  required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
70
  requirements:
72
71
  - - ! '>='
73
72
  - !ruby/object:Gem::Version
74
73
  version: '0'
75
- segments:
76
- - 0
77
- hash: -2678167569791819720
78
74
  required_rubygems_version: !ruby/object:Gem::Requirement
79
- none: false
80
75
  requirements:
81
76
  - - ! '>='
82
77
  - !ruby/object:Gem::Version
83
78
  version: '0'
84
- segments:
85
- - 0
86
- hash: -2678167569791819720
87
79
  requirements: []
88
80
  rubyforge_project: amazon-pricing
89
- rubygems_version: 1.8.25
81
+ rubygems_version: 2.2.2
90
82
  signing_key:
91
- specification_version: 3
83
+ specification_version: 4
92
84
  summary: Amazon Web Services Pricing Ruby gem
93
85
  test_files:
94
86
  - spec/instance_type_spec.rb
@@ -99,3 +91,4 @@ test_files:
99
91
  - test/ec2_instance_types_test.rb
100
92
  - test/govcloud_test.rb
101
93
  - test/helper.rb
94
+ has_rdoc: