amazon-pricing 0.1.66 → 0.1.67

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDFiYTIxOTk0ZDIyMTJiNDhlZGIzYTMyY2NhYmZkMTIzYTQyNTk4Yw==
4
+ YTFhNmIxNTliZWE1M2Y0NWRmMDJmOWFkOTFmYTQzZmEzNThkYzkwMA==
5
5
  data.tar.gz: !binary |-
6
- NjVhMTVjNDEyNDRlZTM0ZjhhY2Q5YWZjNzNmMTJmOTkxODE3NTI3MA==
6
+ MDBkNzhjNTVlYmY5YzY3NmJmOTcyMmVkMTZlMmU3NTRlMDg5NTY1NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTJkMzAyMWJiNDI0ZTUzMWI2N2JiMzRhNDEwYzc4OGNkMGU4MDExYTg3MGVi
10
- ZDk2MjJhODFkOWEwN2FkZWRlNzM3N2NhNmEyZTgxODQ0MDdlYjNiZTJmOTFm
11
- Mzg4MGYwNTE1ZjE3ZGYyOWYyMTJmY2FiN2JiZDQ2YjI3NWNmYzQ=
9
+ ZmIyYTI0NzllOWY1MDJlODc1MzkxNDA4MjVkMjAzMjJkNzk1ZTJjMDNmMTg1
10
+ YjE3ZDI3NTRkZDQ4NDczOWY1OWIzYTFkYTIxMTExMmQyYzg5OGNmNDljNWY3
11
+ NDg5Y2IzMTllYTZlYjEyMWVjZTRjYzEyM2VhZGI1NzMwM2E4YzY=
12
12
  data.tar.gz: !binary |-
13
- MDNkZjI5MGU5Mjk4MDYzMTVhMjIwZTk1NTQ1NTRjNzQwZTM2ZTNhMjQxMjQ3
14
- NDhkOGYxMzFkNWE5MGExNTNmZGViYWYzOTIyYTg3ODhjMzMwYjQyMzc0NjA2
15
- OTM4ODNjZWIyZDVlOTE0NGFiYmI5MzE3NGY1NWYzMGI2ZDEzOTA=
13
+ NTA2NDA1ZjYyNjJlM2ZmMDIxZGJlYWNjMjc3MTBjNThkN2RjOGI2M2VjNmVi
14
+ ZTE0MGMxNjI1OGNiN2FhYTkxZDA4MDNjMTE4MWJmY2IwYzYxMWQ2ZmI1OTdl
15
+ YWU5ZDM4OGViNmNlZjIzZjZhNDUzYWRhZDk0NzkzZjJmZWVhNmI=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- amazon-pricing (0.1.66)
4
+ amazon-pricing (0.1.67)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -141,22 +141,39 @@ module AwsPricing
141
141
  all_instances.select { |family, instances| instances.include?(api_name) }.values.first
142
142
  end
143
143
 
144
- def size_to_nf
145
- {
146
- 'micro' => 0.5,
147
- 'small' => 1,
148
- 'medium' => 2,
149
- 'large' => 4,
150
- 'xlarge' => 8,
151
- '2xlarge' => 16,
152
- '4xlarge' => 32,
153
- '8xlarge' => 64
154
- }
155
- end
156
144
 
157
145
  def api_name_to_nf(name)
158
146
  size_to_nf[name.split('.').last]
159
147
  end
148
+
149
+ def next_smaller_type(name)
150
+ fam,type = name.split('.')
151
+ nf= size_to_nf[type] / 2.0
152
+ new_type = NF_TO_SIZE_TABLE[nf] || NF_TO_SIZE_TABLE[nf.to_i] # 2.0 and 2 are no same when used as hash keys.
153
+ ["#{fam}.#{new_type}" , nf]
154
+ end
155
+
156
+ def size_to_nf
157
+ SIZE_TO_NF_TABLE
158
+ end
159
+
160
+ def nf_to_size
161
+ NF_TO_SIZE_TABLE
162
+ end
163
+
164
+ SIZE_TO_NF_TABLE = {
165
+ "micro" => 0.5,
166
+ "small" => 1,
167
+ "medium" => 2,
168
+ "large" => 4,
169
+ "xlarge" => 8,
170
+ "2xlarge" => 16,
171
+ "4xlarge" => 32,
172
+ "8xlarge" => 64,
173
+ "10xlarge" => 80
174
+ }
175
+ NF_TO_SIZE_TABLE = SIZE_TO_NF_TABLE.invert
176
+
160
177
  end
161
178
  end
162
179
  end
@@ -8,5 +8,5 @@
8
8
  # Home:: http://github.com/CloudHealth/amazon-pricing
9
9
  #++
10
10
  module AwsPricing
11
- VERSION = '0.1.66'
11
+ VERSION = '0.1.67'
12
12
  end
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.66
4
+ version: 0.1.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Kinsella
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-10-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby library for retrieving pricing for Amazon Web Services
14
14
  email:
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project: amazon-pricing
87
- rubygems_version: 2.4.6
87
+ rubygems_version: 2.4.8
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Amazon Web Services Pricing Ruby gem