iterable-api-client 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e8201ff2a2c62a1817c30094aa37799ef99baa1
4
- data.tar.gz: b4123101be7019b2f6961af79065546674ac70a4
3
+ metadata.gz: 6f1a6522fb06840f8b7c767538880aed5c69a690
4
+ data.tar.gz: d108b3a889f96eb9dd5eb4ec604be87d2854baec
5
5
  SHA512:
6
- metadata.gz: d9a14a9ae700dad75fb3b2d07e1db0f4bcddc48915e4d2b593114aabec50f6df20e1000b408e650d73ab0c1ade50c32218ee801b5e282505485827002d79e80b
7
- data.tar.gz: 41dcf29ebd25f1a842c76cd021de51fea96dd656827312f1f9e2bbf2a14daf653378709737f51d846c98d7721fcdff30a20f5e4f70023beaf57bf563f6b646ec
6
+ metadata.gz: 0daf7c4c00d23299e08f3cac3b74fd8473d89a9cd36d7c9479364232eb9b41ac61f5428c1c5d23aa0f766c01ee98ab806f3e1a7bebf622bec0f482399a89eaa1
7
+ data.tar.gz: 5e8ae858899f57becc8c21865735c8b00396215fd7b5e72b1fbd63e1f3cdb128bd6e74da17ff632fcb8eb69268a8635413b979a48d3becd3f749641cbc54d7a1
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Iterable API Gem
2
+
3
+ [![Gem](https://img.shields.io/gem/v/iterable-api-client.svg)](https://rubygems.org/gems/iterable-api-client)
2
4
  [![build status](https://gitlab.com/mtchavez/iterable/badges/master/build.svg)](https://gitlab.com/mtchavez/iterable/commits/master)
3
5
  [![coverage report](https://gitlab.com/mtchavez/iterable/badges/master/coverage.svg)](https://gitlab.com/mtchavez/iterable/commits/master)
4
6
 
@@ -6,9 +8,739 @@ Rubygem to interact with the [Iterable][iterable] API.
6
8
 
7
9
  ## Installation
8
10
 
9
- ## Setup
11
+ ```ruby
12
+ gem install iterable-api-client
13
+ ```
14
+
15
+ or with Bundler in your `Gemfile`
16
+
17
+ ```ruby
18
+ gem 'iterable-api-client'
19
+ ```
10
20
 
11
21
  ## Usage
12
22
 
23
+ ### Documentation
24
+
25
+ Documentation can be found on [rubydoc][docs] or in this README
26
+
27
+ ### API Documentation
28
+
29
+ The Iterable [API documentation][api-docs] can be a helpful reference for looking
30
+ up all the possible endpoint data interactions. The docs outline all the possible
31
+ parameters to each endpoints as well as custom data fields.
32
+
33
+ ### Configuration
34
+
35
+ #### Global Config
36
+
37
+ Configure the gem with a default global configuration to use.
38
+
39
+ ```ruby
40
+ Iterable.configure do |config|
41
+ config.token = 'api-token'
42
+ end
43
+ ```
44
+
45
+ ### Config Object
46
+
47
+ If you have multiple tokens to use you can create a `Iterable::Config` object
48
+ with a different token from the global default and pass in on requests.
49
+
50
+ ```ruby
51
+ # Creating a new config with a different token
52
+ conf = Iterable::Config.new(token: 'new-token')
53
+
54
+ # Example of using it with the campaigns endpoints
55
+ # which will then make API requests using the passed in config
56
+ campaigns = Iterable::Campaigns.new(config)
57
+ ```
58
+
59
+ ### Responses
60
+
61
+ Response objects will attempt to parse the API response as JSON using the `multi_json`
62
+ gem so you can have your own JSON parser handle the loading of responses.
63
+
64
+ You can access some of the response data for example:
65
+
66
+ ```ruby
67
+ templates = Iterable::Templates.new
68
+ response = templates.all
69
+
70
+ # Check if the response code is a succesfull HTTP Code from 200-299
71
+ response.success?
72
+
73
+ # Get response code
74
+ response.code
75
+
76
+ # Body of response - will attempt to parse as JSON
77
+ response.body
78
+
79
+ # HTTP message
80
+ response.message
81
+
82
+ # The URI used to make the request for the response
83
+ reponse.uri
84
+ ```
85
+
86
+ ## API Endpoints
87
+
88
+ * [Campaigns](#campaigns)
89
+ * [All](#campaigns-all)
90
+ * [Create](#campaigns-create)
91
+ * [Metrics](#campaigns-metrics)
92
+ * [Child Campaigns](#campaigns-child)
93
+ * [Channels](#channels)
94
+ * [All](#channels-all)
95
+ * [Commerce](#commerce)
96
+ * [Track Purchase](#commerce-track-purchase)
97
+ * [Update Cart](#commerce-update-cart)
98
+ * [Device](#device)
99
+ * [Register Device Token](#device-register-token)
100
+ * [Email](#email)
101
+ * [View](#email-view)
102
+ * [Email Templates](#email-templates)
103
+ * [Get](#email-templates-get)
104
+ * [Update](#email-templates-update)
105
+ * [Upsert](#email-templates-upsert)
106
+ * [Events](#events)
107
+ * [For Email](#events-for-email)
108
+ * [Track](#events-track)
109
+ * [Track Push Open](#events-track-push-open)
110
+ * [Experiments](#experiments)
111
+ * [Metrics](#experiments-metrics)
112
+ * [Export](#export)
113
+ * [JSON](#export-json)
114
+ * [CSV](#export-csv)
115
+ * [Lists](#lists)
116
+ * [All](#lists-all)
117
+ * [Create](#lists-create)
118
+ * [Delete](#lists-delete)
119
+ * [Get Users](#lists-users)
120
+ * [Subscribe](#lists-subscribe)
121
+ * [Unsubscribe](#lists-unsubscribe)
122
+ * [Message Types](#message-types)
123
+ * [All](#message-types-all)
124
+ * [Metadata](#metadata)
125
+ * [Get](#metadata-get)
126
+ * [List Keys](#metadata-list-keys)
127
+ * [Delete](#metadata-delete)
128
+ * [Get Key](#metadata-get-key)
129
+ * [Remove Key](#metadata-remove-key)
130
+ * [Add Key](#metadata-add-key)
131
+ * [Push Templates](#push-templates)
132
+ * [Get](#push-templates-get)
133
+ * [Update](#push-templates-update)
134
+ * [Upsert](#push-templates-upsert)
135
+ * [Templates](#templates)
136
+ * [All](#templates-all)
137
+ * [Get](#templates-get)
138
+ * [Users](#users)
139
+ * [Update](#users-update)
140
+ * [Bulk Update](#users-bulk-update)
141
+ * [Update Subscriptions](#users-update-subscriptions)
142
+ * [Bulk Update Subscriptions](#users-bulk-update-subscriptions)
143
+ * [For Email](#users-for-email)
144
+ * [By User ID](#users-by-id)
145
+ * [Get Fields](#users-get-fields)
146
+ * [Update Email](#users-update-email)
147
+ * [Delete](#users-delete)
148
+ * [Delete By ID](#users-delete-by-id)
149
+ * [Register Browser Token](#users-register-browser-token)
150
+ * [Disable Device](#users-disable-device)
151
+ * [Get Sent Messages](#users-get-messages)
152
+ * [Workflows](#workflows)
153
+ * [Trigger](#workflows-trigger)
154
+
155
+ ### Campaigns
156
+
157
+ #### Campaigns All
158
+
159
+ Endpoint: `GET /campaigns`
160
+
161
+ ```ruby
162
+ campaigns = Iterable::Campaigns.new
163
+ response = campaigns.all
164
+ ```
165
+
166
+ #### Campaigns Create
167
+
168
+ Endpoint: `POST /campaigns/create`
169
+
170
+ ```ruby
171
+ campaigns = Iterable::Campaigns.new
172
+ # List IDs to associate with the campaign
173
+ list_ids = [1234, 1235, 1236]
174
+ # Additional campaign attributes
175
+ attrs = { dataFields: { foo: 'bar' } }
176
+ response = campaigns.create 'name', 'template-id', list_ids, attrs
177
+ ```
178
+
179
+ #### Campaigns Metrics
180
+
181
+ Endpoint: `GET /campaigns/metrics`
182
+
183
+ ```ruby
184
+ campaigns = Iterable::Campaigns.new
185
+ campaign_ids = [754321, 4321, 3456]
186
+ end_time = Time.now
187
+ start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
188
+ response = campaigns.metrics campaign_ids, start_time, end_time
189
+ ```
190
+
191
+ #### Campaigns Rrecurring
192
+
193
+ Endpoint: `GET /campaigns/recurring/{id}/childCampaigns`
194
+
195
+ ```ruby
196
+ campaigns = Iterable::Campaigns.new
197
+ response = campaigns.recurring 'campaign-id'
198
+ ```
199
+
200
+
201
+ ### Channels
202
+
203
+ #### Channels All
204
+
205
+ Endpoint: `GET /channels`
206
+
207
+ ```ruby
208
+ channels = Iterable::Channels.new
209
+ response = channels.all
210
+ ```
211
+
212
+ ### Commerce
213
+
214
+ #### Commerce Track Purchase
215
+
216
+ Endpoint: `POST /commerce/trackPurchase`
217
+
218
+ ```ruby
219
+ # Set up items to track
220
+ items = [{
221
+ id: 'abcd-1234-hjkl-4321',
222
+ name: 'Mustard',
223
+ price: 34.0,
224
+ quantity: 13
225
+ }]
226
+ # Calculate total of items i.e. 34.0
227
+ total = items.reduce(0) { |total, item| total += item.fetch(:price, 0.0) }
228
+ # Gather user information for purchase
229
+ user = { userId: '42', email: 'user@example.com' }
230
+
231
+ commerce = Iterable::Commerce.new
232
+ response = commerce.track_purchase total, items, user
233
+ ```
234
+
235
+ #### Commerce Update Cart
236
+
237
+ Endpoint: `POST /commerce/updateCart`
238
+
239
+ ```ruby
240
+ # Items to update the user's cart with
241
+ items = [{
242
+ id: 'abcd-1234-hjkl-4321',
243
+ name: 'Mustard',
244
+ price: 34.0,
245
+ quantity: 13
246
+ }]
247
+ # User of the cart you want to update
248
+ user = { userId: '42', email: 'user@example.com' }
249
+
250
+ commerce = Iterable::Commerce.new
251
+ response = commerce.update_cart items, user
252
+ ```
253
+
254
+ ### Device
255
+
256
+ #### Device Register Token
257
+
258
+ Endpoint: `POST /users/registerDeviceToken`
259
+
260
+ ```ruby
261
+ data_fields = { some: 'data', fields: 'here' }
262
+ device = Device.new 'token', 'mobile-push-app', Iterable::Device::APNS, data_fields
263
+ device.register 'foo@example.com'
264
+
265
+ # Can pass in a user ID as well
266
+ device.register 'user@example.com', '42'
267
+ ```
268
+
269
+ ### Email
270
+
271
+ #### Email View
272
+
273
+ Endpoint: `GET /email/viewInBrowser`
274
+
275
+ ```ruby
276
+ email = Iterable::Email.new
277
+ response = email.view 'user@example.com', 'message-id'
278
+ ```
279
+
280
+ ### Email Templates
281
+
282
+ #### Email Templates Get
283
+
284
+ Endpoint: `GET /templates/email/get`
285
+
286
+ ```ruby
287
+ templates = Iterable::EmailTemplates.new
288
+ response = templates.get 'template-id'
289
+ ```
290
+
291
+ #### Email Templates Update
292
+
293
+ Endpoint: `POST /templates/email/update`
294
+
295
+ ```ruby
296
+ templates = Iterable::EmailTemplates.new
297
+ # Additional template attributes
298
+ attrs = { metadata: {}, name: 'name', fromEmail: 'co@co.co' }
299
+ response = templates.update 'template-id', attrs
300
+ ```
301
+
302
+ #### Email Templates Upsert
303
+
304
+ Endpoint: `POST /templates/email/update`
305
+
306
+ ```ruby
307
+ templates = Iterable::EmailTemplates.new
308
+ # Additional template attributes
309
+ attrs = { metadata: {}, name: 'name', fromEmail: 'co@co.co' }
310
+ response = templates.upsert 'client-template-id', attrs
311
+ ```
312
+
313
+ ### Events
314
+
315
+ #### Events for Email
316
+
317
+ Endpoint: `GET /events/{email}`
318
+
319
+ ```ruby
320
+ events = Iterable::Events.new
321
+ # Default limit of 30
322
+ response = events.for_email 'user@example.com'
323
+ ```
324
+
325
+ #### Events Track
326
+
327
+ Endpoint: `POST /events/track`
328
+
329
+ ```ruby
330
+ events = Iterable::Events.new
331
+ # Any aditional attributes for the event
332
+ attrs = { campaignId: 42, dataFields: {} }
333
+ response = events.track 'event-name', 'user@example.com', attrs
334
+ ```
335
+
336
+ #### Events Track Push Open
337
+
338
+ Endpoint: `GET /events/{email}`
339
+
340
+ ```ruby
341
+ events = Iterable::Events.new
342
+ response = events.for_email 'user@example.com'
343
+ campaign_id = 42
344
+ message_id = 123
345
+ # Any aditional attributes for the event
346
+ attrs = { dataFields: {} }
347
+ response = events.track_push_open campaign_id, message_id, 'user@example.com', attrs
348
+ ```
349
+
350
+ ### Experiments
351
+
352
+ #### Experiments Metrics
353
+
354
+ Endpoint: `GET /experiments/metrics`
355
+
356
+ ```ruby
357
+ experiment_ids = [1, 2, 3, 4]
358
+ experiments = Iterable::Experiments.new experiment_ids
359
+ end_time = Time.now
360
+ start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
361
+ response = experiments.metrics campaign_ids, start_time, end_time
362
+ ```
363
+
364
+ ### Export
365
+
366
+ #### Export JSON
367
+
368
+ Endpoint: `GET /export/data.json`
369
+
370
+ ```ruby
371
+ exporter = Iterable::JsonExporter.new Iterable::Export::EMAIL_SEND_TYPE
372
+
373
+ # Export with an iterable range
374
+ response = exporter.export_range Iterable::Export::BEFORE_TODAY
375
+
376
+ # Export with a custom time range
377
+ end_time = Time.now
378
+ start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
379
+ response = exporter.export start_time, end_time
380
+ ```
381
+
382
+ #### Export CSV
383
+
384
+ Endpoint: `GET /export/data.csv`
385
+
386
+ ```ruby
387
+ exporter = Iterable::CsvExporter.new Iterable::Export::EMAIL_SEND_TYPE
388
+
389
+ # Export with an iterable range
390
+ response = exporter.export_range Iterable::Export::BEFORE_TODAY
391
+
392
+ # Export with a custom time range
393
+ end_time = Time.now
394
+ start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
395
+ response = exporter.export start_time, end_time
396
+ ```
397
+
398
+ ### Lists
399
+
400
+ #### Lists All
401
+
402
+ Endpoint: `GET /lists`
403
+
404
+ ```ruby
405
+ lists = Iterable::Lists.new
406
+ response = lists.all
407
+ ```
408
+
409
+ #### Lists Create
410
+
411
+ Endpoint: `POST /lists`
412
+
413
+ ```ruby
414
+ lists = Iterable::Lists.new
415
+ response = lists.create 'list-name'
416
+ ```
417
+
418
+ #### Lists Delete
419
+
420
+ Endpoint: `DELETE /lists/{listId}`
421
+
422
+ ```ruby
423
+ lists = Iterable::Lists.new
424
+ response = lists.delete 'list-id'
425
+ ```
426
+
427
+ #### Lists Get Users
428
+
429
+ Endpoint: `GET /lists/getUsers`
430
+
431
+ ```ruby
432
+ lists = Iterable::Lists.new
433
+ response = lists.users 'list-id'
434
+ ```
435
+
436
+ #### Lists Subscribe
437
+
438
+ Endpoint: `POST /lists/subscribe`
439
+
440
+ ```ruby
441
+ lists = Iterable::Lists.new
442
+ subscribers = [
443
+ { email: 'user@example.com', dataFields: {}, userId: '42' }
444
+ ]
445
+ response = lists.subscribe 'list-id', subscribers
446
+ ```
447
+
448
+ #### Lists Unsubscribe
449
+
450
+ Endpoint: `POST /lists/unsubscribe`
451
+
452
+ ```ruby
453
+ lists = Iterable::Lists.new
454
+ subscribers = [
455
+ { email: 'user@example.com', dataFields: {}, userId: '42' }
456
+ ]
457
+ response = lists.unsubscribe 'list-id', subscribers
458
+ ```
459
+
460
+ ### Message Types
461
+
462
+ #### Message Types All
463
+
464
+ Endpoint: `GET /messageTypes`
465
+
466
+ ```ruby
467
+ metadata = Iterable::MessageTypes.new
468
+ response = metadata.all
469
+ ```
470
+
471
+ ### Metadata
472
+
473
+ #### Metadata Get
474
+
475
+ Endpoint: `GET /metadata`
476
+
477
+ ```ruby
478
+ metadata = Iterable::Metadata.new
479
+ response = metadata.get
480
+ ```
481
+
482
+ #### Metadata List Keys
483
+
484
+ Endpoint: `GET /metadata/{table}`
485
+
486
+ ```ruby
487
+ metadata_table = Iterable::MetadataTable.new 'table-name'
488
+ response = metadata_table.list_keys
489
+
490
+ # Next marker is thenext result set id which is returned by previous
491
+ # search if more hits exist
492
+ response = metadata_table.list_keys 'next-marker-id'
493
+ ```
494
+
495
+ #### Metadata Delete Key
496
+
497
+ Endpoint: `DELETE /metadata/{table}`
498
+
499
+ ```ruby
500
+ metadata_table = Iterable::MetadataTable.new 'table-name'
501
+ response = metadata_table.delete
502
+ ```
503
+
504
+ #### Metadata Get Key
505
+
506
+ Endpoint: `GET /metadata/{table}/{key}`
507
+
508
+ ```ruby
509
+ metadata_table = Iterable::MetadataTable.new 'table-name'
510
+ response = metadata_table.get 'metadata-key'
511
+ ```
512
+
513
+ #### Metadata Remove Key
514
+
515
+ Endpoint: `DELETE /metadata/{table}/{key}`
516
+
517
+ ```ruby
518
+ metadata_table = Iterable::MetadataTable.new 'table-name'
519
+ response = metadata_table.remove 'metadata-key'
520
+ ```
521
+
522
+ #### Metadata Add Key
523
+
524
+ Endpoint: `PUT /metadata/{table}/{key}`
525
+
526
+ ```ruby
527
+ metadata_table = Iterable::MetadataTable.new 'table-name'
528
+ value = { foo: 'bar', data: 'stuffs' }
529
+ response = metadata_table.add 'metadata-key', value
530
+ ```
531
+
532
+ ### Push Templates
533
+
534
+ #### Push Templates Get
535
+
536
+ Endpoint: `GET /templates/push/get`
537
+
538
+ ```ruby
539
+ templates = Iterable::PushTemplates.new
540
+ # Additional template params to query by
541
+ params = { locale: 'en-US' }
542
+ response = templates.get 'template-id', params
543
+ ```
544
+
545
+ #### Push Templates Update
546
+
547
+ Endpoint: `POST /templates/push/update`
548
+
549
+ ```ruby
550
+ templates = Iterable::PushTemplates.new
551
+ # Additional template attrs to update
552
+ attrs = { name: 'Template', message: 'Template message'}
553
+ response = templates.update 'client-template-id', attrs
554
+ ```
555
+
556
+ #### Push Templates Upsert
557
+
558
+ Endpoint: `POST /templates/push/upsert`
559
+
560
+ ```ruby
561
+ templates = Iterable::PushTemplates.new
562
+ # Additional template attrs to upsert
563
+ attrs = { name: 'Template', message: 'Template message'}
564
+ response = templates.upsert 'client-template-id', attrs
565
+ ```
566
+
567
+ ### Templates
568
+
569
+ #### Templates All
570
+
571
+ Endpoint: `GET /templates`
572
+
573
+ ```ruby
574
+ templates = Iterable::Templates.new
575
+ # Additional params to filter and search by
576
+ params = { templateType: Iterable::Templates::BLAST_TYPE, messageMedium: Iterable::MessageTypes::EMAIL_MEDIUM }
577
+ response = templates.all params
578
+ ```
579
+
580
+ #### Templates Get
581
+
582
+ Endpoint: `GET /templates/getByClientTemplateId`
583
+
584
+ ```ruby
585
+ templates = Iterable::Templates.new
586
+ response = templates.for_client_template_id 'client-template-id'
587
+ ```
588
+
589
+ ### Users
590
+
591
+ #### Users Update
592
+
593
+ Endpoint: `POST /users/update`
594
+
595
+ ```ruby
596
+ users = Iterable::Users.new
597
+ # Additional attributes to send
598
+ attrs = { userID: 'custom-id' }
599
+ response = users.update 'user@example.com', attrs
600
+ ```
601
+
602
+ #### Users Bulk Update
603
+
604
+ Endpoint: `POST /users/bulkUpdate`
605
+
606
+ ```ruby
607
+ users = Iterable::Users.new
608
+ # Array of users to update by email with additional
609
+ # fields if needed
610
+ users = [
611
+ { email: 'user@example.com', userID: 'custom-id' }
612
+ ]
613
+ response = users.bulk_update users
614
+ ```
615
+
616
+ #### Users Update Subscriptions
617
+
618
+ Endpoint: `POST /users/updateSubscriptions`
619
+
620
+ ```ruby
621
+ users = Iterable::Users.new
622
+ # Additional attributes to send
623
+ attrs = { userID: 'custom-id' }
624
+ response = users.update_subscriptions 'user@example.com', attrs
625
+ ```
626
+
627
+ #### Users Bulk Update Subscriptions
628
+
629
+ Endpoint: `POST /users/bulkUpdateSubscriptions`
630
+
631
+ ```ruby
632
+ users = Iterable::Users.new
633
+ # Array of users to update by email with additional
634
+ # fields if needed
635
+ users = [
636
+ { email: 'user@example.com', userID: 'custom-id' }
637
+ ]
638
+ response = users.bulk_update_subscriptions users
639
+ ```
640
+
641
+ #### Users For Email
642
+
643
+ Endpoint: `GET /users/{email}`
644
+
645
+ ```ruby
646
+ users = Iterable::Users.new
647
+ response = users.for_email 'user@example.com'
648
+ ```
649
+
650
+ #### Users For ID
651
+
652
+ Endpoint: `GET /users/byUserID/{userID}`
653
+
654
+ ```ruby
655
+ users = Iterable::Users.new
656
+ response = users.for_id '42'
657
+ ```
658
+
659
+ #### Users Get Fields
660
+
661
+ Endpoint: `GET /users/getFields`
662
+
663
+ ```ruby
664
+ users = Iterable::Users.new
665
+ response = users.fields
666
+ ```
667
+
668
+ #### Users Update Email
669
+
670
+ Endpoint: `POST /users/updateEmail`
671
+
672
+ ```ruby
673
+ users = Iterable::Users.new
674
+ response = users.update_email 'old-email@me.com', 'new-email@email.me'
675
+ ```
676
+
677
+ #### Users Delete
678
+
679
+ Endpoint: `DELETE /users/{email}`
680
+
681
+ ```ruby
682
+ users = Iterable::Users.new
683
+ response = users.delete 'user@example.com'
684
+ ```
685
+
686
+ #### Users Delete By ID
687
+
688
+ Endpoint: `DELETE /users/byUserId/{userID}`
689
+
690
+ ```ruby
691
+ users = Iterable::Users.new
692
+ response = users.delete_by_id '42'
693
+ ```
694
+
695
+ #### Users Register Browser Token
696
+
697
+ Endpoint: `POST /users/registerBrowserToken`
698
+
699
+ ```ruby
700
+ users = Iterable::Users.new
701
+ # Additional attrs to associate with token
702
+ attrs = { userID: '42' }
703
+ response = users.register_browser_token 'user@example.com', 'the-token', attrs
704
+ ```
705
+
706
+ #### Users Disable Device
707
+
708
+ Endpoint: `POST /users/registerBrowserToken`
709
+
710
+ ```ruby
711
+ users = Iterable::Users.new
712
+ response = users.disable_device 'the-token', 'user@example.com'
713
+
714
+ # Optionally can use a user ID over email
715
+ response = users.disable_device 'the-token', nil, '42'
716
+ ```
717
+
718
+ #### Users Get Sent Messages
719
+
720
+ Endpoint: `POST /users/update`
721
+
722
+ ```ruby
723
+ users = Iterable::Users.new
724
+ # Additional params to filter and query by
725
+ params = { campaignId: 'custom-id', limit: 30 }
726
+ end_time = Time.now
727
+ start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
728
+ response = users.sent_messages 'user@example.com', start_time, end_time, params
729
+ ```
730
+
731
+ ### Workflows
732
+
733
+ #### Workflows Trigger
734
+
735
+ Endpoint: `POST /workflows/triggerWorkflow`
736
+
737
+ ```ruby
738
+ workflows = Iterable::Workflows.new
739
+ # Additional attributes to send
740
+ attrs = { listId: 'listId' }
741
+ response = workflows.trigger 'workflow-id', attrs
742
+ ```
13
743
 
744
+ [api-docs]: https://api.iterable.com/api/docs
745
+ [docs]: http://www.rubydoc.info/gems/iterable-api-client
14
746
  [iterable]: https://iterable.com