customerio 4.3.1 → 4.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/customerio/client.rb +18 -1
- data/lib/customerio/version.rb +1 -1
- data/spec/client_spec.rb +10 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947def68a84acd663f4362c5e7a1f91a97513577afa4bd020893995b1df9bb6a
|
4
|
+
data.tar.gz: 0fe78c73a651622d973f57ffd03fe5f19422d217f9430ba562a206e2f1bc5772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d0420f641bbc2f17e430d2b628d0d7d6b0f6d7cbd91e01b5c721c5dbd355c9494d04cd6c8c705e78cc54c70209948a943dcf7acfc62d7db7b342c2d57d2f35
|
7
|
+
data.tar.gz: c015c539613a2fc63b2612cd59069a1b7fc28a760ae20c45f875c285a5cb9d810f42d5acc6ea1e5dfb2dec44da2cf3b079c3e85814aeee58b67a3bd53ddd3255
|
data/lib/customerio/client.rb
CHANGED
@@ -51,6 +51,13 @@ module Customerio
|
|
51
51
|
create_customer_event(customer_id, event_name, attributes)
|
52
52
|
end
|
53
53
|
|
54
|
+
def pageview(customer_id, page, attributes = {})
|
55
|
+
raise ParamError.new("customer_id must be a non-empty string") if is_empty?(customer_id)
|
56
|
+
raise ParamError.new("page must be a non-empty string") if is_empty?(page)
|
57
|
+
|
58
|
+
create_pageview_event(customer_id, page, attributes)
|
59
|
+
end
|
60
|
+
|
54
61
|
def track_anonymous(anonymous_id, event_name, attributes = {})
|
55
62
|
raise ParamError.new("event_name must be a non-empty string") if is_empty?(event_name)
|
56
63
|
|
@@ -167,10 +174,20 @@ module Customerio
|
|
167
174
|
)
|
168
175
|
end
|
169
176
|
|
170
|
-
def
|
177
|
+
def create_pageview_event(customer_id, page, attributes = {})
|
178
|
+
create_event(
|
179
|
+
url: "#{customer_path(customer_id)}/events",
|
180
|
+
event_type: "page",
|
181
|
+
event_name: page,
|
182
|
+
attributes: attributes
|
183
|
+
)
|
184
|
+
end
|
185
|
+
|
186
|
+
def create_event(url:, event_name:, anonymous_id: nil, event_type: nil, attributes: {})
|
171
187
|
body = { :name => event_name, :data => attributes }
|
172
188
|
body[:timestamp] = attributes[:timestamp] if valid_timestamp?(attributes[:timestamp])
|
173
189
|
body[:anonymous_id] = anonymous_id unless is_empty?(anonymous_id)
|
190
|
+
body[:type] = event_type unless is_empty?(event_type)
|
174
191
|
|
175
192
|
@client.request_and_verify_response(:post, url, body)
|
176
193
|
end
|
data/lib/customerio/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -240,6 +240,16 @@ describe Customerio::Client do
|
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
+
describe "#pageview" do
|
244
|
+
it "allows sending pageview event" do
|
245
|
+
stub_request(:post, api_uri('/api/v1/customers/5/events')).
|
246
|
+
with(body: json(name: "http://customer.io", data: {}, type: "page")).
|
247
|
+
to_return(status: 200, body: "", headers: {})
|
248
|
+
|
249
|
+
client.pageview(5, "http://customer.io")
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
243
253
|
describe "#track" do
|
244
254
|
it "raises an error if POST doesn't return a 2xx response code" do
|
245
255
|
stub_request(:post, api_uri('/api/v1/customers/5/events')).
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: customerio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Allison
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -126,7 +126,7 @@ homepage: http://customer.io
|
|
126
126
|
licenses:
|
127
127
|
- MIT
|
128
128
|
metadata: {}
|
129
|
-
post_install_message:
|
129
|
+
post_install_message:
|
130
130
|
rdoc_options: []
|
131
131
|
require_paths:
|
132
132
|
- lib
|
@@ -141,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.3.
|
145
|
-
signing_key:
|
144
|
+
rubygems_version: 3.3.7
|
145
|
+
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: A ruby client for the Customer.io event API.
|
148
148
|
test_files:
|