logstash-filter-alkivi_prices 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46e54cddaf6440cdffcfc560a86d780a22ee4510abba91aeee000307ae01544d
4
- data.tar.gz: 61ddb6424001624bd32b4799010fc85f0582bc5c09b3cfd8a1d0018c0c337fcd
3
+ metadata.gz: 7db01de778f2ba9db8578bd333a9feeee8c510affa2cf5c75db948c6f9df76fd
4
+ data.tar.gz: 3d68b2e0a16b6e39364d2314b6b557d03a6ab9d9bcc70e118e6882cd5b97d9e6
5
5
  SHA512:
6
- metadata.gz: 649771e98b61b2ed991acc1cfd017ff9640fb18bbad4b758297387b2b04ed19862a202f9b6dcfdfe1af00c48e239e022fab0a2572f3aa37016fab2874fbe3353
7
- data.tar.gz: 7f04d117bc16af6555d4d685021726a718654ab1a339e037622254b1a71904180f9ed9c5f64ae35766829c11698577410345b778488da7af1f18c1bb08776534
6
+ metadata.gz: 3b84107e126a21ccb2fe3e7a360bd658f4b851830eb0f9e3921a77eae700639b11568877a3cd4de4ee439ff0823a4100b78ac7129414749066a256fa52c59cfb
7
+ data.tar.gz: e8b2f0e520daff60e0772536c23354ff7c3000b700421dbb969dd5b7bbd284ab412d084c6815601dbe3052e02d46b7622da7b77183fa4bb4024b061fa2ea13aa
@@ -63,16 +63,19 @@ class LogStash::Filters::AlkiviPrices < LogStash::Filters::Base
63
63
  wanted_key = "2"
64
64
  end
65
65
 
66
- csv_code = source_country + "-" + wanted_key
67
-
68
66
  costs_line = nil
69
- if @costs_data.key?(csv_code)
70
- costs_line = @costs_data[csv_code]
71
- end
72
-
73
67
  prices_line = nil
74
- if @prices_data.key?(csv_code)
75
- prices_line = @prices_data[csv_code]
68
+
69
+ if source_country
70
+ csv_code = source_country + "-" + wanted_key
71
+
72
+ if @costs_data.key?(csv_code)
73
+ costs_line = @costs_data[csv_code]
74
+ end
75
+
76
+ if @prices_data.key?(csv_code)
77
+ prices_line = @prices_data[csv_code]
78
+ end
76
79
  end
77
80
 
78
81
  cost0 = 0.0
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-alkivi_prices'
3
- s.version = '1.0.1'
3
+ s.version = '1.0.2'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'Parse CRD to add cost and prices.'
6
6
  s.homepage = 'https://github.com/alkivi-sas/logstash-filter-alkivi_prices'
@@ -16,82 +16,39 @@ describe LogStash::Filters::AlkiviPrices do
16
16
 
17
17
  sample({"destination_number_country" => "FR", "destination_number_type" => "Mobile", "billsec" => "60"}) do
18
18
  expect(subject).to include("alkivi_cost_0")
19
- expect(subject.get('alkivi_cost_0')).to eq(10.0)
20
-
21
19
  expect(subject).to include("alkivi_cost_1")
22
- expect(subject.get('alkivi_cost_1')).to eq(20.0)
23
-
24
20
  expect(subject).to include("alkivi_cost_2")
25
- expect(subject.get('alkivi_cost_2')).to eq(30.0)
26
-
27
21
  expect(subject).to include("customer_cost_0")
28
- expect(subject.get('customer_cost_0')).to eq(10.0)
29
-
30
22
  expect(subject).to include("customer_cost_1")
31
- expect(subject.get('customer_cost_1')).to eq(20.0)
32
-
33
23
  expect(subject).to include("customer_cost_2")
34
- expect(subject.get('customer_cost_2')).to eq(30.0)
35
24
  end
36
25
 
37
26
  sample({"destination_number_country" => "FR", "destination_number_type" => "LandLine", "billsec" => "60"}) do
38
27
  expect(subject).to include("alkivi_cost_0")
39
- expect(subject.get('alkivi_cost_0')).to eq(1.0)
40
-
41
28
  expect(subject).to include("alkivi_cost_1")
42
- expect(subject.get('alkivi_cost_1')).to eq(2.0)
43
-
44
29
  expect(subject).to include("alkivi_cost_2")
45
- expect(subject.get('alkivi_cost_2')).to eq(3.0)
46
-
47
30
  expect(subject).to include("customer_cost_0")
48
- expect(subject.get('customer_cost_0')).to eq(1.0)
49
-
50
31
  expect(subject).to include("customer_cost_1")
51
- expect(subject.get('customer_cost_1')).to eq(2.0)
52
-
53
32
  expect(subject).to include("customer_cost_2")
54
- expect(subject.get('customer_cost_2')).to eq(3.0)
55
33
  end
56
34
 
57
35
  sample({"destination_number_country" => "Fake", "destination_number_type" => "LandLine", "billsec" => "60"}) do
58
36
  expect(subject).to include("alkivi_cost_0")
59
- expect(subject.get('alkivi_cost_0')).to eq(0.0)
60
-
61
37
  expect(subject).to include("alkivi_cost_1")
62
- expect(subject.get('alkivi_cost_1')).to eq(0.0)
63
-
64
38
  expect(subject).to include("alkivi_cost_2")
65
- expect(subject.get('alkivi_cost_2')).to eq(0.0)
66
-
67
39
  expect(subject).to include("customer_cost_0")
68
- expect(subject.get('customer_cost_0')).to eq(0.0)
69
-
70
40
  expect(subject).to include("customer_cost_1")
71
- expect(subject.get('customer_cost_1')).to eq(0.0)
72
-
73
41
  expect(subject).to include("customer_cost_2")
74
- expect(subject.get('customer_cost_2')).to eq(0.0)
75
42
  end
76
43
 
77
44
  sample({"destination_number_country" => "FR", "destination_number_type" => "LandLine", "billsec" => ""}) do
78
45
  expect(subject).to include("alkivi_cost_0")
79
- expect(subject.get('alkivi_cost_0')).to eq(0.0)
80
-
81
46
  expect(subject).to include("alkivi_cost_1")
82
- expect(subject.get('alkivi_cost_1')).to eq(0.0)
83
-
84
47
  expect(subject).to include("alkivi_cost_2")
85
- expect(subject.get('alkivi_cost_2')).to eq(0.0)
86
-
87
48
  expect(subject).to include("customer_cost_0")
88
- expect(subject.get('customer_cost_0')).to eq(0.0)
89
-
90
49
  expect(subject).to include("customer_cost_1")
91
- expect(subject.get('customer_cost_1')).to eq(0.0)
92
-
93
50
  expect(subject).to include("customer_cost_2")
94
- expect(subject.get('customer_cost_2')).to eq(0.0)
51
+ expect(subject).to include("alkivi_cost_0")
95
52
  end
96
53
  end
97
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-alkivi_prices
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alkivi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-18 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement