pigeon-ruby 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 764331941b2b481ac372d7b60002dad9fd41c23f6cd97acaa531b3fd1a160a07
4
- data.tar.gz: cb66b45eeef4360138b8b1712ea7ee0f56e222db1e6803ae5a87b22c5fbd4b49
3
+ metadata.gz: 2a9a2678d81260c13511d316d65e8329db941560aa61f98f975e9a2f15f71423
4
+ data.tar.gz: faf2d663ddb2a65ce0aea4f164d61a8481dd36c22c75dae393442d05e03aedbb
5
5
  SHA512:
6
- metadata.gz: 2105b726d91909cbc42b4ac18e5810540765d19e20ab2d917823374c6b41e468731a1a6591f878b73969967fe316f3a4fb4e2644190af5a54a17abefe33badae
7
- data.tar.gz: aaaaa4319df6809366de6cd085f1722136332f11a86dacdb8192f05c7eaa129b112a664136b1e4a58a0a6a7427b37e43f5db7c2c3e02118f379d8e255c91cd73
6
+ metadata.gz: 43922cc24d5bcab34ac867d878266805dfd6c4e1300d9d66ce8f06dd31b20fe0b25022093e488de1b506084a7f5a9c7ec2c1fed8d25185a71f85d23b424a7fed
7
+ data.tar.gz: f2a210f69b5d92cc08c8143e9f444ddf39ccb3e6126748646f96b5e019791302c71130d52f2343b9ea3d1823141c1ceb96dffe7cedfc4629cb59fe9bc6127132
@@ -25,12 +25,9 @@ module Pigeon
25
25
  })
26
26
  end
27
27
 
28
- def track(event, data = {})
28
+ def track(attrs = {})
29
29
  self.class.post('/event_logs', {
30
- body: {
31
- event: event,
32
- data: data
33
- }
30
+ body: process_track_attributes(attrs)
34
31
  })
35
32
  end
36
33
 
@@ -78,10 +75,22 @@ module Pigeon
78
75
  attachment.delete(:file)
79
76
  end
80
77
 
78
+ def process_track_attributes(attrs)
79
+ symbolize_keys! attrs
80
+
81
+ check_presence!(attrs[:event], 'Event')
82
+ check_presence!(attrs[:customer_uid], 'Customer UID')
83
+
84
+ data = attrs[:data] || {}
85
+ raise ArgumentError, 'data must be a Hash' if !data.is_a? Hash
86
+
87
+ attrs
88
+ end
89
+
81
90
  def process_identify_attributes(attrs)
82
91
  symbolize_keys! attrs
83
- extras = attrs[:extras] || {}
84
92
 
93
+ extras = attrs[:extras] || {}
85
94
  raise ArgumentError, 'Extras must be a Hash' if !extras.is_a? Hash
86
95
 
87
96
  if !attrs[:uid] && !attrs[:anonymous_uid]
@@ -1,3 +1,3 @@
1
1
  module Pigeon
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
data/lib/pigeon-ruby.rb CHANGED
@@ -15,7 +15,7 @@ module Pigeon
15
15
  @clients[:default].deliver(message_identifier, attrs)
16
16
  end
17
17
 
18
- def self.track(event, data)
18
+ def self.track(attrs = {})
19
19
  @clients[:default].track(event, data)
20
20
  end
21
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigeon-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pradeep Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-25 00:00:00.000000000 Z
11
+ date: 2019-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler