customerio 4.2.0 → 4.3.1

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: e58bba756887e5c3ae6e7aa75b3e2c5bd08fc5733d45ee513b56895e35b58011
4
- data.tar.gz: 912374a003fe636fc5837cbf030a64141218f83b63fb9e455efa033375a2a8bb
3
+ metadata.gz: be14989a3ca17091869a6dc20f34341d2845fb15f8d5570b5641040edab27c39
4
+ data.tar.gz: 36e35e8ce757ccf5a93c68e86af0da4c86a4026debb8d7015246606103a42c8f
5
5
  SHA512:
6
- metadata.gz: 1529f5cc20959ce9cdbe9e4103a29f5b5205594727b8951be18d61a6851520741e52150b20b20603b7d890f62ab56c3d391d9503d6c21e99a31032085da06557
7
- data.tar.gz: '08adc273fd1d1cf2df0453788ac9c8889b8576aadf865cd9d587f029fe4de4a05b35d61dbcd845da2fdbba81b056bd7d3b92a9d7d2a3ad8800a3ad6b87ecb313'
6
+ metadata.gz: 1edc792c72b64a6141e08d8feefc41ac39541c859380c2f229cfcd958937455f71d4260c4e4828b5254c5b7d9e9cdbcc3049fdf67b7025a6566d59cc09d8864d
7
+ data.tar.gz: 29baa33725a8089a340631c9b805330a89936537eb8691fd5e70ff37e5d797f2af74d4240d2551dd196c4a911c0d37ec49300d20708cb41512e0428c19fc05e5
@@ -1,30 +1,21 @@
1
- name: ruby_ci
1
+ name: ci
2
2
 
3
3
  on: [push,pull_request]
4
4
 
5
5
  jobs:
6
- build:
6
+ test:
7
7
  strategy:
8
8
  matrix:
9
9
  ruby: ['2.5', '2.6', '2.7']
10
- runs-on: ubuntu-latest
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle
11
13
  steps:
12
14
  - uses: actions/checkout@v2
13
- - name: set up ruby
14
- uses: actions/setup-ruby@v1
15
+ - uses: ruby/setup-ruby@v1
15
16
  with:
16
17
  ruby-version: ${{ matrix.ruby }}
