iterable-api-client 0.4.0 → 0.5.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
- checksums.yaml.gz.sig +0 -0
- data/README.md +77 -4
- data/lib/iterable/events.rb +13 -0
- data/lib/iterable/in_app.rb +36 -0
- data/lib/iterable/push.rb +46 -0
- data/lib/iterable.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +21 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 003ee817aaa95dc181bf7b36909387689f70ffa1ed755878eb7132a0166b0130
|
4
|
+
data.tar.gz: 3ab136966f544fc25f2431d39a99ac84e94cf5f88c1d496f1dd7b4bd2e45cff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3696c057360e661ee4f632182323a9d99a8af4110be64fce1d1dfd58980c9a13d65dc1b0767df53f17502925526949e1fc17aadc980a4b654479a34a65009bc
|
7
|
+
data.tar.gz: 874f5d7201a038ddc54437e1d0920b3c0bf77f5d5333c5ccdcd5a756e20154d0942b0920c800669e2adb8ef0d3f65a62b66644a936ed25800bf59d26bd571a93
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -124,6 +124,7 @@ reponse.uri
|
|
124
124
|
- [Upsert](#email-templates-upsert)
|
125
125
|
- [Events](#events)
|
126
126
|
- [For Email](#events-for-email)
|
127
|
+
- [Bulk Track](#events-track-bulk)
|
127
128
|
- [Track](#events-track)
|
128
129
|
- [Track Push Open](#events-track-push-open)
|
129
130
|
- [Experiments](#experiments)
|
@@ -133,6 +134,8 @@ reponse.uri
|
|
133
134
|
- [CSV](#export-csv)
|
134
135
|
- [In App](#in-app)
|
135
136
|
- [Messages](#in-app-messages)
|
137
|
+
- [Target](#in-app-target)
|
138
|
+
- [Cancel](#in-app-cancel)
|
136
139
|
- [Lists](#lists)
|
137
140
|
- [All](#lists-all)
|
138
141
|
- [Create](#lists-create)
|
@@ -149,6 +152,9 @@ reponse.uri
|
|
149
152
|
- [Get Key](#metadata-get-key)
|
150
153
|
- [Remove Key](#metadata-remove-key)
|
151
154
|
- [Add Key](#metadata-add-key)
|
155
|
+
- [Push](#push)
|
156
|
+
- [Target](#push-target)
|
157
|
+
- [Cancel](#push-cancel)
|
152
158
|
- [Push Templates](#push-templates)
|
153
159
|
- [Get](#push-templates-get)
|
154
160
|
- [Update](#push-templates-update)
|
@@ -300,7 +306,8 @@ Endpoint: `GET /catalogs/{catalogName}/fieldMappings`
|
|
300
306
|
```ruby
|
301
307
|
catalog = 'my-catalog'
|
302
308
|
catalog_field_mappings = Iterable::CatalogFieldMappings.new(catalog)
|
303
|
-
response = catalog_field_mappings.
|
309
|
+
response = catalog_field_mappings.get
|
310
|
+
response.body['params']['definedMappings']
|
304
311
|
```
|
305
312
|
|
306
313
|
#### Catalog Field Mappings Update
|
@@ -557,6 +564,19 @@ attrs = { campaignId: 42, dataFields: {} }
|
|
557
564
|
response = events.track 'event-name', 'user@example.com', attrs
|
558
565
|
```
|
559
566
|
|
567
|
+
#### Events Track Bulk
|
568
|
+
|
569
|
+
Endpoint: `POST /events/trackBulk`
|
570
|
+
|
571
|
+
```ruby
|
572
|
+
events = Iterable::Events.new
|
573
|
+
# Array of events to track
|
574
|
+
events_attrs = [
|
575
|
+
{ email: 'user@example.com', eventName: 'event-name', campaignId: 42, dataFields: {} }
|
576
|
+
]
|
577
|
+
response = iterable_events.track_bulk events_attrs
|
578
|
+
```
|
579
|
+
|
560
580
|
#### Events Track Push Open
|
561
581
|
|
562
582
|
Endpoint: `GET /events/{email}`
|
@@ -639,7 +659,34 @@ response = in_app.messages_for_user_id 42, count: 2
|
|
639
659
|
# Pass in query parameters
|
640
660
|
email = 'user@example.com'
|
641
661
|
attrs = { 'platform' => 'iOS' }
|
642
|
-
response = in_app.messages_for_email
|
662
|
+
response = in_app.messages_for_email email, attrs
|
663
|
+
```
|
664
|
+
|
665
|
+
#### In App Target
|
666
|
+
|
667
|
+
Endpoint: `POST /inApp/target`
|
668
|
+
|
669
|
+
```ruby
|
670
|
+
in_app = Iterable::InApp.new
|
671
|
+
|
672
|
+
# Needs campaign ID and an optional email
|
673
|
+
email = 'user@example.com'
|
674
|
+
attrs = { 'campaignId' => '123456asdf' }
|
675
|
+
response = in_app.target attrs: attrs, email: email
|
676
|
+
```
|
677
|
+
|
678
|
+
#### In App Cancel
|
679
|
+
|
680
|
+
Endpoint: `POST /push/cancel`
|
681
|
+
|
682
|
+
```ruby
|
683
|
+
in_app = Iterable::InApp.new
|
684
|
+
|
685
|
+
# Needs campaign ID and an optional email and optional attrs for request
|
686
|
+
email = 'user@example.com'
|
687
|
+
campaign_id = '12345asdf'
|
688
|
+
attrs = {}
|
689
|
+
response = in_app.target campaign_id: campaign_id, attrs: attrs, email: email
|
643
690
|
```
|
644
691
|
|
645
692
|
### Lists
|
@@ -776,6 +823,32 @@ value = { foo: 'bar', data: 'stuffs' }
|
|
776
823
|
response = metadata_table.add 'metadata-key', value
|
777
824
|
```
|
778
825
|
|
826
|
+
### Push
|
827
|
+
|
828
|
+
#### Push Target
|
829
|
+
|
830
|
+
Endpoint: `POST /push/target`
|
831
|
+
|
832
|
+
```ruby
|
833
|
+
push = Iterable::Push.new
|
834
|
+
campaign_id = '1234asdf'
|
835
|
+
email = 'user@example.com' # optional
|
836
|
+
attrs = {} # optional extra params for the request
|
837
|
+
response = push.target campaign_id: campaign_id, email: email, attrs: attrs
|
838
|
+
```
|
839
|
+
|
840
|
+
#### Push Cancel
|
841
|
+
|
842
|
+
Endpoint: `POST /push/cancel`
|
843
|
+
|
844
|
+
```ruby
|
845
|
+
push = Iterable::Push.new
|
846
|
+
campaign_id = '1234asdf'
|
847
|
+
email = 'user@example.com' # optional
|
848
|
+
attrs = {} # optional extra params for the request
|
849
|
+
response = push.cancel email: email, campaign_id: campaign_id, attrs: attrs
|
850
|
+
```
|
851
|
+
|
779
852
|
### Push Templates
|
780
853
|
|
781
854
|
#### Push Templates Get
|
@@ -854,10 +927,10 @@ Endpoint: `POST /users/bulkUpdate`
|
|
854
927
|
users = Iterable::Users.new
|
855
928
|
# Array of users to update by email with additional
|
856
929
|
# fields if needed
|
857
|
-
|
930
|
+
users_attrs = [
|
858
931
|
{ email: 'user@example.com', userID: 'custom-id' }
|
859
932
|
]
|
860
|
-
response = users.bulk_update
|
933
|
+
response = users.bulk_update users_attrs
|
861
934
|
```
|
862
935
|
|
863
936
|
#### Users Update Subscriptions
|
data/lib/iterable/events.rb
CHANGED
@@ -39,6 +39,19 @@ module Iterable
|
|
39
39
|
Iterable.request(conf, '/events/track').post(attrs)
|
40
40
|
end
|
41
41
|
|
42
|
+
##
|
43
|
+
#
|
44
|
+
# Bulk Track events
|
45
|
+
#
|
46
|
+
# @param events [Array[Hash]] Array of hashes of event details
|
47
|
+
#
|
48
|
+
# @return [Iterable::Response] A response object
|
49
|
+
#
|
50
|
+
# @note Event fields can be eventName [String], email [String], dataFields [Hash], or userId [String]
|
51
|
+
def track_bulk(events = [])
|
52
|
+
Iterable.request(conf, '/events/trackBulk').post(events: events)
|
53
|
+
end
|
54
|
+
|
42
55
|
##
|
43
56
|
#
|
44
57
|
# Track an event
|
data/lib/iterable/in_app.rb
CHANGED
@@ -41,6 +41,42 @@ module Iterable
|
|
41
41
|
messages(attrs)
|
42
42
|
end
|
43
43
|
|
44
|
+
##
|
45
|
+
#
|
46
|
+
# Send an In-App notification to a specific user. User Email or ID along
|
47
|
+
# with campaign ID must be provided
|
48
|
+
#
|
49
|
+
# @param email [String] (optional) User email used to identify user
|
50
|
+
# @param campaign_id [Integer] Campaign ID
|
51
|
+
# @param attrs [Hash] Additional data to update or add
|
52
|
+
#
|
53
|
+
# @return [Iterable::Response] A response object
|
54
|
+
#
|
55
|
+
def target(campaign_id:, attrs: {}, email: nil)
|
56
|
+
attrs['recipientEmail'] = email if email
|
57
|
+
attrs['campaignId'] = campaign_id
|
58
|
+
Iterable.request(conf, '/inApp/target').post(attrs)
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
#
|
63
|
+
# Cancel an In App notification sent to a specific user
|
64
|
+
# Must include either an email address AND campaignId, or
|
65
|
+
# just a scheduledMessageId provided in the attrs
|
66
|
+
#
|
67
|
+
# @param email [String] User email to cancel push
|
68
|
+
# @param campaignId [Integer] campaignID used to cancel push
|
69
|
+
# @param attrs [Hash] Additional data to update or add
|
70
|
+
#
|
71
|
+
# @return [Iterable::Response] A response object
|
72
|
+
#
|
73
|
+
# @note An email or UserId is required
|
74
|
+
def cancel(campaign_id: nil, attrs: {}, email: nil)
|
75
|
+
attrs['email'] = email if email
|
76
|
+
attrs['campaignId'] = campaign_id if campaign_id
|
77
|
+
Iterable.request(conf, '/push/cancel').post(attrs)
|
78
|
+
end
|
79
|
+
|
44
80
|
private def messages(**attrs)
|
45
81
|
Iterable.request(conf, '/inApp/getMessages', attrs).get
|
46
82
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Iterable
|
2
|
+
##
|
3
|
+
#
|
4
|
+
# Interact with /push API endpoints
|
5
|
+
#
|
6
|
+
# @example Creating push endpoint object
|
7
|
+
# # With default config
|
8
|
+
# templates = Iterable::Push.new
|
9
|
+
# templates.target campaign_id: '12345'
|
10
|
+
#
|
11
|
+
class Push < ApiResource
|
12
|
+
##
|
13
|
+
#
|
14
|
+
# Send a push notification to a specific user
|
15
|
+
#
|
16
|
+
# @param email [String] (optional) User email used to identify user
|
17
|
+
# @param campaign_id [Integer] Campaign ID
|
18
|
+
# @param attrs [Hash] Additional data to update or add
|
19
|
+
#
|
20
|
+
# @return [Iterable::Response] A response object
|
21
|
+
def target(campaign_id:, email: nil, attrs: {})
|
22
|
+
attrs['recipientEmail'] = email if email
|
23
|
+
attrs['campaignId'] = campaign_id
|
24
|
+
Iterable.request(conf, '/push/target').post(attrs)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
#
|
29
|
+
# Cancel a push notification to a specific user
|
30
|
+
# Must include either an email address AND campaignId, or
|
31
|
+
# just a scheduledMessageId provided in the attrs
|
32
|
+
#
|
33
|
+
# @param email [String] User email to cancel push
|
34
|
+
# @param campaignId [Integer] campaignID used to cancel push
|
35
|
+
# @param attrs [Hash] Additional data to update or add
|
36
|
+
#
|
37
|
+
# @return [Iterable::Response] A response object
|
38
|
+
#
|
39
|
+
# @note An email or UserId is required
|
40
|
+
def cancel(email: nil, campaign_id: nil, attrs: {})
|
41
|
+
attrs['email'] = email if email
|
42
|
+
attrs['campaignId'] = campaign_id if campaign_id
|
43
|
+
Iterable.request(conf, '/push/cancel').post(attrs)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/iterable.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iterable-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chavez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
skirV2p91csPqqACuQCX2oK9r29QZtt95aAnVdsdBMA+evI2nVknO0OhYDqNA0wR
|
36
36
|
SkUCdTSDgV9CsbN/vy6DeR0eX1kP6OrntZJjKnrncbkKZnrJ5fjzKtUyj3I=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2023-01-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: multi_json
|
@@ -219,6 +219,20 @@ dependencies:
|
|
219
219
|
- - "~>"
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: 0.21.2
|
222
|
+
- !ruby/object:Gem::Dependency
|
223
|
+
name: simplecov-cobertura
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - "~>"
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 2.1.0
|
229
|
+
type: :development
|
230
|
+
prerelease: false
|
231
|
+
version_requirements: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - "~>"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: 2.1.0
|
222
236
|
- !ruby/object:Gem::Dependency
|
223
237
|
name: typhoeus
|
224
238
|
requirement: !ruby/object:Gem::Requirement
|
@@ -308,6 +322,7 @@ files:
|
|
308
322
|
- lib/iterable/message_types.rb
|
309
323
|
- lib/iterable/metadata.rb
|
310
324
|
- lib/iterable/metadata_table.rb
|
325
|
+
- lib/iterable/push.rb
|
311
326
|
- lib/iterable/push_templates.rb
|
312
327
|
- lib/iterable/request.rb
|
313
328
|
- lib/iterable/response.rb
|
@@ -320,7 +335,7 @@ licenses:
|
|
320
335
|
- MIT
|
321
336
|
metadata:
|
322
337
|
rubygems_mfa_required: 'true'
|
323
|
-
post_install_message:
|
338
|
+
post_install_message:
|
324
339
|
rdoc_options:
|
325
340
|
- "--charset=UTF-8"
|
326
341
|
- "--main=README.md"
|
@@ -337,8 +352,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
352
|
- !ruby/object:Gem::Version
|
338
353
|
version: '0'
|
339
354
|
requirements: []
|
340
|
-
rubygems_version: 3.
|
341
|
-
signing_key:
|
355
|
+
rubygems_version: 3.1.6
|
356
|
+
signing_key:
|
342
357
|
specification_version: 4
|
343
358
|
summary: Iterable REST API Client
|
344
359
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|