lfi
🦥 A lazy functional iteration library supporting sync, async, and concurrent iteration.
- 352
- TypeScript
- Apache-2.0
- 11 mo ago
Iterable REST API Ruby gem **GITLAB MIRROR**
Repo mtchavez/iterable-api-client, read from GitHub 8 h ago. mtchavez has not joined Take My Repo.
mtchavez/iterable-api-client is a public repo on GitHub by mtchavez. Iterable REST API Ruby gem **GITLAB MIRROR**. It declares the MIT license on GitHub. It is written mainly in Ruby, has 11 stars and last changed on 2024-01-05. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Rubygem to interact with the Iterable API.
Source code on Gitlab.
gem install iterable-api-client
or with Bundler in your Gemfile
gem 'iterable-api-client'
Documentation can be found on rubydoc or in this README
The Iterable API documentation can be a helpful reference for looking up all the possible endpoint data interactions. The docs outline all the possible parameters to each endpoints as well as custom data fields.
Configure the gem with a default global configuration to use.
Iterable.configure do |config|
config.token = 'api-token'
end
If you have multiple tokens to use you can create a Iterable::Config object
with a different token from the global default and pass in on requests.
# Creating a new config with a different token
conf = Iterable::Config.new(token: 'new-token')
# Example of using it with the campaigns endpoints
# which will then make API requests using the passed in config
campaigns = Iterable::Campaigns.new(config)
Response objects will attempt to parse the API response as JSON using the multi_json
gem so you can have your own JSON parser handle the loading of responses.
You can access some of the response data for example:
templates = Iterable::Templates.new
response = templates.all
# Check if the response code is a succesfull HTTP Code from 200-299
response.success?
# Get response code
response.code
# Body of response - will attempt to parse as JSON
response.body
# HTTP message
response.message
# Headers of response
response['Content-Type']
# => 'application/json; charset=utf-8'
# The URI used to make the request for the response
reponse.uri
Beta access only endpoint
Endpoint: POST /catalogs/{catalogName}/items
catalog = 'my-catalog'
catalog_items = Iterable::BulkCatalogItems.new(catalog)
# Hash of item id to item values
create_items = {
'122343453' => {
name: 'item name',
status: 'open'
}
}
response = catalog_items.create(create_items, replace_uploaded_fields_only: true)
# Use replace_uploaded_fields_only as true to update fields
# of existing items. Otherwise the default is to replace
# existing items
Endpoint: DELETE /catalogs/{catalogName}/items
catalog = 'my-catalog'
catalog_items = Iterable::BulkCatalogItems.new(catalog)
item_ids = ['12345', '12346', '12347']
response = catalog_items.delete(item_ids)
Endpoint: GET /campaigns
campaigns = Iterable::Campaigns.new
response = campaigns.all
Endpoint: POST /campaigns/create
campaigns = Iterable::Campaigns.new
# List IDs to associate with the campaign
list_ids = [1234, 1235, 1236]
# Additional campaign attributes
attrs = { dataFields: { foo: 'bar' } }
response = campaigns.create 'name', 'template-id', list_ids, attrs
Endpoint: GET /campaigns/metrics
campaigns = Iterable::Campaigns.new
campaign_ids = [754321, 4321, 3456]
end_time = Time.now
start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
response = campaigns.metrics campaign_ids, start_time, end_time
Endpoint: GET /campaigns/recurring/{id}/childCampaigns
campaigns = Iterable::Campaigns.new
response = campaigns.recurring 'campaign-id'
Beta access only endpoint
Endpoint: POST /catalogs/{catalogName}
catalog = 'my-catalog'
catalogs = Iterable::Catalogs.new(catalog)
response = catalogs.create
Endpoint: DELETE /catalogs/{catalogName}
catalog = 'my-catalog'
catalogs = Iterable::Catalogs.new(catalog)
response = catalogs.delete
Endpoint: GET /catalogs/{catalogName}
catalog = 'my-catalog'
catalogs = Iterable::Catalogs.new(catalog)
params = { page: 1, pageSize: 20 }
response = catalogs.names(params)
Beta access only endpoint
Endpoint: GET /catalogs/{catalogName}/fieldMappings
catalog = 'my-catalog'
catalog_field_mappings = Iterable::CatalogFieldMappings.new(catalog)
response = catalog_field_mappings.get
response.body['params']['definedMappings']
Endpoint: PUT /catalogs/{catalogName}/fieldMappings
catalog = 'my-catalog'
field_mappings = [{fieldName: 'test-field', fieldType: 'string'}]
catalog_field_mappings = Iterable::CatalogFieldMappings.new(catalog)
catalog_field_mappings.update(field_mappings)
Beta access only endpoint
Endpoint: GET /catalogs/{catalogName}/items
catalog = 'my-catalog'
catalog_items = Iterable::CatalogItems.new(catalog)
response = catalog_items.all
Endpoint: PUT /catalogs/{catalogName}/items/{itemId}
catalog = 'my-catalog'
item_id = '1234-abcd-1234-abcd'
catalog_items = Iterable::CatalogItems.new(catalog, item_id)
item_attrs = { name: 'item name', status: 'open' }
response = catalog_items.create(item_attrs)
Endpoint: PATCH /catalogs/{catalogName}/items/{itemId}
catalog = 'my-catalog'
item_id = '1234-abcd-1234-abcd'
catalog_items = Iterable::CatalogItems.new(catalog, item_id)
item_attrs = { name: 'item name', status: 'open' }
response = catalog_items.update(item_attrs)
Endpoint: GET /catalogs/{catalogName}/items/{itemId}
catalog = 'my-catalog'
item_id = '1234-abcd-1234-abcd'
catalog_items = Iterable::CatalogItems.new(catalog, item_id)
response = catalog_items.get
Endpoint: DELETE /catalogs/{catalogName}/items/{itemId}
catalog = 'my-catalog'
item_id = '1234-abcd-1234-abcd'
catalog_items = Iterable::CatalogItems.new(catalog, item_id)
response = catalog_items.delete
Beta access only endpoint
Endpoint: POST /catalogs/{catalogName}
catalog = 'my-catalog'
catalog_items = Iterable::Catalogs.new(catalog)
response = catalog_items.create
Endpoint: DELETE /catalogs/{catalogName}
catalog = 'my-catalog'
catalog_items = Iterable::Catalogs.new(catalog)
response = catalog_items.delete
Endpoint: GET /catalogs/{catalogName}/names
catalog = 'my-catalog'
catalog_items = Iterable::Catalogs.new(catalog)
params = { page: 1, pageSize: 20 }
response = catalog_items.names(params)
Endpoint: GET /channels
channels = Iterable::Channels.new
response = channels.all
Endpoint: POST /commerce/trackPurchase
# Set up items to track
items = [{
id: 'abcd-1234-hjkl-4321',
name: 'Mustard',
price: 34.0,
quantity: 13
}]
# Calculate total of items i.e. 34.0
total = items.reduce(0) { |total, item| total += item.fetch(:price, 0.0) }
# Gather user information for purchase
user = { userId: '42', email: 'user@example.com' }
commerce = Iterable::Commerce.new
response = commerce.track_purchase total, items, user
Endpoint: POST /commerce/updateCart
# Items to update the user's cart with
items = [{
id: 'abcd-1234-hjkl-4321',
name: 'Mustard',
price: 34.0,
quantity: 13
}]
# User of the cart you want to update
user = { userId: '42', email: 'user@example.com' }
commerce = Iterable::Commerce.new
response = commerce.update_cart items, user
Endpoint: POST /users/registerDeviceToken
data_fields = { some: 'data', fields: 'here' }
device = Device.new 'token', 'mobile-push-app', Iterable::Device::APNS, data_fields
device.register 'foo@example.com'
# Can pass in a user ID as well
device.register 'user@example.com', '42'
Endpoint: GET /email/viewInBrowser
email = Iterable::Email.new
response = email.view 'user@example.com', 'message-id'
Endpoint: GET /email/target
email = Iterable::Email.new
# User email and campaign to target
response = email.target 'user@example.com', 42
# Can pass in more attributes like dataFields
response = email.target 'user@example.com', 42, { dataFields: { first_name: 'Sally' } }
Endpoint: GET /templates/email/get
templates = Iterable::EmailTemplates.new
response = templates.get 'template-id'
Endpoint: POST /templates/email/update
templates = Iterable::EmailTemplates.new
# Additional template attributes
attrs = { metadata: {}, name: 'name', fromEmail: 'co@co.co' }
response = templates.update 'template-id', attrs
Endpoint: POST /templates/email/update
templates = Iterable::EmailTemplates.new
# Additional template attributes
attrs = { metadata: {}, name: 'name', fromEmail: 'co@co.co' }
response = templates.upsert 'client-template-id', attrs
Endpoint: GET /events/{email}
events = Iterable::Events.new
# Default limit of 30
response = events.for_email 'user@example.com'
Endpoint: POST /events/track
events = Iterable::Events.new
# Any aditional attributes for the event
attrs = { campaignId: 42, dataFields: {} }
response = events.track 'event-name', 'user@example.com', attrs
Endpoint: POST /events/trackBulk
events = Iterable::Events.new
# Array of events to track
events_attrs = [
{ email: 'user@example.com', eventName: 'event-name', campaignId: 42, dataFields: {} }
]
response = iterable_events.track_bulk events_attrs
Endpoint: GET /events/{email}
events = Iterable::Events.new
response = events.for_email 'user@example.com'
campaign_id = 42
message_id = 123
# Any aditional attributes for the event
attrs = { dataFields: {} }
response = events.track_push_open campaign_id, message_id, 'user@example.com', attrs
Endpoint: GET /experiments/metrics
experiment_ids = [1, 2, 3, 4]
experiments = Iterable::Experiments.new experiment_ids
end_time = Time.now
start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
response = experiments.metrics campaign_ids, start_time, end_time
Endpoint: GET /export/data.json
exporter = Iterable::JsonExporter.new Iterable::Export::EMAIL_SEND_TYPE
# Export with an iterable range
response = exporter.export_range Iterable::Export::BEFORE_TODAY
# Export with a custom time range
end_time = Time.now
start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
response = exporter.export start_time, end_time
Endpoint: GET /export/data.csv
exporter = Iterable::CsvExporter.new Iterable::Export::EMAIL_SEND_TYPE
# Export with an iterable range
response = exporter.export_range Iterable::Export::BEFORE_TODAY
# Export with a custom time range
end_time = Time.now
start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
response = exporter.export start_time, end_time
Endpoint: GET /inApp/getMessages
in_app = Iterable::InApp.new
# Get messages for a user by email
email = 'user@example.com'
response = in_app.messages_for_email email, count: 10
# Get messages for a user by user_id
email = 'user@example.com'
response = in_app.messages_for_user_id 42, count: 2
# Pass in query parameters
email = 'user@example.com'
attrs = { 'platform' => 'iOS' }
response = in_app.messages_for_email email, attrs
Endpoint: POST /inApp/target
in_app = Iterable::InApp.new
# Needs campaign ID and an optional email
email = 'user@example.com'
attrs = { 'campaignId' => '123456asdf' }
response = in_app.target attrs: attrs, email: email
Endpoint: POST /push/cancel
in_app = Iterable::InApp.new
# Needs campaign ID and an optional email and optional attrs for request
email = 'user@example.com'
campaign_id = '12345asdf'
attrs = {}
response = in_app.target campaign_id: campaign_id, attrs: attrs, email: email
Endpoint: GET /lists
lists = Iterable::Lists.new
response = lists.all
Endpoint: POST /lists
lists = Iterable::Lists.new
response = lists.create 'list-name'
Endpoint: DELETE /lists/{listId}
lists = Iterable::Lists.new
response = lists.delete 'list-id'
Endpoint: GET /lists/getUsers
lists = Iterable::Lists.new
response = lists.users 'list-id'
Endpoint: POST /lists/subscribe
lists = Iterable::Lists.new
subscribers = [
{ email: 'user@example.com', dataFields: {}, userId: '42' }
]
response = lists.subscribe 'list-id', subscribers
Endpoint: POST /lists/unsubscribe
lists = Iterable::Lists.new
subscribers = [
{ email: 'user@example.com', dataFields: {}, userId: '42' }
]
response = lists.unsubscribe 'list-id', subscribers
Endpoint: GET /messageTypes
metadata = Iterable::MessageTypes.new
response = metadata.all
Endpoint: GET /metadata
metadata = Iterable::Metadata.new
response = metadata.get
Endpoint: GET /metadata/{table}
metadata_table = Iterable::MetadataTable.new 'table-name'
response = metadata_table.list_keys
# Next marker is thenext result set id which is returned by previous
# search if more hits exist
response = metadata_table.list_keys 'next-marker-id'
Endpoint: DELETE /metadata/{table}
metadata_table = Iterable::MetadataTable.new 'table-name'
response = metadata_table.delete
Endpoint: GET /metadata/{table}/{key}
metadata_table = Iterable::MetadataTable.new 'table-name'
response = metadata_table.get 'metadata-key'
Endpoint: DELETE /metadata/{table}/{key}
metadata_table = Iterable::MetadataTable.new 'table-name'
response = metadata_table.remove 'metadata-key'
Endpoint: PUT /metadata/{table}/{key}
metadata_table = Iterable::MetadataTable.new 'table-name'
value = { foo: 'bar', data: 'stuffs' }
response = metadata_table.add 'metadata-key', value
Endpoint: POST /push/target
push = Iterable::Push.new
campaign_id = '1234asdf'
email = 'user@example.com' # optional
attrs = {} # optional extra params for the request
response = push.target campaign_id: campaign_id, email: email, attrs: attrs
Endpoint: POST /push/cancel
push = Iterable::Push.new
campaign_id = '1234asdf'
email = 'user@example.com' # optional
attrs = {} # optional extra params for the request
response = push.cancel email: email, campaign_id: campaign_id, attrs: attrs
Endpoint: GET /templates/push/get
templates = Iterable::PushTemplates.new
# Additional template params to query by
params = { locale: 'en-US' }
response = templates.get 'template-id', params
Endpoint: POST /templates/push/update
templates = Iterable::PushTemplates.new
# Additional template attrs to update
attrs = { name: 'Template', message: 'Template message'}
response = templates.update 'client-template-id', attrs
Endpoint: POST /templates/push/upsert
templates = Iterable::PushTemplates.new
# Additional template attrs to upsert
attrs = { name: 'Template', message: 'Template message'}
response = templates.upsert 'client-template-id', attrs
Endpoint: GET /templates
templates = Iterable::Templates.new
# Additional params to filter and search by
params = { templateType: Iterable::Templates::BLAST_TYPE, messageMedium: Iterable::MessageTypes::EMAIL_MEDIUM }
response = templates.all params
Endpoint: GET /templates/getByClientTemplateId
templates = Iterable::Templates.new
response = templates.for_client_template_id 'client-template-id'
Endpoint: POST /users/update
users = Iterable::Users.new
# Additional attributes to send
attrs = { userID: 'custom-id' }
response = users.update 'user@example.com', attrs
Endpoint: POST /users/bulkUpdate
users = Iterable::Users.new
# Array of users to update by email with additional
# fields if needed
users_attrs = [
{ email: 'user@example.com', userID: 'custom-id' }
]
response = users.bulk_update users_attrs
Endpoint: POST /users/updateSubscriptions
users = Iterable::Users.new
# Additional attributes to send
attrs = { userID: 'custom-id' }
response = users.update_subscriptions 'user@example.com', attrs
Endpoint: POST /users/bulkUpdateSubscriptions
users = Iterable::Users.new
# Array of users to update by email with additional
# fields if needed
users = [
{ email: 'user@example.com', userID: 'custom-id' }
]
response = users.bulk_update_subscriptions users
Endpoint: GET /users/{email}
users = Iterable::Users.new
response = users.for_email 'user@example.com'
Endpoint: GET /users/byUserID/{userID}
users = Iterable::Users.new
response = users.for_id '42'
Endpoint: GET /users/getFields
users = Iterable::Users.new
response = users.fields
Endpoint: POST /users/updateEmail
users = Iterable::Users.new
response = users.update_email 'old-email@me.com', 'new-email@email.me'
Endpoint: DELETE /users/{email}
users = Iterable::Users.new
response = users.delete 'user@example.com'
Endpoint: DELETE /users/byUserId/{userID}
users = Iterable::Users.new
response = users.delete_by_id '42'
Endpoint: POST /users/registerBrowserToken
users = Iterable::Users.new
# Additional attrs to associate with token
attrs = { userID: '42' }
response = users.register_browser_token 'user@example.com', 'the-token', attrs
Endpoint: POST /users/registerBrowserToken
users = Iterable::Users.new
response = users.disable_device 'the-token', 'user@example.com'
# Optionally can use a user ID over email
response = users.disable_device 'the-token', nil, '42'
Endpoint: POST /users/update
users = Iterable::Users.new
# Additional params to filter and query by
params = { campaignId: 'custom-id', limit: 30 }
end_time = Time.now
start_time = end_time - (60 * 60* 24 * 7) # 7 days ago
response = users.sent_messages 'user@example.com', start_time, end_time, params
Endpoint: POST /users/forget
users = Iterable::Users.new
# Additional params to filter and query by
email = 'user@example.com'
response = users.forget email
Endpoint: POST /workflows/triggerWorkflow
workflows = Iterable::Workflows.new
# Additional attributes to send
attrs = { listId: 'listId' }
response = workflows.trigger 'workflow-id', attrs
mtchavez/iterable-api-client is a public repo on GitHub by mtchavez. Iterable REST API Ruby gem **GITLAB MIRROR**.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2024-01-05. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
🦥 A lazy functional iteration library supporting sync, async, and concurrent iteration.
sync/async iterable streams for Python (concurrency, throttling, buffering, ...)
A small (~900B gzip), useful set of methods for lazy iteration of iterables.
