maropost-api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +615 -1
- data/lib/maropost_api/products_and_revenue.rb +2 -1
- data/lib/maropost_api/relational_tables.rb +1 -1
- data/lib/maropost_api/version.rb +1 -1
- data/maropost_api.gemspec +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65c966cdbe544cf0e317c740454efb0f39b5f6d8
|
4
|
+
data.tar.gz: 35cc46edca3426bfd5e9bd05f111893bb720694f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09b2daa87ba1acacdfd2fd58b83ae95fd08db22663a55eb3e047457e3637bb6d46a503be34e61916e85b45b49ab450ce1ef7bd386f876ed5cc2cee296c4857cc
|
7
|
+
data.tar.gz: 46304b217b24685987656402d885684d9d8d2179a31cb6ac5cbdb9efdba47caeccc177b981e900c8416996f2fc2fbbfb9751b92449f49b0fd72c739a4a4c9a7c
|
data/README.md
CHANGED
@@ -1 +1,615 @@
|
|
1
|
-
#
|
1
|
+
# Summary
|
2
|
+
|
3
|
+
This provides programmatic access to several services within the Maropost API. The functions contained perform actions against your Maropost account, and they return a result object indicating success/failure, any Exceptions thrown, and the resulting data.
|
4
|
+
|
5
|
+
# Installation
|
6
|
+
|
7
|
+
[RubyGems](https://rubygems.org/) is the standard Ruby packaging system. You can find this package at https://rubygems.org/gems/maropost-api. You can install this gem by running
|
8
|
+
|
9
|
+
gem install maropost-api
|
10
|
+
|
11
|
+
# Usage
|
12
|
+
To use a service, first instantiate it, providing your Maropost account_id
|
13
|
+
and Auth Token. For example, to get your list of reports using the Reports
|
14
|
+
service, execute:
|
15
|
+
|
16
|
+
reports = MaropostApi::Reports.new(account_id, auth_token)
|
17
|
+
result = reports.Get(1);
|
18
|
+
if result.success {
|
19
|
+
myReports = result.data;
|
20
|
+
}
|
21
|
+
|
22
|
+
The result object contains two fields:
|
23
|
+
|
24
|
+
- `success` (bool)
|
25
|
+
- `errors` (object)
|
26
|
+
|
27
|
+
If `success` is `false`, then `errors` will have details about the reason for
|
28
|
+
failure. If `errors` is not `nil`, then `success` will always be `false`.
|
29
|
+
|
30
|
+
The object might also contain one property, `data` (dynamic), which contains whatever
|
31
|
+
data the operation itself provides. Some operations, such as `delete()`
|
32
|
+
operations, might not provide any data.
|
33
|
+
|
34
|
+
# Specific APIs
|
35
|
+
The specific APIs contained are:
|
36
|
+
|
37
|
+
- [Campaigns](#campaigns)
|
38
|
+
- [AB Test Campaigns](#ab-test-campaigns)
|
39
|
+
- [Transactional Campaigns](#transactional-campaigns)
|
40
|
+
- [Contacts](#contacts)
|
41
|
+
- [Journeys](#journeys)
|
42
|
+
- [Product and Revenue](#product-and-revenue)
|
43
|
+
- [Relational Table Rows](#relational-table-rows)
|
44
|
+
- [Reports](#reports)
|
45
|
+
|
46
|
+
## Campaigns
|
47
|
+
### Instantiation:
|
48
|
+
|
49
|
+
MaropostApi::Campaigns.new(account_id, auth_token)
|
50
|
+
|
51
|
+
### Available methods:
|
52
|
+
|
53
|
+
- `get(page)`
|
54
|
+
- returns the list of campaigns for the account
|
55
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
56
|
+
- `get_campaign(campaign_id)`
|
57
|
+
- returns the given campaign
|
58
|
+
- `get_bounce_reports(campaign_id, page)`
|
59
|
+
- returns the list of bounce reports for the given campaign ID
|
60
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
61
|
+
- `get_click_reports(campaign_id, page, unique = nil)`
|
62
|
+
- returns the list of click reports for the given campaign ID
|
63
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
64
|
+
- `unique`: `true` = get for unique contacts. Otherwise, `false`.
|
65
|
+
- `get_complaint_reports(campaign_id, page)`
|
66
|
+
- returns the list of complaint reports for the given campaign ID
|
67
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
68
|
+
- `get_delivered_reports(campaign_id, page)`
|
69
|
+
- returns the list of delivered reports for the given campaign ID
|
70
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
71
|
+
- `get_hard_bounce_reports(campaign_id, page)`
|
72
|
+
- returns the list of hard bounces for the given campaign ID
|
73
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
74
|
+
- `get_link_reports(campaign_id, page, unique = nil)`
|
75
|
+
- returns the list of link reports for the given campaign ID
|
76
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
77
|
+
- `unique`: `true` = get for unique contacts. Otherwise, `false`.
|
78
|
+
- `get_open_reports(campaign_id, page, unique = nil)`
|
79
|
+
- returns the list of open reports for the given campaign ID
|
80
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
81
|
+
- `unique`: `true` = get for unique contacts. Otherwise, `false`.
|
82
|
+
- `get_soft_bounce_reports(campaign_id, page)`
|
83
|
+
- returns the list of soft bounce reports for the given campaign ID
|
84
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
85
|
+
- `get_unsubscribe_reports(campaign_id, page)`
|
86
|
+
- returns the list of unsubscribe reports for the given campaign ID
|
87
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
88
|
+
|
89
|
+
## AB Test Campaigns
|
90
|
+
### Instantiation:
|
91
|
+
|
92
|
+
MaropostApi::AbTestCampaigns.new(account_id, auth_token)
|
93
|
+
|
94
|
+
### Available Methods:
|
95
|
+
- `create_ab_test(name, from_email, address, language, campaign_groups_attributes,`
|
96
|
+
`commit, sendAt, brand_id: nil, suppressed_list_ids: [],`
|
97
|
+
`suppressed_journey_ids: [], suppressed_segment_ids: [], emailPreviewLink: nil,`
|
98
|
+
`decided_by: nil, lists: [], ctags: [], segments: [])`
|
99
|
+
* Creates an Ab Test campaign
|
100
|
+
- `name`: name of the new campaign
|
101
|
+
- `from_email`: default sender email address for campaign emails
|
102
|
+
- `address`: default physical address included on campaign emails
|
103
|
+
- `language`: ISO 639-1 language code (e.g., "en"). 2 characters
|
104
|
+
- `campaign_groups_attributes`: array of attributes. Each attribute is itself a hash with the following properties (all strings):
|
105
|
+
- `name`: name of the group
|
106
|
+
- `content_id`: content ID
|
107
|
+
- `subject`: subject line of emails
|
108
|
+
- `from_name`: "from name" on emails
|
109
|
+
- `percentage`: percentage of emails that should be send with these settings
|
110
|
+
- `commit`: allowed values: 'Save as Draft' or 'Send Test' or 'Schedule'
|
111
|
+
- `sendAt`: should be in "yyyy-mm-dd %H:%M:%S" where %H - Hour of the day, 24-hour clock (00..23), %M - Minute of the hour (00..59), %S - Second of the minute (00..60)
|
112
|
+
- `brand_id`: brand ID as a string
|
113
|
+
- `suppressed_list_ids`: array of list IDs in string format
|
114
|
+
- `suppressed_journey_ids`: array of journey IDs in string format
|
115
|
+
- `suppressed_segment_ids`: array of segment IDs in string format
|
116
|
+
- `email_preview_link`: (string)
|
117
|
+
- `decided_by`: allowed values: ('TopChoice' for Top Choices) or ('Opens' for Highest Open Rate) or ('Clicks' for Highest Click Rate) or ('Manual' for Manual Selection) or ('click_to_open' for Highest Click-to-Open Rate) or ('conversions' for Highest Conversion Rate)
|
118
|
+
- `lists`: array of list IDs in string format
|
119
|
+
- `ctags`: array of tags in string format
|
120
|
+
- `segments`: array of segments in string format
|
121
|
+
|
122
|
+
## Transactional Campaigns
|
123
|
+
|
124
|
+
### Instantiation:
|
125
|
+
|
126
|
+
MaropostApi::TransactionalCampaigns.new(account_id, auth_token)
|
127
|
+
|
128
|
+
### Available methods:
|
129
|
+
- `get(page)`
|
130
|
+
* returns the list of Transaction Campaigns
|
131
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
132
|
+
- `create(name, subject, preheader, from_name, from_email, reply_to,`
|
133
|
+
`content_id, email_preview_link, address, language, add_ctags)`
|
134
|
+
* Creates a Transactional Campaign
|
135
|
+
- `name` campaign name
|
136
|
+
- `subject` campaign subject
|
137
|
+
- `preheader` campaign preheader
|
138
|
+
- `from_name` sender name in the email
|
139
|
+
- `from_email` sender email address
|
140
|
+
- `reply_to` reply-to email address
|
141
|
+
- `content_id`
|
142
|
+
- `email_preview_link`
|
143
|
+
- `address` physical address
|
144
|
+
- `language` ISO 639-1 language code
|
145
|
+
- `add_ctags` array of campaign tags
|
146
|
+
|
147
|
+
- `send_email(campaign_id,
|
148
|
+
content: {},
|
149
|
+
contact: {},
|
150
|
+
send_time: {},
|
151
|
+
ignore_dnm: nil,
|
152
|
+
bcc: nil,
|
153
|
+
from_name: nil,
|
154
|
+
from_email: nil,
|
155
|
+
subject: nil,
|
156
|
+
reply_to: nil,
|
157
|
+
address: nil,
|
158
|
+
tags: {},
|
159
|
+
add_ctags: [])`
|
160
|
+
* Sends a transactional campaign email to a recipient contact. Sender's information will be automatically fetched from the transactional campaign, unless provided in the function arguments.
|
161
|
+
- `campaign_id`: must be a campaign that already exists when you call `get()`. If you don't have one, first call `create(...)`.
|
162
|
+
- `content`: hash with the following fields: `name`, `html_part`, `text_part`
|
163
|
+
- `ignoreDnm`: If true, ignores the Do Not Mail list for the recipient contact.
|
164
|
+
- `contact`: hash defining the recipient with the following fields: `email`, `first_name`, `last_name`, `custom_field`
|
165
|
+
- `custom_field`: is a hash of the custom fields.
|
166
|
+
- `send_time`: hash with the following string fields: `hour` ("1" - "12") and `minute` ("00" - "59")
|
167
|
+
- If the hour is less than the current hour, the email will go out the following day.
|
168
|
+
- If the hour and minute combine to less than the current time, the email will go out the following day.
|
169
|
+
- `bcc`: BCC recipient. May only pass a single email address, empty string, or nil. If provided, it must be a well-formed email address.
|
170
|
+
- `from_name`: sender's name. If `from_email` is set, it overrides the transactional campaign default sender name. Ignored otherwise.
|
171
|
+
- `from_email`: sender's email address. Overrides the transactional campaign default sender email.
|
172
|
+
- `subject`: subject line of email. Overrides the transactional campaign default subject.
|
173
|
+
- `reply_to`: reply-to address. Overrides the transactional campaign default reply-to.
|
174
|
+
- `address`: physical address of sender. Overrides the transactional campaign default sender address.
|
175
|
+
- `tags`: hash where the field name is the name of the tag within the content, and the field value is the tag's replacement upon sending. All values must be non-nil scalars.
|
176
|
+
- `ctags`: campaign tags. Must be a simple array of scalar values.
|
177
|
+
|
178
|
+
## Contacts
|
179
|
+
|
180
|
+
### Instantiation:
|
181
|
+
|
182
|
+
MaropostApi::Contacts.new(account_id, auth_token)
|
183
|
+
|
184
|
+
### Available methods:
|
185
|
+
|
186
|
+
- `get_for_email(email)`
|
187
|
+
* Gets the contact according to email address
|
188
|
+
- `email`: email address of the contact
|
189
|
+
|
190
|
+
- `get_opens(contact_id, page)`
|
191
|
+
* Gets the list of opens for the specified contact
|
192
|
+
- `contact_id`: contact id of contact to for which the contact is being retrieved
|
193
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
194
|
+
|
195
|
+
- `get_clicks(contact_id, page)`
|
196
|
+
* Gets the list of clicks for the specified contact
|
197
|
+
- `contact_id`: contact id of contact to for which the contact is being retrieved
|
198
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
199
|
+
|
200
|
+
- `get_for_list(list_id, page)`
|
201
|
+
* Gets the list of contacts for the specified list
|
202
|
+
- `list_id`: ID of the list to which the contact being retrieved
|
203
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
204
|
+
|
205
|
+
- `get_contact_for_list(list_id, contact_id)`
|
206
|
+
- Gets the specified contact from the specified list
|
207
|
+
- `list_id`: ID of the list to which the contact is being retrieved
|
208
|
+
- `contact_id`: contact id of contact to for which the contact is being retrieved
|
209
|
+
|
210
|
+
- `create_or_update_for_list(list_id, email, first_name: nil, last_name: nil, phone: nil,`
|
211
|
+
`fax: nil, uid: nil, custom_field: nil, add_tags: nil,`
|
212
|
+
`remove_tags: nil, remove_from_dnm: true, subscribe: true)`
|
213
|
+
* Creates a contact within a list. Updates if previous contact is matched by email
|
214
|
+
- `list_id`: ID of the list to which the contact being updated belongs
|
215
|
+
- `contact_id`: ID of the contact being updated
|
216
|
+
- `email`: Email address for the contact to be updated
|
217
|
+
- `first_name`: first name of Contact
|
218
|
+
- `last_name`: last name of Contact
|
219
|
+
- `phone`: phone number of Contact
|
220
|
+
- `fax`: fax number of Contact
|
221
|
+
- `uid`: UID for the Contact
|
222
|
+
- `custom_field`: custom fields passed as associative array. Keys represent the field names while values represent the values
|
223
|
+
- `add_tags`: tags to add to the contact. Simple array of tag names
|
224
|
+
- `remove_tags`: tags to remove from the contact. Simple array of tag names
|
225
|
+
- `remove_from_dnm`: set this true to subscribe contact to the list, and remove it from DNM)
|
226
|
+
- `subscribe`: set this true to subscribe contact to the list; false otherwise
|
227
|
+
|
228
|
+
- `update_for_list_and_contact(list_id, contact_id, email, first_name: nil, last_name: nil, phone: nil, fax: nil,`
|
229
|
+
`uid: nil, custom_field: nil, add_tags: nil, remove_tags: nil, remove_from_dnm: true, subscribe: true)`
|
230
|
+
* Creates a contact within a list. Updates if previous contact is matched by email.
|
231
|
+
- `list_id`: ID of the list for which the contact is being created
|
232
|
+
- `email`: email address for the contact to be created|updated
|
233
|
+
- `first_name`: first name of Contact
|
234
|
+
- `last_name`: last Name of Contact
|
235
|
+
- `phone`: phone number of Contact
|
236
|
+
- `fax`: fax number of Contact
|
237
|
+
- `uid`: UID for the contact
|
238
|
+
- `custom_field`: custom fields passed as associative array. Keys represent the field names while values represent the values.
|
239
|
+
- `add_tags`: tags to add to the contact. Simple array of tag names (strings).
|
240
|
+
- `remove_tags`: tags to remove from the contact. Simple array of tag names (strings).
|
241
|
+
- `remove_from_dnm`: Set this true to subscribe contact to the list, and remove it from DNM.
|
242
|
+
- `subscribe`: true to subscribe the contact to the list; false otherwise.
|
243
|
+
|
244
|
+
- `create_or_update_contact(email, first_name: nil, last_name: nil, phone: nil, fax: nil, uid: nil,`
|
245
|
+
`custom_field: nil, add_tags: nil, remove_tags: nil, remove_from_dnm: true, subscribe: true)`
|
246
|
+
* Creates a contact without a list. Updates if already existing email is passed.
|
247
|
+
- `contact_id`: ID of the contact
|
248
|
+
- `email`: Email address for the contact to be created|updated
|
249
|
+
- `first_name`: first name of Contact
|
250
|
+
- `last_name`: last Name of Contact
|
251
|
+
- `phone`: phone number of Contact
|
252
|
+
- `fax`: fax number of Contact
|
253
|
+
- `uid`: UID for the contact
|
254
|
+
- `custom_field`: custom fields passed as associative array. Keys represent the field names while values represent the values
|
255
|
+
- `add_tags`: tags to add to the contact. Simple array of tag names (strings).
|
256
|
+
- `remove_tags`: tags to remove from the contact. Simple array of tag names (strings).
|
257
|
+
- `remove_from_dnm`: set this true to subscribe contact to the list, and remove it from DNM
|
258
|
+
- `subscribe`: true to subscribe the contact to the list; false otherwise.
|
259
|
+
|
260
|
+
- `create_or_update_for_list_and_workflows(email, first_name: nil, last_name: nil, phone: nil, fax: nil, uid: nil,`
|
261
|
+
`custom_field: nil, add_tags: nil, remove_tags: nil, remove_from_dnm: false, subscribe_list_ids: nil,`
|
262
|
+
`unsubscribe_list_ids: nil, unsubscribe_workflow_ids: nil, unsubscribe_campaign: nil)`
|
263
|
+
* Creates or updates Contact
|
264
|
+
- Multiple lists can be subscribed, unsubscribed.
|
265
|
+
- Multiple workflows can be unsubscribed.
|
266
|
+
- `email`: email address for the contact to be created|updated
|
267
|
+
- `first_name`: first name of Contact
|
268
|
+
- `last_name`: last name of Contact
|
269
|
+
- `phone`: phone number of Contact
|
270
|
+
- `fax`: fax number of Contact
|
271
|
+
- `uid`: UID for the Contact
|
272
|
+
- `custom_field`: custom fields passed as associative array. Keys represent the field names while values represent the values
|
273
|
+
- `add_tags`: tags to add to the contact. Simple array of tag names (strings)
|
274
|
+
- `remove_tags`: tags to remove from the contact. Simple array of tag names (strings)
|
275
|
+
- `remove_from_dnm`: set this true to subscribe contact to the list, and remove it from DNM
|
276
|
+
- `subscribe_list_ids`: simple array of IDs of lists to subscribe the contact to
|
277
|
+
- `unsubscribe_list_ids`: simple array of IDs of Lists to unsubscribe the contact from
|
278
|
+
- `unsubscribe_workflow_ids`: simple array of list of IDs of workflows to unsubscribe the contact from
|
279
|
+
- `unsubscribe_campaign`: campaign_id to unsubscribe the contact from
|
280
|
+
|
281
|
+
- `delete_from_all_lists(email)`
|
282
|
+
* Deletes specified contact from all lists
|
283
|
+
- `email`: email address of the contact
|
284
|
+
|
285
|
+
- `delete_from_lists(contact_id, list_ids: nil)`
|
286
|
+
* Deletes the specified contact from the specified lists
|
287
|
+
- `contact_id`: id of the contact
|
288
|
+
- `list_ids`: simple array of ids of the lists
|
289
|
+
|
290
|
+
- `delete_contact_for_uid(uid)`
|
291
|
+
* Deletes contact having the specified UID
|
292
|
+
- `uid`: UID of the Contact for which the contact is being deleted
|
293
|
+
|
294
|
+
- `delete_list_contact(list_id, contact_id)`
|
295
|
+
* Deletes specified contact from the specified list
|
296
|
+
- `list_id`: ID of the list for which the contact is being deleted
|
297
|
+
- `contact_id`: contact id of the list for which the contact is being deleted
|
298
|
+
|
299
|
+
- `unsubscribe_all(contact_field_value, contact_field_name: "email")`
|
300
|
+
* Unsubscribes contact having the specified field name/value.
|
301
|
+
- `contact_field_value`: the value of the field for the contact(s) being unsubscribed
|
302
|
+
- `contact_field_name`: the name of the field being checked for the value. At present, the accepted field names are: 'email' or 'uid'
|
303
|
+
|
304
|
+
## Journeys
|
305
|
+
|
306
|
+
### Instantiation:
|
307
|
+
|
308
|
+
MaropostApi::Journeys.new(account_id, auth_token)
|
309
|
+
|
310
|
+
### Available methods:
|
311
|
+
|
312
|
+
- `get(page)`
|
313
|
+
* Gets the list of journeys
|
314
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
315
|
+
|
316
|
+
- `get_campaigns(journey_id, page)`
|
317
|
+
* Gets the list of all campaigns for the specified journey
|
318
|
+
- `journey_id`: get campaigns filtered with journey_id
|
319
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
320
|
+
|
321
|
+
- `get_contacts(journey_id, page)`
|
322
|
+
* Gets the list of all contacts for the specified journey
|
323
|
+
- `journey_id`: get contacts filtered with journey_id
|
324
|
+
- `page` : page # (>= 1). Up to 200 records returned per page.
|
325
|
+
|
326
|
+
- `stop_all(contact_id, recipientEmail, uid, page)`
|
327
|
+
* Stops all journeys, filtered for the matching parameters
|
328
|
+
- `contact_id`: this filter ignored unless greater than 0
|
329
|
+
- `recipientEmail`: this filter ignored if nil
|
330
|
+
- `uid`: this filter ignored if nil
|
331
|
+
- `page`: page # (>= 1). Up to 200 record returned per page.
|
332
|
+
|
333
|
+
- `pause_journey_for_contact(journey_id, contact_id)`
|
334
|
+
* Pause the specified journey for the specified contact
|
335
|
+
- `journey_id`: journey to pause
|
336
|
+
- `contact_id`: pause journey for specified contact id
|
337
|
+
|
338
|
+
- `pause_journey_for_uid(journey_id, uid)`
|
339
|
+
* Pause the specified journey for the contact having the specified UID
|
340
|
+
- `journey_id`: journey to pause
|
341
|
+
- `uid`: pause journey for specified uid
|
342
|
+
|
343
|
+
- `reset_journey_for_contact(journey_id, contact_id)`
|
344
|
+
* Reset the specified journey for the specified active/paused contact. Resetting a contact to the beginning of the journeys will result in sending of the same journey campaigns as originally sent.
|
345
|
+
- `journey_id`: journey to reset
|
346
|
+
- `contact_id`: reset journey for specified contact id
|
347
|
+
|
348
|
+
- `reset_journey_for_uid(journey_id, uid)`
|
349
|
+
* Restarts a journey for a paused contact having the specified UID. Adds a new contact in journey. Retriggers the journey for a contact who has finished its journey once. (To retrigger, *make sure* that "Retrigger Journey" option is enabled.)
|
350
|
+
- `journey_id`: journey to reset
|
351
|
+
- `uid`: uid of contact to reset journey
|
352
|
+
|
353
|
+
- `start_journey_for_contact(journey_id, contact_id)`
|
354
|
+
* Starts a journey for contact having specified journey_id
|
355
|
+
- `journey_id`: journey to start
|
356
|
+
- `contact_id`: contact id of contact to start journey
|
357
|
+
|
358
|
+
- `start_journey_for_uid(journey_id, uid)`
|
359
|
+
* Starts a journey for contact having specified uid and journey_id
|
360
|
+
- 'journey_id': journey to start
|
361
|
+
- 'uid': uid of contact to start journey
|
362
|
+
|
363
|
+
## Product and Revenue
|
364
|
+
|
365
|
+
### Instantiation:
|
366
|
+
|
367
|
+
MaropostApi::ProductsAndRevenue.new(account_id, auth_token)
|
368
|
+
|
369
|
+
### Available methods:
|
370
|
+
|
371
|
+
- `get_order(id)`
|
372
|
+
* Gets the specified order
|
373
|
+
- `get_order_for_original_order_id(original_order_id)`
|
374
|
+
* Gets the specified order
|
375
|
+
|
376
|
+
- `create_order(require_unique, contact: {}, order: {}, order_items: [], add_tags: [], `
|
377
|
+
`remove_tags: [], uid: nil, list_ids: nil, grand_total: nil, `
|
378
|
+
`campaign_id: nil, coupon_code: nil)`
|
379
|
+
* Creates an order
|
380
|
+
- `require_unique`: true to validate that the order has a unique original_order_id for the given contact.
|
381
|
+
- `contact`: hash containing the following fields: `email`, `first_name`, `last_name`
|
382
|
+
- `order`: hash containing the following fields:
|
383
|
+
- `order_date`: uses the format: "YYYY-MM-DDTHH:MM:SS-05:00"
|
384
|
+
- `order_status`: status of order
|
385
|
+
- `original_order_id`: sets the original_order_id field
|
386
|
+
- `order_items`: must contain at least one `OrderItem`. When creating an item, do not manually set the properties. Just use the constructor, itself having the parameters:
|
387
|
+
- `item_id`
|
388
|
+
- `price`: price of the order_item
|
389
|
+
- `quantity`: quantity purchased
|
390
|
+
- `description`: description of the product
|
391
|
+
- `adcode`: adcode of the order_item
|
392
|
+
- `category`: category of the product
|
393
|
+
- `add_tags` array of strings
|
394
|
+
- `remove_tags` array of strings
|
395
|
+
- `uid`: unique id
|
396
|
+
- `list_ids` CSV list of IDs (e.g, "12,13")
|
397
|
+
- `grand_total`: grand total
|
398
|
+
- `campaign_id`: campaign id
|
399
|
+
- `coupon_code`: coupon code
|
400
|
+
|
401
|
+
- `update_order_for_original_order_id(original_order_id,`
|
402
|
+
`order_date_time,`
|
403
|
+
`order_status,`
|
404
|
+
`order_items,`
|
405
|
+
`campaign_id: nil,`
|
406
|
+
`coupon_code: nil)`
|
407
|
+
* Updates an existing eCommerce order using unique original_order_id if the details are changed due to partial return or some other update.
|
408
|
+
- `original_order_id`: matches the original_order_id field of the order
|
409
|
+
- `order_date_time`: uses the format: YYYY-MM-DDTHH:MM:SS-05:00
|
410
|
+
- `order_status`: order status
|
411
|
+
- `order_items`: must contain at least one order_item.
|
412
|
+
- `campaign_id`: campaign id
|
413
|
+
- `coupon_code`: coupon code
|
414
|
+
|
415
|
+
- `update_order_for_order_id(order_id,`
|
416
|
+
`order_date_time,`
|
417
|
+
`order_status,`
|
418
|
+
`order_items,`
|
419
|
+
`campaign_id: nil,`
|
420
|
+
`coupon_code: nil)`
|
421
|
+
* Updates an existing eCommerce order using unique order_id if the details are changed due to partial return or some other update.
|
422
|
+
- `order_id`: matches the Maropost order_id field of the order
|
423
|
+
- `order_date_time`: uses the format: YYYY-MM-DDTHH:MM:SS-05:00
|
424
|
+
- `order_status`: order status
|
425
|
+
- `order_items`: must contain at least one order_item.
|
426
|
+
- `campaign_id`: campaign id
|
427
|
+
- `coupon_code`: coupon code
|
428
|
+
|
429
|
+
- `delete_for_original_order_id(original_order_id)`
|
430
|
+
* Deletes the complete eCommerce order if the order is cancelled or returned
|
431
|
+
- `original_order_id` matches the original_order_id field of the order
|
432
|
+
|
433
|
+
- `delete_for_order_id(id)`
|
434
|
+
* Deletes the complete eCommerce order if the order is cancelled or returned using Maropost order id
|
435
|
+
- `id`: Maropost order_id
|
436
|
+
|
437
|
+
- `delete_products_for_original_order_id(original_order_id, product_ids)`
|
438
|
+
* Deletes the specified product(s) from a complete eCommerce order if the product(s) is cancelled or returned
|
439
|
+
- `original_order_id`: matches the original_order_id field of the order
|
440
|
+
- `product_ids`: the product(s) to delete from the order
|
441
|
+
|
442
|
+
- `delete_products_for_order_id(id, product_ids)`
|
443
|
+
* Deletes the specified product(s) from a complete eCommerce order if the product(s) is cancelled or returned
|
444
|
+
- `id`: Maropost order_id
|
445
|
+
- `product_ids`: the product(s) to delete from the order
|
446
|
+
|
447
|
+
## Relational Table Rows
|
448
|
+
|
449
|
+
### Instantiation:
|
450
|
+
Unlike the other services, the constructor for this requires a third
|
451
|
+
parameter: `table_name`. So for example:
|
452
|
+
|
453
|
+
MaropostApi::RelationalTableRows.new(my_account_id, my_auth_token, "someTableName")
|
454
|
+
|
455
|
+
`table_name` sets which relational table the service's operations should act against.
|
456
|
+
To switch tables, you do not need to re-instantiate the service. Simply update the `table_name` property of the instance:
|
457
|
+
|
458
|
+
rows = MaropostApi::RelationalTableRows.new(myId, myToken, "table1");
|
459
|
+
rows.table_name = "table2";
|
460
|
+
|
461
|
+
### Available functions:
|
462
|
+
|
463
|
+
- `get()`
|
464
|
+
* Gets the records of the Relational Table
|
465
|
+
|
466
|
+
- `show(unique_field_name, value)`
|
467
|
+
* Gets the specified record from the Relational Table
|
468
|
+
* `unique_field_namae`: name of the field representing the unique identifier (E.g., "id", "email")
|
469
|
+
* `value`: value of the identifier field, for the record to show
|
470
|
+
|
471
|
+
- `create(key_value_col, *key_value_cols)`
|
472
|
+
* Adds a record to the Relational Table
|
473
|
+
* `key_value_col`: object hash containing the fields of the
|
474
|
+
record to be created, each item consisting of two fields.
|
475
|
+
- NOTE: One of the fields must represent the unique identifier.
|
476
|
+
|
477
|
+
- `update(key_value_col, *key_value_cols)`
|
478
|
+
* Updates a record in the Relational Table.
|
479
|
+
* `key_value_col`: object hash containing the fields of the
|
480
|
+
record to be created, each item consisting of two fields.
|
481
|
+
- NOTE: One of the KeyValues must represent the unique identifier.
|
482
|
+
|
483
|
+
- `upsert(key_value_col, *key_value_cols)`
|
484
|
+
* Creates or updates a record in the Relational Table.
|
485
|
+
* `key_value_col`: object hash containing the fields of the
|
486
|
+
record to be created, each item consisting of two fields.
|
487
|
+
- NOTE: One of the KeyValues must represent the unique identifier.
|
488
|
+
|
489
|
+
- `delete(unique_field_name, value)`
|
490
|
+
* Deletes the given record of the Relational Table
|
491
|
+
* `unique_field_name` name of the field representing the unique identifier (E.g., "id", "email")
|
492
|
+
* `value` value of the identifier field, for the record to delete.
|
493
|
+
|
494
|
+
## Reports
|
495
|
+
|
496
|
+
### Instantiation:
|
497
|
+
|
498
|
+
MaropostApi::Reports.new(account_id, auth_token)
|
499
|
+
|
500
|
+
### Available methods:
|
501
|
+
- `get(page)`
|
502
|
+
- returns the list of reports
|
503
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
504
|
+
|
505
|
+
- `get_report(id)`
|
506
|
+
- Gets the list of reports
|
507
|
+
- `id`: report ID
|
508
|
+
|
509
|
+
- `get_opens(page,`
|
510
|
+
`fields: [],`
|
511
|
+
`from: nil,`
|
512
|
+
`to: nil,`
|
513
|
+
`unique: nil,`
|
514
|
+
`email: nil,`
|
515
|
+
`uid: nil,`
|
516
|
+
`per: nil)`
|
517
|
+
* returns the list of open reports based on filters and fields provided
|
518
|
+
- `page`: page # (>= 1). Up to 200 records returned per page.
|
519
|
+
* `fields`: contact field names to retrieve
|
520
|
+
* `from`: the beginning of date range filter
|
521
|
+
* `to`: the end of the date range filter
|
522
|
+
* `unique`: when true, gets only unique opens
|
523
|
+
* `email`: filters by provided email in the contact
|
524
|
+
* `uid`: filters by uid
|
525
|
+
* `per`: determines how many records per request to receive
|
526
|
+
|
527
|
+
- `get_clicks(page,`
|
528
|
+
`fields: [],`
|
529
|
+
`from: nil,`
|
530
|
+
`to: nil,`
|
531
|
+
`unique: nil,`
|
532
|
+
`email: nil,`
|
533
|
+
`uid: nil,`
|
534
|
+
`per: nil)`
|
535
|
+
* returns the list of click reports
|
536
|
+
* `page`: page # (>= 1). Up to 200 records returned per page.
|
537
|
+
* `fields`: plucks these contact fields if they exist
|
538
|
+
* `from`: start of specific date range filter
|
539
|
+
* `to`: end of date range filter
|
540
|
+
* `unique`: if true, gets unique records
|
541
|
+
* `email`: gets Clicks for specific email
|
542
|
+
* `uid`: gets Clicks for provided uid
|
543
|
+
* `per`: gets the specified number of records
|
544
|
+
|
545
|
+
- `get_bounce(page,`
|
546
|
+
`fields: [],`
|
547
|
+
`from: nil,`
|
548
|
+
`to: nil,`
|
549
|
+
`unique: nil,`
|
550
|
+
`email: nil,`
|
551
|
+
`uid: nil,`
|
552
|
+
`type: nil,`
|
553
|
+
`per: nil)`
|
554
|
+
* returns the list of bounce reports
|
555
|
+
* `page`: page # (>= 1). Up to 200 records returned per page.
|
556
|
+
* `fields`: plucks these contact fields if they exist
|
557
|
+
* `from`: start of specific date range filter
|
558
|
+
* `to`: end of date range filter
|
559
|
+
* `unique`: if true, gets unique records
|
560
|
+
* `email`: gets Bounces for specific email
|
561
|
+
* `uid`: gets Bounces for provided uid
|
562
|
+
* `type`: if provided, should be either "soft", or "hard".
|
563
|
+
* `per`: gets the specified number of records
|
564
|
+
|
565
|
+
- ` get_unsubscribes(page,`
|
566
|
+
`fields: [],`
|
567
|
+
`from: nil,`
|
568
|
+
`to: nil,`
|
569
|
+
`unique: nil,`
|
570
|
+
`email: nil,`
|
571
|
+
`uid: nil,`
|
572
|
+
`per: nil)`
|
573
|
+
* returns the list of Unsubscribes with provided filter constraints
|
574
|
+
* `page`: page # (>= 1). Up to 200 records returned per page.
|
575
|
+
* `fields`: plucks these contact fields if they exist
|
576
|
+
* `from`: start of specific date range filter
|
577
|
+
* `to`: end of date range filter
|
578
|
+
* `unique` if true, gets unique records
|
579
|
+
* `email` gets Unsubscribes for specific email
|
580
|
+
* `uid` gets Unsubscribes for provided uid
|
581
|
+
* `per` gets the specified number of records
|
582
|
+
|
583
|
+
- `get_complaints(page,`
|
584
|
+
`fields: nil,`
|
585
|
+
`from: nil,`
|
586
|
+
`to: nil,`
|
587
|
+
`unique: nil,`
|
588
|
+
`email: nil,`
|
589
|
+
`uid: nil,`
|
590
|
+
`per: nil)`
|
591
|
+
* returns the list of complaints filtered by provided params
|
592
|
+
* `page`: page # (>= 1). Up to 200 records returned per page.
|
593
|
+
* `fields`: plucks these contact fields if they exist
|
594
|
+
* `from`: start of specific date range filter
|
595
|
+
* `to`: end of date range filter
|
596
|
+
* `unique`: if true, gets unique records
|
597
|
+
* `email`: gets Complaints for specific email
|
598
|
+
* `uid`: gets Complaints for provided uid
|
599
|
+
* `per`: gets the specified number of records
|
600
|
+
|
601
|
+
- ` get_ab_reports(name,`
|
602
|
+
`page,`
|
603
|
+
`from: nil,`
|
604
|
+
`to: nil,`
|
605
|
+
`per: nil)`
|
606
|
+
* returns the list of Ab Reports
|
607
|
+
* `name`: to get ab_reports with mentioned name
|
608
|
+
* `page`: page # (>= 1). Up to 200 records returned per page.
|
609
|
+
* `from`: beginning of date range filter
|
610
|
+
* `to`: end of date range filter
|
611
|
+
* `per`: gets the mentioned number of reports
|
612
|
+
|
613
|
+
- `get_journey(page)`
|
614
|
+
* returns the list of all Journeys
|
615
|
+
* `page`: page # (>= 1). Up to 200 records returned per page.
|
@@ -47,11 +47,12 @@ module MaropostApi
|
|
47
47
|
order[:order_items].push(item.to_hash)
|
48
48
|
end
|
49
49
|
# required order fields to check for
|
50
|
-
[:order_date, :order_status, :original_order_id
|
50
|
+
[:order_date, :order_status, :original_order_id].each do |order_field|
|
51
51
|
raise ArgumentError.new "order[:#{order_field}] is required!" if order.has_key?(order_field) == false
|
52
52
|
end
|
53
53
|
|
54
54
|
params = order
|
55
|
+
params[:order_items] = order_items
|
55
56
|
params[:contact] = contact
|
56
57
|
params[:uid] = uid
|
57
58
|
params[:list_ids] = list_ids
|
data/lib/maropost_api/version.rb
CHANGED
data/maropost_api.gemspec
CHANGED
@@ -6,8 +6,8 @@ require "maropost_api/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "maropost-api"
|
8
8
|
spec.version = MaropostApi::VERSION
|
9
|
-
spec.authors = ["Ashish Acharya"]
|
10
|
-
spec.email = ["aacharya@
|
9
|
+
spec.authors = ["Ashish Acharya", "David Lamb"]
|
10
|
+
spec.email = ["aacharya@aplogic.com", "dlamb@aplogic.com"]
|
11
11
|
|
12
12
|
spec.summary = "A consumer gem for Maropost.com api"
|
13
13
|
spec.description = "Maropost API"
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maropost-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashish Acharya
|
8
|
+
- David Lamb
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
@@ -68,7 +69,8 @@ dependencies:
|
|
68
69
|
version: '3.0'
|
69
70
|
description: Maropost API
|
70
71
|
email:
|
71
|
-
- aacharya@
|
72
|
+
- aacharya@aplogic.com
|
73
|
+
- dlamb@aplogic.com
|
72
74
|
executables: []
|
73
75
|
extensions: []
|
74
76
|
extra_rdoc_files: []
|