customerio 4.3.1 → 5.0.0
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 +4 -4
- data/lib/customerio/client.rb +18 -1
- data/lib/customerio/requests/send_email_request.rb +2 -2
- data/lib/customerio/version.rb +1 -1
- data/spec/client_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 558909b4f1cd8c6701f8c8fcce3796ab9d7321eb19038514ac9432f728035104
|
4
|
+
data.tar.gz: 5787b196ae97f8ded6122dbe83ccc9f9d363b86181b4e2144595a13b1772111b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8105a2cd41265da49055b42e9eff7db0c0548d930a4a91871edd2458db2c0389e5c5a2e095e79f1fd453994a55614c6f621960d30ab36d5c31e2cb5fc552a6b1
|
7
|
+
data.tar.gz: 74eef21394ff63ce7305a5241e23a4a74248e12a7486f268280d74bc72d8b50ec1bdf8b72717ade273b6d4dcb7d152bb49d8861c16bce5d5385eb743c899b65a
|
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
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Allison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -141,7 +141,7 @@ 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.
|
144
|
+
rubygems_version: 3.0.3.1
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: A ruby client for the Customer.io event API.
|