amazon-pricing 0.1.69 → 0.1.70

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
- ZjM4OTQ2NjUzYzQ4N2RhN2I1YTk0Y2JmN2M2NDFhMWI0YzJjM2Y3MQ==
4
+ OWUyYTMwNDM1MGU5ZGM4MzM2MTYzZjZiZmI3ZjA2ZTYwZjkzMTU0Mg==
5
5
  data.tar.gz: !binary |-
6
- Yzc3MWZhZTU5NTAxYTVmNWM3MjMwYjQ5ODlhNGEzNmYxN2RhZGMyNA==
6
+ NGE3OTFmYmMzNDU0MmRiNDA2ZTIxYjJiMGFhNzRjODRkZmRjYzNlYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmI2ZTY2NWJhZGIzNDI4Yjg4YWVhYWZjNDI4MWI2Mzc0ZWNmN2UxMWE0ZGZm
10
- NjA2OWI0Njk5ZDAwMDAyZTRlMjBlMjZjZDc1ODBlYzlhNWUyMTcxNWEzOTQx
11
- YjVmNmVlODI0MzllY2I1YTA3YjlmYmQ4MTBhZTNlZGQ0Njk2OTQ=
9
+ M2ZiMTM1NTZjNGNhZWNkNGE4MWVmZGYxN2IzYTg4ZmU4NDVhYzM4ODVjMDQw
10
+ ZWU2OGI1ZTRmNDY1YWRmNzRkZDMzY2Q3MDE0MTJjZGE4YWE3NjYwZWZlNTlh
11
+ YTAwOWQzMDQ0NDM1NTgyY2NjMDIzYzI0NzIwNWEwNDgwZmE5MWI=
12
12
  data.tar.gz: !binary |-
13
- ODdkMjI1MmVlY2JkM2Y3YWEyZWM5ZTRlM2ZjODJjNzllYjI3M2QxZDFlM2Ew
14
- NDAwNDlhNzg0ODY5MmFlZTU3MDc4MmIxNWYzMTA1MzNlNWM1MGE1Yjc1OTQ4
15
- OGU0NmU1Y2YzNmZkMTA1ZWNkZDU5YmJjYjI5YzY0YjNiYzNkZTM=
13
+ NWUxZTRlNDczNTVmMTE1NWEyNjIyNjU0ODhiY2JjMzIwN2E2ZTcyNWFjOGRk
14
+ YTJmZGY0ZjU4ZWQ1MzI2OTZkMDYwOTIwOTlhYzdmOGU1ZTBiMzMwYzRlNmY4
15
+ Njg5ZjNlZDA1ZTU2ODZiZWM1MzNmNTllNDE3NTJkYzUxZjQ3ZmY=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- amazon-pricing (0.1.69)
4
+ amazon-pricing (0.1.70)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -63,10 +63,10 @@ module AwsPricing
63
63
  prices = option["valueColumns"]
64
64
  upfront = prices.select{|i| i["name"] == "upfront"}.first
65
65
  price = upfront["prices"]["USD"]
66
- instance_type.update_pricing_new(operating_system, reservation_type, price.to_f, duration, true) unless reservation_type == :noupfront || price == "N/A"
66
+ instance_type.update_pricing_new(operating_system, reservation_type, price, duration, true) unless reservation_type == :noupfront || price == "N/A"
67
67
  hourly = prices.select{|i| i["name"] == "monthlyStar"}.first
68
68
  price = hourly["prices"]["USD"]
69
- instance_type.update_pricing_new(operating_system, reservation_type, price.to_f * 12 / 365 / 24, duration, false) unless reservation_type == :allupfront || price == "N/A"
69
+ instance_type.update_pricing_new(operating_system, reservation_type, price, duration, false) unless reservation_type == :allupfront || price == "N/A"
70
70
  end
71
71
  end
72
72
 
@@ -28,15 +28,17 @@ module AwsPricing
28
28
  @category_types[operating_system] = os
29
29
  end
30
30
 
31
+ p = coerce_price(price)
32
+
31
33
  if type_of_instance == :ondemand
32
- os.set_price_per_hour(type_of_instance, nil, price)
34
+ os.set_price_per_hour(type_of_instance, nil, p)
33
35
  else
34
36
  years = :year1 if term == "yrTerm1"
35
37
  years = :year3 if term == "yrTerm3"
36
38
  if is_prepay
37
- os.set_prepay(type_of_instance, years, price)
39
+ os.set_prepay(type_of_instance, years, p)
38
40
  else
39
- os.set_price_per_hour(type_of_instance, years, price)
41
+ os.set_price_per_hour(type_of_instance, years, p * 12 / 365 / 24)
40
42
  end
41
43
  end
42
44
  end
@@ -110,7 +110,7 @@ module AwsPricing
110
110
  }
111
111
  years = terms_to_years[term]
112
112
  prices.each do |price|
113
- p = price['prices']['USD']
113
+ p = coerce_price(price['prices']['USD'])
114
114
  case price['name']
115
115
  when 'upfront'
116
116
  db.set_prepay(type_of_instance, years, p.to_f) unless type_of_instance == :noupfront || p == "N/A"
@@ -14,10 +14,11 @@ module AwsPricing
14
14
  protected
15
15
 
16
16
  @@OS_TYPES = [:linux, :mswin, :rhel, :sles, :mswinSQL, :mswinSQLWeb]
17
+ @@NEW_OS_TYPES = [:mswinSQLEnterprise]
17
18
  @@LEGACY_RES_TYPES = [:light, :medium, :heavy]
18
19
 
19
20
  def get_ec2_on_demand_instance_pricing
20
- @@OS_TYPES.each do |os|
21
+ (@@OS_TYPES + @@NEW_OS_TYPES).each do |os|
21
22
  fetch_ec2_instance_pricing(EC2_BASE_URL + "#{os}-od.min.js", :ondemand, os)
22
23
  end
23
24
  # Rinse & repeat for legacy instances
@@ -43,7 +44,7 @@ module AwsPricing
43
44
 
44
45
  def get_ec2_reserved_instance_pricing
45
46
  # I give up on finding a pattern so just iterating over known URLs
46
- page_targets = {"linux-unix" => :linux, "red-hat-enterprise-linux" => :rhel, "suse-linux" => :sles, "windows" => :mswin, "windows-with-sql-server-standard" => :mswinSQL, "windows-with-sql-server-web" => :mswinSQLWeb}
47
+ page_targets = {"linux-unix" => :linux, "red-hat-enterprise-linux" => :rhel, "suse-linux" => :sles, "windows" => :mswin, "windows-with-sql-server-standard" => :mswinSQL, "windows-with-sql-server-web" => :mswinSQLWeb, "windows-with-sql-server-enterprise" => :mswinSQLEnterprise}
47
48
  page_targets.each_pair do |target, operating_system|
48
49
  url = "#{EC2_BASE_URL}ri-v2/#{target}-shared.min.js"
49
50
  fetch_ec2_instance_pricing_ri_v2(url, operating_system)
@@ -8,5 +8,5 @@
8
8
  # Home:: http://github.com/CloudHealth/amazon-pricing
9
9
  #++
10
10
  module AwsPricing
11
- VERSION = '0.1.69'
11
+ VERSION = '0.1.70'
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.69
4
+ version: 0.1.70
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-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby library for retrieving pricing for Amazon Web Services
14
14
  email: