fluent-plugin-amplitude 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 269720e5fb9a25129b61a720c5730c4fe0ebd6b1
4
- data.tar.gz: 37b6a8bbba072c7ec877097cc2975ace8bfaf281
3
+ metadata.gz: 87356ba6323e223e3ce8b3b34424a1f942d2ee58
4
+ data.tar.gz: 5f4552341e234469911d09c064d692d6851da300
5
5
  SHA512:
6
- metadata.gz: 98be3d4367705664da866e9c964a39bed8d1e19849839c10c006b6652987c4ec93a19212149bac2f6f6161d8a8766c5852cb9c3ff2110cd0bbcf1b843e42ff21
7
- data.tar.gz: 89e3919f449e4256e99528b6b8a032ea0e0f252a4bffe91d05e67fe3e5df3afe22c85ec9e3a8cd42c19238022c8dae7f5ccc983a6fb3dd95656c6e3d54d02ae0
6
+ metadata.gz: 7afeee3c37fe492271e6db7d04caff6d59277c30f65fac72f24b2427b2085390578e59d80a15f0c0e15f1d5cf5f4f49194e6a43a99aaf4ac05d2198bb443d931
7
+ data.tar.gz: 056333c1581a72a259ff89e42c9bc9c3ec77d2e7e227bebef478eafd2a6ecc388d47b5d60beed25a876c97c3bd769d92d425f22c52b0a2cd6dba0f46a56b0fd2
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'fluent-plugin-amplitude'
7
- spec.version = '0.0.7'
7
+ spec.version = '0.0.8'
8
8
  spec.authors = ['Vijay Ramesh']
9
9
  spec.email = ['vijay@change.org']
10
10
  spec.summary = 'Fluentd plugin to output event data to Amplitude'
@@ -54,9 +54,11 @@ module Fluent
54
54
  next if @events_whitelist && !@events_whitelist.include?(tag)
55
55
  next if @events_blacklist && @events_blacklist.include?(tag)
56
56
  record = simple_symbolize_keys(record)
57
- verify_user_and_device_or_fail(record)
58
-
59
- records << AmplitudeAPI::Event.new(record)
57
+ if verify_user_and_device(record)
58
+ records << AmplitudeAPI::Event.new(record)
59
+ else
60
+ log.info("Error: either user_id or device_id must be set for tag #{tag}")
61
+ end
60
62
  end
61
63
 
62
64
  send_to_amplitude(records) unless records.empty?
@@ -88,11 +90,10 @@ module Fluent
88
90
  end
89
91
  end
90
92
 
91
- def verify_user_and_device_or_fail(amplitude_hash)
93
+ def verify_user_and_device(amplitude_hash)
92
94
  user_id = amplitude_hash[:user_id]
93
95
  device_id = amplitude_hash[:device_id]
94
- return if present?(user_id) || present?(device_id)
95
- raise AmplitudeError, 'Error: either user_id or device_id must be set'
96
+ return present?(user_id) || present?(device_id)
96
97
  end
97
98
 
98
99
  def extract_user_properties!(amplitude_hash, record)
@@ -137,10 +137,9 @@ describe Fluent::AmplitudeOutput do
137
137
  'recruiter_id' => 710
138
138
  }
139
139
  end
140
- it 'raises a Fluent::AmplitudeOutput::AmplitudeError' do
141
- expect { amplitude.run }.to raise_error(
142
- Fluent::AmplitudeOutput::AmplitudeError
143
- )
140
+ it 'does not track the event' do
141
+ expect(AmplitudeAPI).to_not receive(:track)
142
+ amplitude.run
144
143
  end
145
144
  end
146
145
 
@@ -156,10 +155,9 @@ describe Fluent::AmplitudeOutput do
156
155
  'recruiter_id' => 710
157
156
  }
158
157
  end
159
- it 'raises a Fluent::AmplitudeOutput::AmplitudeError' do
160
- expect { amplitude.run }.to raise_error(
161
- Fluent::AmplitudeOutput::AmplitudeError
162
- )
158
+ it 'does not track the event' do
159
+ expect(AmplitudeAPI).to_not receive(:track)
160
+ amplitude.run
163
161
  end
164
162
  end
165
163
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-amplitude
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vijay Ramesh