iterable-api-client 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +132 -95
- data/lib/iterable/api_resource.rb +1 -1
- data/lib/iterable/bulk_catalog_items.rb +1 -3
- data/lib/iterable/catalog_field_mappings.rb +2 -3
- data/lib/iterable/catalog_items.rb +3 -5
- data/lib/iterable/catalogs.rb +2 -3
- data/lib/iterable/device.rb +2 -4
- data/lib/iterable/experiments.rb +1 -0
- data/lib/iterable/export.rb +14 -8
- data/lib/iterable/in_app.rb +48 -0
- data/lib/iterable/metadata_table.rb +2 -3
- data/lib/iterable/request.rb +11 -13
- data/lib/iterable/response.rb +2 -4
- data/lib/iterable/users.rb +13 -0
- data/lib/iterable.rb +5 -8
- data.tar.gz.sig +0 -0
- metadata +75 -72
- 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: d04be11184926b2bcffba1f777270fc08fbf83e676babb5c1e79756e33915464
|
4
|
+
data.tar.gz: 07723ae603767edd511e37a3c682f0348e6a9262ca435e881fd4d86a7e77b515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc7f30727eaa45240f3a0f683e58128184397a305214e29e719ae34d0794ee04421bfb0bf496865a285f85edede66691d40e3f0e19a24652261efe38e1b6fa82
|
7
|
+
data.tar.gz: a90443045373add4a10ffd3ddbfb74114e71102b6be4f9f8392af1b179a02813e9432d15c3d743499ccb7ae27a8fcbb2e548fb43ec826aff3e1b4211b29a4e27
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -87,89 +87,92 @@ reponse.uri
|
|
87
87
|
|
88
88
|
## API Endpoints
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
90
|
+
- [Bulk Catalog Items](#bulk-catalog-items)
|
91
|
+
- [Create](#bulk-catalog-items-create)
|
92
|
+
- [Delete](#bulk-catalog-items-delete)
|
93
|
+
- [Campaigns](#campaigns)
|
94
|
+
- [All](#campaigns-all)
|
95
|
+
- [Create](#campaigns-create)
|
96
|
+
- [Metrics](#campaigns-metrics)
|
97
|
+
- [Child Campaigns](#campaigns-child)
|
98
|
+
- [Catalog Field Mappings](#catalog-field-mappings)
|
99
|
+
- [Get](#catalog-field-mappings-get)
|
100
|
+
- [Update](#catalog-field-mappings-update)
|
101
|
+
- [Catalog Items](#catalog-items)
|
102
|
+
- [All](#catalog-items-all)
|
103
|
+
- [Create](#catalog-items-create)
|
104
|
+
- [Update](#catalog-items-update)
|
105
|
+
- [Get](#catalog-items-get)
|
106
|
+
- [Delete](#catalog-items-delete)
|
107
|
+
- [Catalogs](#catalogs)
|
108
|
+
- [Create](#catalogs-create)
|
109
|
+
- [Delete](#catalogs-delete)
|
110
|
+
- [Names](#catalogs-names)
|
111
|
+
- [Channels](#channels)
|
112
|
+
- [All](#channels-all)
|
113
|
+
- [Commerce](#commerce)
|
114
|
+
- [Track Purchase](#commerce-track-purchase)
|
115
|
+
- [Update Cart](#commerce-update-cart)
|
116
|
+
- [Device](#device)
|
117
|
+
- [Register Device Token](#device-register-token)
|
118
|
+
- [Email](#email)
|
119
|
+
- [View](#email-view)
|
120
|
+
- [Target](#email-target)
|
121
|
+
- [Email Templates](#email-templates)
|
122
|
+
- [Get](#email-templates-get)
|
123
|
+
- [Update](#email-templates-update)
|
124
|
+
- [Upsert](#email-templates-upsert)
|
125
|
+
- [Events](#events)
|
126
|
+
- [For Email](#events-for-email)
|
127
|
+
- [Track](#events-track)
|
128
|
+
- [Track Push Open](#events-track-push-open)
|
129
|
+
- [Experiments](#experiments)
|
130
|
+
- [Metrics](#experiments-metrics)
|
131
|
+
- [Export](#export)
|
132
|
+
- [JSON](#export-json)
|
133
|
+
- [CSV](#export-csv)
|
134
|
+
- [In App](#in-app)
|
135
|
+
- [Messages](#in-app-messages)
|
136
|
+
- [Lists](#lists)
|
137
|
+
- [All](#lists-all)
|
138
|
+
- [Create](#lists-create)
|
139
|
+
- [Delete](#lists-delete)
|
140
|
+
- [Get Users](#lists-users)
|
141
|
+
- [Subscribe](#lists-subscribe)
|
142
|
+
- [Unsubscribe](#lists-unsubscribe)
|
143
|
+
- [Message Types](#message-types)
|
144
|
+
- [All](#message-types-all)
|
145
|
+
- [Metadata](#metadata)
|
146
|
+
- [Get](#metadata-get)
|
147
|
+
- [List Keys](#metadata-list-keys)
|
148
|
+
- [Delete](#metadata-delete)
|
149
|
+
- [Get Key](#metadata-get-key)
|
150
|
+
- [Remove Key](#metadata-remove-key)
|
151
|
+
- [Add Key](#metadata-add-key)
|
152
|
+
- [Push Templates](#push-templates)
|
153
|
+
- [Get](#push-templates-get)
|
154
|
+
- [Update](#push-templates-update)
|
155
|
+
- [Upsert](#push-templates-upsert)
|
156
|
+
- [Templates](#templates)
|
157
|
+
- [All](#templates-all)
|
158
|
+
- [Get](#templates-get)
|
159
|
+
- [Users](#users)
|
160
|
+
- [Update](#users-update)
|
161
|
+
- [Bulk Update](#users-bulk-update)
|
162
|
+
- [Update Subscriptions](#users-update-subscriptions)
|
163
|
+
- [Bulk Update Subscriptions](#users-bulk-update-subscriptions)
|
164
|
+
- [For Email](#users-for-email)
|
165
|
+
- [By User ID](#users-by-id)
|
166
|
+
- [Get Fields](#users-get-fields)
|
167
|
+
- [Update Email](#users-update-email)
|
168
|
+
- [Delete](#users-delete)
|
169
|
+
- [Delete By ID](#users-delete-by-id)
|
170
|
+
- [Register Browser Token](#users-register-browser-token)
|
171
|
+
- [Disable Device](#users-disable-device)
|
172
|
+
- [Get Sent Messages](#users-get-messages)
|
173
|
+
- [Forget](#users-forget)
|
174
|
+
- [Workflows](#workflows)
|
175
|
+
- [Trigger](#workflows-trigger)
|
173
176
|
|
174
177
|
### Bulk Catalog Items
|
175
178
|
|
@@ -261,8 +264,8 @@ Endpoint: `POST /catalogs/{catalogName}`
|
|
261
264
|
|
262
265
|
```ruby
|
263
266
|
catalog = 'my-catalog'
|
264
|
-
|
265
|
-
response =
|
267
|
+
catalogs = Iterable::Catalogs.new(catalog)
|
268
|
+
response = catalogs.create
|
266
269
|
```
|
267
270
|
|
268
271
|
#### Catalogs Delete
|
@@ -271,19 +274,19 @@ Endpoint: `DELETE /catalogs/{catalogName}`
|
|
271
274
|
|
272
275
|
```ruby
|
273
276
|
catalog = 'my-catalog'
|
274
|
-
|
275
|
-
response =
|
277
|
+
catalogs = Iterable::Catalogs.new(catalog)
|
278
|
+
response = catalogs.delete
|
276
279
|
```
|
277
280
|
|
278
|
-
#### Catalogs
|
281
|
+
#### Catalogs Names
|
279
282
|
|
280
|
-
Endpoint: `
|
283
|
+
Endpoint: `GET /catalogs/{catalogName}`
|
281
284
|
|
282
285
|
```ruby
|
283
286
|
catalog = 'my-catalog'
|
284
|
-
|
287
|
+
catalogs = Iterable::Catalogs.new(catalog)
|
285
288
|
params = { page: 1, pageSize: 20 }
|
286
|
-
response =
|
289
|
+
response = catalogs.names(params)
|
287
290
|
```
|
288
291
|
|
289
292
|
### Catalog Field Mappings
|
@@ -296,8 +299,8 @@ Endpoint: `GET /catalogs/{catalogName}/fieldMappings`
|
|
296
299
|
|
297
300
|
```ruby
|
298
301
|
catalog = 'my-catalog'
|
299
|
-
|
300
|
-
response =
|
302
|
+
catalog_field_mappings = Iterable::CatalogFieldMappings.new(catalog)
|
303
|
+
response = catalog_field_mappings.field_mappings
|
301
304
|
```
|
302
305
|
|
303
306
|
#### Catalog Field Mappings Update
|
@@ -307,8 +310,8 @@ Endpoint: `PUT /catalogs/{catalogName}/fieldMappings`
|
|
307
310
|
```ruby
|
308
311
|
catalog = 'my-catalog'
|
309
312
|
field_mappings = [{fieldName: 'test-field', fieldType: 'string'}]
|
310
|
-
|
311
|
-
|
313
|
+
catalog_field_mappings = Iterable::CatalogFieldMappings.new(catalog)
|
314
|
+
catalog_field_mappings.update(field_mappings)
|
312
315
|
```
|
313
316
|
|
314
317
|
### Catalog Items
|
@@ -616,6 +619,29 @@ start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
|
|
616
619
|
response = exporter.export start_time, end_time
|
617
620
|
```
|
618
621
|
|
622
|
+
### In App
|
623
|
+
|
624
|
+
#### In App Messages
|
625
|
+
|
626
|
+
Endpoint: `GET /inApp/getMessages`
|
627
|
+
|
628
|
+
```ruby
|
629
|
+
in_app = Iterable::InApp.new
|
630
|
+
|
631
|
+
# Get messages for a user by email
|
632
|
+
email = 'user@example.com'
|
633
|
+
response = in_app.messages_for_email email, count: 10
|
634
|
+
|
635
|
+
# Get messages for a user by user_id
|
636
|
+
email = 'user@example.com'
|
637
|
+
response = in_app.messages_for_user_id 42, count: 2
|
638
|
+
|
639
|
+
# Pass in query parameters
|
640
|
+
email = 'user@example.com'
|
641
|
+
attrs = { 'platform' => 'iOS' }
|
642
|
+
response = in_app.messages_for_email: email, attrs
|
643
|
+
```
|
644
|
+
|
619
645
|
### Lists
|
620
646
|
|
621
647
|
#### Lists All
|
@@ -949,6 +975,17 @@ start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
|
|
949
975
|
response = users.sent_messages 'user@example.com', start_time, end_time, params
|
950
976
|
```
|
951
977
|
|
978
|
+
#### Users Forget
|
979
|
+
|
980
|
+
Endpoint: `POST /users/forget`
|
981
|
+
|
982
|
+
```ruby
|
983
|
+
users = Iterable::Users.new
|
984
|
+
# Additional params to filter and query by
|
985
|
+
email = 'user@example.com'
|
986
|
+
response = users.forget email
|
987
|
+
```
|
988
|
+
|
952
989
|
### Workflows
|
953
990
|
|
954
991
|
#### Workflows Trigger
|
@@ -14,6 +14,7 @@ module Iterable
|
|
14
14
|
# catalog = Iterable::CatalogFieldMappings.new("catalog-name", config)
|
15
15
|
class CatalogFieldMappings < ApiResource
|
16
16
|
attr_reader :catalog
|
17
|
+
|
17
18
|
##
|
18
19
|
#
|
19
20
|
# Initialize CatalogFieldMappings with a catalog name **currently in Beta only**
|
@@ -54,9 +55,7 @@ module Iterable
|
|
54
55
|
Iterable.request(conf, base_path).put(body)
|
55
56
|
end
|
56
57
|
|
57
|
-
private
|
58
|
-
|
59
|
-
def base_path
|
58
|
+
private def base_path
|
60
59
|
"/catalogs/#{@catalog}/fieldMappings"
|
61
60
|
end
|
62
61
|
end
|
@@ -45,11 +45,11 @@ module Iterable
|
|
45
45
|
#
|
46
46
|
# Create a catalog item
|
47
47
|
#
|
48
|
-
# @param item_attrs [Hash] Item attributes to save or
|
48
|
+
# @param item_attrs [Hash] Item attributes to save or replace with
|
49
49
|
#
|
50
50
|
# @return [Iterable::Response] A response object
|
51
51
|
def create(item_attrs = {})
|
52
|
-
body = {
|
52
|
+
body = { value: item_attrs }
|
53
53
|
Iterable.request(conf, base_path).put(body)
|
54
54
|
end
|
55
55
|
alias replace create
|
@@ -84,9 +84,7 @@ module Iterable
|
|
84
84
|
Iterable.request(conf, base_path).delete
|
85
85
|
end
|
86
86
|
|
87
|
-
private
|
88
|
-
|
89
|
-
def base_path
|
87
|
+
private def base_path
|
90
88
|
path = "/catalogs/#{@catalog}/items"
|
91
89
|
path += "/#{@item_id}" if @item_id
|
92
90
|
path
|
data/lib/iterable/catalogs.rb
CHANGED
@@ -14,6 +14,7 @@ module Iterable
|
|
14
14
|
# catalog = Iterable::Catalogs.new("catalog-name", config)
|
15
15
|
class Catalogs < ApiResource
|
16
16
|
attr_reader :name
|
17
|
+
|
17
18
|
##
|
18
19
|
#
|
19
20
|
# Initialize Catalogs with a catalog name **currently in Beta only**
|
@@ -54,9 +55,7 @@ module Iterable
|
|
54
55
|
Iterable.request(conf, '/catalogs', params).get
|
55
56
|
end
|
56
57
|
|
57
|
-
private
|
58
|
-
|
59
|
-
def base_path
|
58
|
+
private def base_path
|
60
59
|
"/catalogs/#{@name}"
|
61
60
|
end
|
62
61
|
end
|
data/lib/iterable/device.rb
CHANGED
@@ -56,13 +56,11 @@ module Iterable
|
|
56
56
|
Iterable.request(conf, base_path).post(attrs)
|
57
57
|
end
|
58
58
|
|
59
|
-
private
|
60
|
-
|
61
|
-
def base_path
|
59
|
+
private def base_path
|
62
60
|
'/users/registerDeviceToken'
|
63
61
|
end
|
64
62
|
|
65
|
-
def device_data
|
63
|
+
private def device_data
|
66
64
|
{
|
67
65
|
token: @token,
|
68
66
|
applicationName: @app,
|
data/lib/iterable/experiments.rb
CHANGED
data/lib/iterable/export.rb
CHANGED
@@ -57,7 +57,7 @@ module Iterable
|
|
57
57
|
# @param conf [Iterable::Config] A config to optionally pass for requests
|
58
58
|
#
|
59
59
|
# @return [Iterable::Export]
|
60
|
-
def initialize(data_type, only_fields = [], omit_fields = [], campaign_id = nil, conf = nil)
|
60
|
+
def initialize(data_type, only_fields = [], omit_fields = [], campaign_id = nil, conf = nil) # rubocop:disable Metrics/ParameterLists
|
61
61
|
@data_type = data_type
|
62
62
|
@only_fields = only_fields
|
63
63
|
@omit_fields = omit_fields
|
@@ -103,20 +103,26 @@ module Iterable
|
|
103
103
|
Iterable.request(conf, base_path, request_params(params)).get
|
104
104
|
end
|
105
105
|
|
106
|
-
protected
|
107
|
-
|
108
|
-
def base_path
|
106
|
+
protected def base_path
|
109
107
|
"/export/data.#{format}"
|
110
108
|
end
|
111
109
|
|
112
|
-
def request_params(params = {})
|
110
|
+
protected def request_params(params = {})
|
113
111
|
default_params.merge params
|
114
112
|
end
|
115
113
|
|
116
|
-
def
|
114
|
+
protected def only_fields?
|
115
|
+
@only_fields&.length.to_i.positive?
|
116
|
+
end
|
117
|
+
|
118
|
+
protected def omit_fields?
|
119
|
+
@omit_fields&.length.to_i.positive?
|
120
|
+
end
|
121
|
+
|
122
|
+
protected def default_params
|
117
123
|
params = { dataTypeName: @data_type }
|
118
|
-
params[:onlyFields] = @only_fields if
|
119
|
-
params[:omitFields] = @omit_fields.join(',') if
|
124
|
+
params[:onlyFields] = @only_fields if only_fields?
|
125
|
+
params[:omitFields] = @omit_fields.join(',') if omit_fields?
|
120
126
|
params[:campaignId] = @campaign_id if @campaign_id
|
121
127
|
params
|
122
128
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Iterable
|
2
|
+
##
|
3
|
+
#
|
4
|
+
# Interact with /inApp API endpoints
|
5
|
+
#
|
6
|
+
# @example Creating in app endpoint object
|
7
|
+
# # With default config
|
8
|
+
# in_app = Iterable::InApp.new
|
9
|
+
#
|
10
|
+
# # With custom config
|
11
|
+
# conf = Iterable::Config.new(token: 'new-token')
|
12
|
+
# in_app = Iterable::InApp.new(config)
|
13
|
+
class InApp < ApiResource
|
14
|
+
##
|
15
|
+
#
|
16
|
+
# Get in-app messages for a user by email
|
17
|
+
#
|
18
|
+
# @param email [String] *required* Email of user who received the message to view. Required if no user_id present.
|
19
|
+
# @param count [Integer] Number of messages to return, defaults to 1
|
20
|
+
# @param attrs [Hash] Hash of query attributes like platform, SDKVersion, etc.
|
21
|
+
#
|
22
|
+
# @return [Iterable::Response] A response object
|
23
|
+
def messages_for_email(email, count: 1, **attrs)
|
24
|
+
attrs[:email] = email
|
25
|
+
attrs[:count] = count
|
26
|
+
messages(attrs)
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
#
|
31
|
+
# Get in-app messages for a user by user_id
|
32
|
+
#
|
33
|
+
# @param email [String] *required* Email of user who received the message to view. Required if no user_id present.
|
34
|
+
# @param count [Integer] Number of messages to return, defaults to 1
|
35
|
+
# @param attrs [Hash] Hash of query attributes like platform, SDKVersion, etc.
|
36
|
+
#
|
37
|
+
# @return [Iterable::Response] A response object
|
38
|
+
def messages_for_user_id(user_id, count: 1, **attrs)
|
39
|
+
attrs[:userId] = user_id
|
40
|
+
attrs[:count] = count
|
41
|
+
messages(attrs)
|
42
|
+
end
|
43
|
+
|
44
|
+
private def messages(**attrs)
|
45
|
+
Iterable.request(conf, '/inApp/getMessages', attrs).get
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -13,6 +13,7 @@ module Iterable
|
|
13
13
|
# templates = Iterable::MetadataTable.new("table-name", config)
|
14
14
|
class MetadataTable < ApiResource
|
15
15
|
attr_reader :name
|
16
|
+
|
16
17
|
##
|
17
18
|
#
|
18
19
|
# Initialize a MetadataTable with a table name
|
@@ -82,9 +83,7 @@ module Iterable
|
|
82
83
|
Iterable.request(conf, base_path(key)).delete
|
83
84
|
end
|
84
85
|
|
85
|
-
private
|
86
|
-
|
87
|
-
def base_path(key = nil)
|
86
|
+
private def base_path(key = nil)
|
88
87
|
path = "/metadata/#{@name}"
|
89
88
|
path += "/#{key}" if key
|
90
89
|
path
|
data/lib/iterable/request.rb
CHANGED
@@ -42,41 +42,39 @@ module Iterable
|
|
42
42
|
execute :delete, body, headers
|
43
43
|
end
|
44
44
|
|
45
|
-
private
|
46
|
-
|
47
|
-
def execute(verb, body = {}, headers = {})
|
45
|
+
private def execute(verb, body = {}, headers = {})
|
48
46
|
http = connection(verb, body, headers)
|
49
47
|
setup_http(http)
|
50
48
|
transmit http
|
51
49
|
end
|
52
50
|
|
53
|
-
def connection(verb, body = {}, headers = {})
|
54
|
-
conn_headers = DEFAULT_HEADERS.merge(headers)
|
51
|
+
private def connection(verb, body = {}, headers = {})
|
52
|
+
conn_headers = DEFAULT_HEADERS.dup.merge(headers)
|
53
|
+
conn_headers['Api-Key'] = @config.token if @config.token
|
55
54
|
req = Net::HTTP.const_get(verb.to_s.capitalize, false).new(@uri, conn_headers)
|
56
55
|
req.body = JSON.dump(body)
|
57
56
|
req
|
58
57
|
end
|
59
58
|
|
60
|
-
def setup_http(http)
|
59
|
+
private def setup_http(http)
|
61
60
|
DEFAULT_OPTIONS.dup.each do |option, value|
|
62
61
|
setter = "#{option.to_sym}="
|
63
62
|
http.send(setter, value) if http.respond_to?(setter)
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
67
|
-
def build_uri(path, params = {})
|
66
|
+
private def build_uri(path, params = {})
|
68
67
|
uri = @config.uri
|
69
68
|
uri.path += path
|
70
|
-
|
71
|
-
uri.query = URI.encode_www_form(params)
|
69
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
72
70
|
uri
|
73
71
|
end
|
74
72
|
|
75
|
-
def net_http
|
73
|
+
private def net_http
|
76
74
|
Net::HTTP.new(@uri.hostname, @uri.port, nil, nil, nil, nil)
|
77
75
|
end
|
78
76
|
|
79
|
-
def transmit(req)
|
77
|
+
private def transmit(req)
|
80
78
|
response = nil
|
81
79
|
@net.start do |http|
|
82
80
|
response = http.request(req, nil, &:read_body)
|
@@ -84,7 +82,7 @@ module Iterable
|
|
84
82
|
handle_response response
|
85
83
|
end
|
86
84
|
|
87
|
-
def handle_response(response)
|
85
|
+
private def handle_response(response)
|
88
86
|
redirected = response.is_a?(Net::HTTPRedirection) || response.code == '303'
|
89
87
|
if redirected && response['location']
|
90
88
|
Response.new Net::HTTP.get_response(uri_for_redirect(response))
|
@@ -93,7 +91,7 @@ module Iterable
|
|
93
91
|
end
|
94
92
|
end
|
95
93
|
|
96
|
-
def uri_for_redirect(response)
|
94
|
+
private def uri_for_redirect(response)
|
97
95
|
uri = @config.uri
|
98
96
|
redirect_uri = URI(response['location'])
|
99
97
|
uri.path = redirect_uri.path
|
data/lib/iterable/response.rb
CHANGED
@@ -12,7 +12,7 @@ module Iterable
|
|
12
12
|
attr_reader :body
|
13
13
|
|
14
14
|
# @!visibility private
|
15
|
-
def initialize(resp)
|
15
|
+
def initialize(resp)
|
16
16
|
@resp = resp
|
17
17
|
@body = parsed_body
|
18
18
|
end
|
@@ -29,14 +29,12 @@ module Iterable
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
private
|
33
|
-
|
34
32
|
##
|
35
33
|
# Attempts to parse the response as JSON. Will rescue and return original
|
36
34
|
# if unable to parse.
|
37
35
|
#
|
38
36
|
# @return [Hash,Array,String] A parsed JSON object or the original response body
|
39
|
-
def parsed_body
|
37
|
+
private def parsed_body
|
40
38
|
response_body = @resp.body
|
41
39
|
MultiJson.load response_body
|
42
40
|
rescue MultiJson::ParseError
|
data/lib/iterable/users.rb
CHANGED
@@ -186,5 +186,18 @@ module Iterable
|
|
186
186
|
params[:endTime] = end_time.to_s if end_time
|
187
187
|
Iterable.request(conf, '/users/getSentMessages', params).get
|
188
188
|
end
|
189
|
+
|
190
|
+
##
|
191
|
+
#
|
192
|
+
# Delete the specified user's data from the Iterable project and
|
193
|
+
# prevent future data collection about them.
|
194
|
+
#
|
195
|
+
# @param email [String] User email to forget
|
196
|
+
#
|
197
|
+
# @return [Iterable::Response] A response object
|
198
|
+
def forget(email)
|
199
|
+
attrs = { email: email }
|
200
|
+
Iterable.request(conf, '/users/forget').post(attrs)
|
201
|
+
end
|
189
202
|
end
|
190
203
|
end
|
data/lib/iterable.rb
CHANGED
@@ -17,6 +17,7 @@ files = %w[
|
|
17
17
|
campaigns
|
18
18
|
channels
|
19
19
|
events
|
20
|
+
in_app
|
20
21
|
message_types
|
21
22
|
templates
|
22
23
|
email_templates
|
@@ -42,8 +43,6 @@ files.each { |path| require_relative "./iterable/#{path}" }
|
|
42
43
|
module Iterable
|
43
44
|
DATE_FORMAT = '%Y-%m-%d'.freeze
|
44
45
|
|
45
|
-
module_function
|
46
|
-
|
47
46
|
##
|
48
47
|
#
|
49
48
|
# Configure a default [Iterable::Config] object to be used when interacting
|
@@ -53,21 +52,19 @@ module Iterable
|
|
53
52
|
# Iterable.configure do |conf|
|
54
53
|
# conf.token = 'secret-token'
|
55
54
|
# end
|
56
|
-
def configure
|
57
|
-
config.tap
|
58
|
-
yield conf
|
59
|
-
end
|
55
|
+
module_function def configure(&block)
|
56
|
+
config.tap(&block)
|
60
57
|
end
|
61
58
|
|
62
59
|
##
|
63
60
|
#
|
64
61
|
# @return [Iterable::Config] The default config for API endpoints
|
65
|
-
def config
|
62
|
+
module_function def config
|
66
63
|
@config ||= Config.new
|
67
64
|
end
|
68
65
|
|
69
66
|
# @!visibility private
|
70
|
-
def request(conf, path, params = {})
|
67
|
+
module_function def request(conf, path, params = {})
|
71
68
|
Request.new conf, path, params
|
72
69
|
end
|
73
70
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,40 +1,41 @@
|
|
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.4.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
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
/
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
13
|
+
MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMRAwDgYDVQQDDAdjb250
|
14
|
+
YWN0MRkwFwYKCZImiZPyLGQBGRYJZWwtY2hhdmV6MRIwEAYKCZImiZPyLGQBGRYC
|
15
|
+
bWUwHhcNMjIwNTE2MTYzNDEwWhcNMjMwNTE2MTYzNDEwWjBBMRAwDgYDVQQDDAdj
|
16
|
+
b250YWN0MRkwFwYKCZImiZPyLGQBGRYJZWwtY2hhdmV6MRIwEAYKCZImiZPyLGQB
|
17
|
+
GRYCbWUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCZc8MEuKWEAM8X
|
18
|
+
WCwtJ5yVgTzIbBFWo/Rq9RDBV5QHEGtkxqi4tvxcAP5Gw+iXxnfsysEOfTDa1FNw
|
19
|
+
YMhh38X9Ob7y3F/3G4CMu0MHGgIbzbQMs58pBfyBCB9u9ELVyzrHt4okThHG+KgN
|
20
|
+
EUD1FwgXeZCpjipx35y9QVO1Oax46p4cJo3UStEBHebkkU4P6Ch8OC39Neg2RGLI
|
21
|
+
oczDtOOP2hv/dqlgtCnOpuT48ycyJ4c/34/TXAPOZZy6buF9xZCR4yyoIB+qOtHP
|
22
|
+
cjdf2GBZIjsNtVvl8OIM1yotJRnndujKnAuFuPppOjnYD8xfm/qj2EApgVyjuWpg
|
23
|
+
2ltbeYmeU4sbi7W1IuSLe4TDDveSLJh5AAbSUC31diSdksx67nmhDYlqN1HTPWLY
|
24
|
+
yv1rEPz8vlQikzfwwL/vdhYocxzsMV0B+y3bonq40GJ2MWFROdwpct+D26Jo3Y+C
|
25
|
+
jJ6XeJosdueHvYBB1jy7j4QNOEBXDcwM80Kab1FUq469TbjTOPECAwEAAaN7MHkw
|
26
|
+
CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFM58c7sLuFcAZthV1ngO
|
27
|
+
0x3oyP02MB8GA1UdEQQYMBaBFGNvbnRhY3RAZWwtY2hhdmV6Lm1lMB8GA1UdEgQY
|
28
|
+
MBaBFGNvbnRhY3RAZWwtY2hhdmV6Lm1lMA0GCSqGSIb3DQEBCwUAA4IBgQAAjCBc
|
29
|
+
p5GzU6dOAe1afNSBn31KSYQedp0idL7TLLDBlUEAOPkBGxZvYG+78NOlw/12ci2E
|
30
|
+
H7oLWs2WNrIl6LwGVpueveEOTxqgvkhxPM/+8hvA1Rb5I9eCcLJrOvk36K/1LDyR
|
31
|
+
HSrSHnFDIk5wlSNCLK+pVOTS1s1wbXlV/DfuncKgDeGQKW9aQ5jHBZjk0u23qbox
|
32
|
+
j8goGrnX72zOv7ysPYDebJwpXjMXv8k+69M7CkCkeqTO8sRxnszNpnlB6DMqIhnI
|
33
|
+
bU76Xth/U7KdRV/d4bdBAMait/SQDJd+EjwTS2vvbpuEEJwLNN3/+DViQ0CA+vGC
|
34
|
+
bP6SNtxoWX20A6bkT2pf19J77p1LNFQAtQ2uUWqoXHdhtUvmpo28/WH/WY1CGuhP
|
35
|
+
skirV2p91csPqqACuQCX2oK9r29QZtt95aAnVdsdBMA+evI2nVknO0OhYDqNA0wR
|
36
|
+
SkUCdTSDgV9CsbN/vy6DeR0eX1kP6OrntZJjKnrncbkKZnrJ5fjzKtUyj3I=
|
36
37
|
-----END CERTIFICATE-----
|
37
|
-
date:
|
38
|
+
date: 2022-06-08 00:00:00.000000000 Z
|
38
39
|
dependencies:
|
39
40
|
- !ruby/object:Gem::Dependency
|
40
41
|
name: multi_json
|
@@ -51,187 +52,187 @@ dependencies:
|
|
51
52
|
- !ruby/object:Gem::Version
|
52
53
|
version: 1.12.0
|
53
54
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
55
|
+
name: dotenv
|
55
56
|
requirement: !ruby/object:Gem::Requirement
|
56
57
|
requirements:
|
57
58
|
- - "~>"
|
58
59
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
60
|
+
version: 2.7.1
|
60
61
|
type: :development
|
61
62
|
prerelease: false
|
62
63
|
version_requirements: !ruby/object:Gem::Requirement
|
63
64
|
requirements:
|
64
65
|
- - "~>"
|
65
66
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
67
|
+
version: 2.7.1
|
67
68
|
- !ruby/object:Gem::Dependency
|
68
|
-
name:
|
69
|
+
name: gemcutter
|
69
70
|
requirement: !ruby/object:Gem::Requirement
|
70
71
|
requirements:
|
71
72
|
- - "~>"
|
72
73
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
74
|
+
version: 0.7.1
|
74
75
|
type: :development
|
75
76
|
prerelease: false
|
76
77
|
version_requirements: !ruby/object:Gem::Requirement
|
77
78
|
requirements:
|
78
79
|
- - "~>"
|
79
80
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
81
|
+
version: 0.7.1
|
81
82
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
83
|
+
name: pry
|
83
84
|
requirement: !ruby/object:Gem::Requirement
|
84
85
|
requirements:
|
85
86
|
- - "~>"
|
86
87
|
- !ruby/object:Gem::Version
|
87
|
-
version: 0.
|
88
|
+
version: 0.14.1
|
88
89
|
type: :development
|
89
90
|
prerelease: false
|
90
91
|
version_requirements: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
93
|
- - "~>"
|
93
94
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0.
|
95
|
+
version: 0.14.1
|
95
96
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
97
|
+
name: pry-byebug
|
97
98
|
requirement: !ruby/object:Gem::Requirement
|
98
99
|
requirements:
|
99
100
|
- - "~>"
|
100
101
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
102
|
+
version: 3.8.0
|
102
103
|
type: :development
|
103
104
|
prerelease: false
|
104
105
|
version_requirements: !ruby/object:Gem::Requirement
|
105
106
|
requirements:
|
106
107
|
- - "~>"
|
107
108
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
109
|
+
version: 3.8.0
|
109
110
|
- !ruby/object:Gem::Dependency
|
110
|
-
name: pry
|
111
|
+
name: pry-doc
|
111
112
|
requirement: !ruby/object:Gem::Requirement
|
112
113
|
requirements:
|
113
114
|
- - "~>"
|
114
115
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
116
|
+
version: 1.3.0
|
116
117
|
type: :development
|
117
118
|
prerelease: false
|
118
119
|
version_requirements: !ruby/object:Gem::Requirement
|
119
120
|
requirements:
|
120
121
|
- - "~>"
|
121
122
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
123
|
+
version: 1.3.0
|
123
124
|
- !ruby/object:Gem::Dependency
|
124
|
-
name:
|
125
|
+
name: rake
|
125
126
|
requirement: !ruby/object:Gem::Requirement
|
126
127
|
requirements:
|
127
128
|
- - "~>"
|
128
129
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
130
|
+
version: 13.0.0
|
130
131
|
type: :development
|
131
132
|
prerelease: false
|
132
133
|
version_requirements: !ruby/object:Gem::Requirement
|
133
134
|
requirements:
|
134
135
|
- - "~>"
|
135
136
|
- !ruby/object:Gem::Version
|
136
|
-
version:
|
137
|
+
version: 13.0.0
|
137
138
|
- !ruby/object:Gem::Dependency
|
138
|
-
name:
|
139
|
+
name: redcarpet
|
139
140
|
requirement: !ruby/object:Gem::Requirement
|
140
141
|
requirements:
|
141
142
|
- - "~>"
|
142
143
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
144
|
+
version: 3.5.0
|
144
145
|
type: :development
|
145
146
|
prerelease: false
|
146
147
|
version_requirements: !ruby/object:Gem::Requirement
|
147
148
|
requirements:
|
148
149
|
- - "~>"
|
149
150
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
151
|
+
version: 3.5.0
|
151
152
|
- !ruby/object:Gem::Dependency
|
152
|
-
name:
|
153
|
+
name: rspec
|
153
154
|
requirement: !ruby/object:Gem::Requirement
|
154
155
|
requirements:
|
155
156
|
- - "~>"
|
156
157
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
158
|
+
version: 3.11.0
|
158
159
|
type: :development
|
159
160
|
prerelease: false
|
160
161
|
version_requirements: !ruby/object:Gem::Requirement
|
161
162
|
requirements:
|
162
163
|
- - "~>"
|
163
164
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
165
|
+
version: 3.11.0
|
165
166
|
- !ruby/object:Gem::Dependency
|
166
|
-
name:
|
167
|
+
name: rubocop
|
167
168
|
requirement: !ruby/object:Gem::Requirement
|
168
169
|
requirements:
|
169
170
|
- - "~>"
|
170
171
|
- !ruby/object:Gem::Version
|
171
|
-
version:
|
172
|
+
version: 1.29.1
|
172
173
|
type: :development
|
173
174
|
prerelease: false
|
174
175
|
version_requirements: !ruby/object:Gem::Requirement
|
175
176
|
requirements:
|
176
177
|
- - "~>"
|
177
178
|
- !ruby/object:Gem::Version
|
178
|
-
version:
|
179
|
+
version: 1.29.1
|
179
180
|
- !ruby/object:Gem::Dependency
|
180
|
-
name:
|
181
|
+
name: rubocop-performance
|
181
182
|
requirement: !ruby/object:Gem::Requirement
|
182
183
|
requirements:
|
183
184
|
- - "~>"
|
184
185
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
186
|
+
version: 1.13.3
|
186
187
|
type: :development
|
187
188
|
prerelease: false
|
188
189
|
version_requirements: !ruby/object:Gem::Requirement
|
189
190
|
requirements:
|
190
191
|
- - "~>"
|
191
192
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
193
|
+
version: 1.13.3
|
193
194
|
- !ruby/object:Gem::Dependency
|
194
|
-
name: rubocop
|
195
|
+
name: rubocop-rspec
|
195
196
|
requirement: !ruby/object:Gem::Requirement
|
196
197
|
requirements:
|
197
198
|
- - "~>"
|
198
199
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
200
|
+
version: 2.11.0
|
200
201
|
type: :development
|
201
202
|
prerelease: false
|
202
203
|
version_requirements: !ruby/object:Gem::Requirement
|
203
204
|
requirements:
|
204
205
|
- - "~>"
|
205
206
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
207
|
+
version: 2.11.0
|
207
208
|
- !ruby/object:Gem::Dependency
|
208
209
|
name: simplecov
|
209
210
|
requirement: !ruby/object:Gem::Requirement
|
210
211
|
requirements:
|
211
212
|
- - "~>"
|
212
213
|
- !ruby/object:Gem::Version
|
213
|
-
version: 0.
|
214
|
+
version: 0.21.2
|
214
215
|
type: :development
|
215
216
|
prerelease: false
|
216
217
|
version_requirements: !ruby/object:Gem::Requirement
|
217
218
|
requirements:
|
218
219
|
- - "~>"
|
219
220
|
- !ruby/object:Gem::Version
|
220
|
-
version: 0.
|
221
|
+
version: 0.21.2
|
221
222
|
- !ruby/object:Gem::Dependency
|
222
223
|
name: typhoeus
|
223
224
|
requirement: !ruby/object:Gem::Requirement
|
224
225
|
requirements:
|
225
226
|
- - "~>"
|
226
227
|
- !ruby/object:Gem::Version
|
227
|
-
version: 1.
|
228
|
+
version: 1.4.0
|
228
229
|
type: :development
|
229
230
|
prerelease: false
|
230
231
|
version_requirements: !ruby/object:Gem::Requirement
|
231
232
|
requirements:
|
232
233
|
- - "~>"
|
233
234
|
- !ruby/object:Gem::Version
|
234
|
-
version: 1.
|
235
|
+
version: 1.4.0
|
235
236
|
- !ruby/object:Gem::Dependency
|
236
237
|
name: vcr
|
237
238
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,28 +253,28 @@ dependencies:
|
|
252
253
|
requirements:
|
253
254
|
- - "~>"
|
254
255
|
- !ruby/object:Gem::Version
|
255
|
-
version: 3.0
|
256
|
+
version: 3.14.0
|
256
257
|
type: :development
|
257
258
|
prerelease: false
|
258
259
|
version_requirements: !ruby/object:Gem::Requirement
|
259
260
|
requirements:
|
260
261
|
- - "~>"
|
261
262
|
- !ruby/object:Gem::Version
|
262
|
-
version: 3.0
|
263
|
+
version: 3.14.0
|
263
264
|
- !ruby/object:Gem::Dependency
|
264
265
|
name: yard
|
265
266
|
requirement: !ruby/object:Gem::Requirement
|
266
267
|
requirements:
|
267
268
|
- - "~>"
|
268
269
|
- !ruby/object:Gem::Version
|
269
|
-
version: 0.9.
|
270
|
+
version: 0.9.11
|
270
271
|
type: :development
|
271
272
|
prerelease: false
|
272
273
|
version_requirements: !ruby/object:Gem::Requirement
|
273
274
|
requirements:
|
274
275
|
- - "~>"
|
275
276
|
- !ruby/object:Gem::Version
|
276
|
-
version: 0.9.
|
277
|
+
version: 0.9.11
|
277
278
|
description: Ruby gem for the Iterable REST API
|
278
279
|
email: contact@el-chavez.me
|
279
280
|
executables: []
|
@@ -301,6 +302,7 @@ files:
|
|
301
302
|
- lib/iterable/events.rb
|
302
303
|
- lib/iterable/experiments.rb
|
303
304
|
- lib/iterable/export.rb
|
305
|
+
- lib/iterable/in_app.rb
|
304
306
|
- lib/iterable/json_exporter.rb
|
305
307
|
- lib/iterable/lists.rb
|
306
308
|
- lib/iterable/message_types.rb
|
@@ -313,11 +315,12 @@ files:
|
|
313
315
|
- lib/iterable/users.rb
|
314
316
|
- lib/iterable/workflows.rb
|
315
317
|
- lib/iterable_api_client.rb
|
316
|
-
homepage:
|
318
|
+
homepage: https://gitlab.com/mtchavez/iterable
|
317
319
|
licenses:
|
318
320
|
- MIT
|
319
|
-
metadata:
|
320
|
-
|
321
|
+
metadata:
|
322
|
+
rubygems_mfa_required: 'true'
|
323
|
+
post_install_message:
|
321
324
|
rdoc_options:
|
322
325
|
- "--charset=UTF-8"
|
323
326
|
- "--main=README.md"
|
@@ -327,7 +330,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
327
330
|
requirements:
|
328
331
|
- - ">="
|
329
332
|
- !ruby/object:Gem::Version
|
330
|
-
version: 2.
|
333
|
+
version: 2.6.0
|
331
334
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
332
335
|
requirements:
|
333
336
|
- - ">="
|
@@ -335,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
335
338
|
version: '0'
|
336
339
|
requirements: []
|
337
340
|
rubygems_version: 3.0.3
|
338
|
-
signing_key:
|
341
|
+
signing_key:
|
339
342
|
specification_version: 4
|
340
343
|
summary: Iterable REST API Client
|
341
344
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|