sasswillio 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sasswillio/formatter.rb +7 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62ecfe02406c1d26cca5b1bd1da9c3cfc865d17083482f05dc73b5525d828d00
4
- data.tar.gz: 3fab714e4e5ac29fa5e0cf142d36b54a85e9a8b0b4d818f91b1df4d66c4fa0c1
3
+ metadata.gz: ed8776bd99b624f0b72a7496031ec59444c2dbf69fb173b001a7fb87d9306985
4
+ data.tar.gz: c41657faff94c61927c77dbe268d48f66c54f412909ec4fd7e9c57a9b66d9893
5
5
  SHA512:
6
- metadata.gz: cad481e00b9b159757a7c09fa4ab2891b9258f184d700728699f1a79f4775bf809b368e3bd5bda8ff4dc6838f73bc5f383fc86774a38ef1103953bbe8d87c819
7
- data.tar.gz: d826f52fadb90598f8d36fc400eee0a78c95185d78e7090255cc69ea131331749bbbe07d5f418642202814aa5725db846b41309625cd86a796313db616507fad
6
+ metadata.gz: aa2aa47605e86bf1f6b73ac9e2720e89c622876cb86e68ebfe5a764b14e6bc27e3ed32e0b7b8f6b5a14ef713ee9d4d3431708194e1339e962a7dea3913428f2c
7
+ data.tar.gz: fbe16687c5d1f91d626d39584889663f3ae788cb38ad3c0df06fcc45fbd45ddd1242203c368d86c036b0bb696790926e566333869e5fa55a363263c561b1cdfd
@@ -6,8 +6,14 @@ module Formatter
6
6
  transformed_key_for_inbound = type + '_inbound'
7
7
  transformed_key_for_outbound = type + '_outbound_average'
8
8
  pricing_hash[transformed_key_for_inbound.to_sym] = twilio_sms_pricing_res.inbound_sms_prices.find{|n| n["number_type"] == type}
9
- pricing_hash[transformed_key_for_outbound.to_sym] = twilio_sms_pricing_res.outbound_sms_prices.map{|n| n["prices"].find{|i| i["number_type"] == type}}.compact.map{|n| n["current_price"].to_f}.inject{|sum, el| sum+el} / twilio_sms_pricing_res.outbound_sms_prices.size
9
+ numerator = twilio_sms_pricing_res.outbound_sms_prices.map{|n| n["prices"].find{|i| i["number_type"] == type}}.compact.map{|n| n["current_price"].to_f}.inject{|sum, el| sum+el}
10
+ if numerator && numerator > 0
11
+ pricing_hash[transformed_key_for_outbound.to_sym] = numerator / twilio_sms_pricing_res.outbound_sms_prices.size
12
+ else
13
+ pricing_hash[transformed_key_for_outbound.to_sym] = nil
14
+ end
10
15
  end
16
+
11
17
  local_price_inbound = twilio_sms_pricing_res.inbound_sms_prices.find{|n| n["number_type"] == 'local'}
12
18
  local_price_outbound = twilio_sms_pricing_res.outbound_sms_prices.map{|n| n["prices"].find{|i| i["number_type"] == 'local'}}.compact
13
19
  return {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sasswillio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shashike J