sasswillio 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sasswillio/formatter.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed8776bd99b624f0b72a7496031ec59444c2dbf69fb173b001a7fb87d9306985
|
4
|
+
data.tar.gz: c41657faff94c61927c77dbe268d48f66c54f412909ec4fd7e9c57a9b66d9893
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa2aa47605e86bf1f6b73ac9e2720e89c622876cb86e68ebfe5a764b14e6bc27e3ed32e0b7b8f6b5a14ef713ee9d4d3431708194e1339e962a7dea3913428f2c
|
7
|
+
data.tar.gz: fbe16687c5d1f91d626d39584889663f3ae788cb38ad3c0df06fcc45fbd45ddd1242203c368d86c036b0bb696790926e566333869e5fa55a363263c561b1cdfd
|
data/lib/sasswillio/formatter.rb
CHANGED
@@ -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
|
-
|
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 {
|