17
- - name: install bundle
18
- run: |
19
- sudo apt-get -yqq install libpq-dev
20
- gem install bundler
21
- - name: Cache dependencies
22
- uses: actions/cache@v2
23
- with:
24
- path: vendor/bundle
25
- key: customerio-${{ matrix.ruby }}-${{ hashFiles('customerio.gemspec') }}
26
- restore-keys: |
27
- customerio-${{ matrix.ruby }}-
28
- - name: Install dependencies
29
- run: bundle install --path vendor/bundle
30
- - run: bundle exec rspec
18
+ bundler-cache: true
19
+
20
+ - name: Unit Test w/ RSpec
21
+ run: bundle exec rspec
data/.gitpod.yml ADDED
@@ -0,0 +1,10 @@
1
+ tasks:
2
+ - init: |
3
+ bundle config set --local path 'vendor/bundle'
4
+ bundle install
5
+
6
+ vscode:
7
+ extensions:
8
+ - connorshea.vscode-ruby-test-adapter
9
+ - hbenl.vscode-test-explorer
10
+ - hbenl.test-adapter-converter
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,11 @@
1
+ ## Customerio 4.3.1 - January 5, 2023
2
+ ### Added
3
+ - Added the `disable_css_preprocessing` and `language` optional fields to send request
4
+
5
+ ## Customerio 4.3.0 - April 26, 2022
6
+ ### Added
7
+ - Support for [anonymous invite events](https://customer.io/docs/anonymous-invite-emails/) by setting `anonymous_id` to `nil`.
8
+
1
9
  ## Customerio 4.1.0 - Sep 27, 2021
2
10
  ### Added
3
11
  - Added support for [merge customers](https://customer.io/docs/api/#operation/merge) API
data/README.md CHANGED
@@ -1,9 +1,16 @@
1
- # Customerio
1
+ <p align="center">
2
+ <a href="https://customer.io">
3
+ <img src="https://files.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LSFjPaMQn1zKdYh6i89%2F-LU6OglGKqQfqMd5Zl-V%2F-LU6OzOLnOvy8VLwfgdg%2FLogo-Color-Horizontal.png?alt=media&token=add29dd0-cabb-4440-b46b-aed21350ae90" height="60">
4
+ </a>
5
+ <p align="center">Power automated communication that people like to receive.</p>
6
+ </p>
2
7
 
3
- A ruby client for the [Customer.io](http://customer.io) [event API](http://learn.customer.io/api/).
8
+ [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blueviolet?logo=gitpod)](https://gitpod.io/#https://github.com/customerio/customerio-ruby/)
9
+ [![ci](https://github.com/customerio/customerio-ruby/actions/workflows/main.yml/badge.svg)](https://github.com/customerio/customerio-ruby/actions/workflows/main.yml)
4
10
 
5
- [![Build Status](https://secure.travis-ci.org/customerio/customerio-ruby.png?branch=master)](http://travis-ci.org/customerio/customerio-ruby)
6
- [![Code Climate](https://codeclimate.com/github/customerio/customerio-ruby/badges/gpa.svg)](https://codeclimate.com/github/customerio/customerio-ruby)
11
+ # Customer.io Ruby
12
+
13
+ A ruby client for the [Customer.io Track API](https://customer.io/docs/api/#tag/trackOverview).
7
14
 
8
15
  ## Installation
9
16
 
@@ -24,7 +31,7 @@ Or install it yourself:
24
31
  ### Before we get started: API client vs. JavaScript snippet
25
32
 
26
33
  It's helpful to know that everything below can also be accomplished
27
- through the [Customer.io JavaScript snippet](http://learn.customer.io/developer-documentation/javascript-quick-start.html).
34
+ through the [Customer.io JavaScript snippet](https://customer.io/docs/javascript-quick-start/).
28
35
 
29
36
  In many cases, using the JavaScript snippet will be easier to integrate with
30
37
  your app, but there are several reasons why using the API client is useful:
@@ -38,7 +45,7 @@ your app, but there are several reasons why using the API client is useful:
38
45
 
39
46
  In the end, the decision on whether or not to use the API client or
40
47
  the JavaScript snippet should be based on what works best for you.
41
- You'll be able to integrate **fully** with [Customer.io](http://customer.io) with either approach.
48
+ You'll be able to integrate **fully** with [Customer.io](https://customer.io) with either approach.
42
49
 
43
50
  ### Setup
44
51
 
@@ -54,9 +61,9 @@ $customerio = Customerio::Client.new("YOUR SITE ID", "YOUR API SECRET KEY", regi
54
61
 
55
62
  ### Identify logged in customers
56
63
 
57
- Tracking data of logged in customers is a key part of [Customer.io](http://customer.io). In order to
64
+ Tracking data of logged in customers is a key part of [Customer.io](https://customer.io). In order to
58
65
  send triggered emails, we must know the email address of the customer. You can
59
- also specify any number of customer attributes which help tailor [Customer.io](http://customer.io) to your
66
+ also specify any number of customer attributes which help tailor [Customer.io](https://customer.io) to your
60
67
  business.
61
68
 
62
69
  Attributes you specify are useful in several ways:
@@ -71,7 +78,7 @@ set up triggers which are only sent to customers who have subscribed to a
71
78
  particular plan (e.g. "premium").
72
79
 
73
80
  You'll want to indentify your customers when they sign up for your app and any time their
74
- key information changes. This keeps [Customer.io](http://customer.io) up to date with your customer information.
81
+ key information changes. This keeps [Customer.io](https://customer.io) up to date with your customer information.
75
82
 
76
83
  ```ruby
77
84
  # Arguments
@@ -121,7 +128,7 @@ $customerio.merge_customers("email", "cool.person@company.com", "email", "cperso
121
128
 
122
129
  ### Tracking a custom event
123
130
 
124
- Now that you're identifying your customers with [Customer.io](http://customer.io), you can now send events like
131
+ Now that you're identifying your customers with [Customer.io](https://customer.io), you can now send events like
125
132
  "purchased" or "watchedIntroVideo". These allow you to more specifically target your users
126
133
  with automated emails, and track conversions when you're sending automated emails to
127
134
  encourage your customers to perform an action.
@@ -152,15 +159,22 @@ Anonymous events cannot trigger campaigns by themselves. To trigger a campaign,
152
159
 
153
160
  ```ruby
154
161
  # Arguments
155
- # anonymous_id (required) - the id representing the unknown person.
156
- # name (required) - the name of the event you want to track.
157
- # attributes (optional) - any related information you want to attach to the
158
- # event.
162
+ # anonymous_id (required, nullable) - the id representing the unknown person.
163
+ # name (required) - the name of the event you want to track.
164
+ # attributes (optional) - related information you want to attach to the event.
159
165
 
160
166
  $customerio.track_anonymous(anonymous_id, "product_view", :type => "socks" )
161
167
  ```
162
168
 
163
- Use the `recipient` attribute to specify the email address to send the messages to. [See our documentation on how to use anonymous events for more details](https://learn.customer.io/recipes/invite-emails.html).
169
+ Use the `recipient` attribute to specify the email address to send the messages to. [See our documentation on how to use anonymous events for more details](https://customer.io/docs/invite-emails/).
170
+
171
+ #### Anonymous invite events
172
+
173
+ If you previously sent [invite events](https://customer.io/docs/anonymous-invite-emails/), you can achieve the same functionality by sending an anonymous event with `nil` for the anonymous identifier. To send anonymous invites, your event *must* include a `recipient` attribute.
174
+
175
+ ```ruby
176
+ $customerio.track_anonymous(nil, "invite", :recipient => "new.person@example.com" )
177
+ ```
164
178
 
165
179
  ### Adding a mobile device
166
180
 
@@ -187,7 +201,7 @@ $customerio.delete_device(5, "my_device_token")
187
201
 
188
202
  ### Suppress a user
189
203
 
190
- Deletes the customer with the provided id if it exists and suppresses all future events and identifies for for that customer.
204
+ Deletes the customer with the provided id if it exists and suppresses all future events and identifies for that customer.
191
205
 
192
206
  ```ruby
193
207
  $customerio.suppress(5)
data/customerio.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency('addressable', '~> 2.8.0')
21
21
 
22
22
  gem.add_development_dependency('rake', '~> 10.5')
23
- gem.add_development_dependency('rspec', '3.3.0')
23
+ gem.add_development_dependency('rspec', '~> 3.10')
24
24
  gem.add_development_dependency('webmock', '3.6.0')
25
25
  gem.add_development_dependency('json')
26
26
  end
@@ -52,7 +52,6 @@ module Customerio
52
52
  end
53
53
 
54
54
  def track_anonymous(anonymous_id, event_name, attributes = {})
55
- raise ParamError.new("anonymous_id must be a non-empty string") if is_empty?(anonymous_id)
56
55
  raise ParamError.new("event_name must be a non-empty string") if is_empty?(event_name)
57
56
 
58
57
  create_anonymous_event(anonymous_id, event_name, attributes)
@@ -171,7 +170,7 @@ module Customerio
171
170
  def create_event(url:, event_name:, anonymous_id: nil, attributes: {})
172
171
  body = { :name => event_name, :data => attributes }
173
172
  body[:timestamp] = attributes[:timestamp] if valid_timestamp?(attributes[:timestamp])
174
- body[:anonymous_id] = anonymous_id unless anonymous_id.nil?
173
+ body[:anonymous_id] = anonymous_id unless is_empty?(anonymous_id)
175
174
 
176
175
  @client.request_and_verify_response(:post, url, body)
177
176
  end
@@ -36,6 +36,9 @@ module Customerio
36
36
  send_to_unsubscribed
37
37
  tracked
38
38
  queue_draft
39
+ disable_css_preprocessing
40
+ send_at
41
+ language
39
42
  )
40
43
 
41
44
  def invalid_field?(field)
@@ -1,3 +1,3 @@
1
1
  module Customerio
2
- VERSION = "4.2.0"
2
+ VERSION = "4.3.1"
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -433,12 +433,20 @@ describe Customerio::Client do
433
433
  lambda { client.track_anonymous(anon_id, "purchase") }.should raise_error(Customerio::InvalidResponse)
434
434
  end
435
435
 
436
- it "throws an error when anonymous_id is missing" do
436
+ it "doesn't pass along anonymous_id if it is blank" do
437
437
  stub_request(:post, api_uri('/api/v1/events')).
438
- with(body: { anonymous_id: anon_id, name: "purchase", data: {} }).
439
- to_return(status: 500, body: "", headers: {})
438
+ with(body: { name: "some_event", data: {} }).
439
+ to_return(status: 200, body: "", headers: {})
440
+
441
+ client.track_anonymous("", "some_event")
442
+ end
443
+
444
+ it "doesn't pass along anonymous_id if it is nil" do
445
+ stub_request(:post, api_uri('/api/v1/events')).
446
+ with(body: { name: "some_event", data: {} }).
447
+ to_return(status: 200, body: "", headers: {})
440
448
 
441
- lambda { client.track_anonymous("", "some_event") }.should raise_error(Customerio::Client::ParamError)
449
+ client.track_anonymous(nil, "some_event")
442
450
  end
443
451
 
444
452
  it "throws an error when event_name is missing" do
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.2.0
4
+ version: 4.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Allison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2023-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.3.0
61
+ version: '3.10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 3.3.0
68
+ version: '3.10'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".github/workflows/main.yml"
105
105
  - ".gitignore"
106
+ - ".gitpod.yml"
106
107
  - CHANGELOG.markdown
107
108
  - Gemfile
108
109
  - LICENSE
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  - !ruby/object:Gem::Version
141
142
  version: '0'
142
143
  requirements: []
143
- rubygems_version: 3.0.3
144
+ rubygems_version: 3.3.5
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: A ruby client for the Customer.io event API.