Class: MailchimpMarketing::AutomationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/MailchimpMarketing/api/automations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client) ⇒ AutomationsApi

Returns a new instance of AutomationsApi.



19
20
21
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 19

def initialize(api_client)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_workflow_email_subscriber(workflow_id, workflow_email_id, body, opts = {}) ⇒ Object

Add subscriber to workflow email



270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 270

def add_workflow_email_subscriber(workflow_id, workflow_email_id, body, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}/queue'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s)
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#archive(workflow_id, opts = {}) ⇒ Object

Archive automation



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 24

def archive(workflow_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/actions/archive'.sub('{' + 'workflow_id' + '}', workflow_id.to_s)
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#create(body, opts = {}) ⇒ Object

Add automation



198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 198

def create(body, opts = {})
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/automations'
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#delete_workflow_email(workflow_id, workflow_email_id, opts = {}) ⇒ Object

Delete workflow email



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 38

def delete_workflow_email(workflow_id, workflow_email_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s)
  data = @api_client.call_api(:DELETE, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#get(workflow_id, opts = {}) ⇒ Object

Get automation info



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 77

def get(workflow_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?

  query_params = {}
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?
  post_body = nil

  local_var_path = '/automations/{workflow_id}'.sub('{' + 'workflow_id' + '}', workflow_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#get_removed_workflow_email_subscriber(workflow_id, subscriber_hash, opts = {}) ⇒ Object

Get subscriber removed from workflow



167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 167

def get_removed_workflow_email_subscriber(workflow_id, subscriber_hash, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'subscriber_hash'" if subscriber_hash.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/removed-subscribers/{subscriber_hash}'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'subscriber_hash' + '}', subscriber_hash.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#get_workflow_email(workflow_id, workflow_email_id, opts = {}) ⇒ Object

Get workflow email info



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 107

def get_workflow_email(workflow_id, workflow_email_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#get_workflow_email_subscriber(workflow_id, workflow_email_id, subscriber_hash, opts = {}) ⇒ Object

Get automated email subscriber



137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 137

def get_workflow_email_subscriber(workflow_id, workflow_email_id, subscriber_hash, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?
  fail ArgumentError, "Missing required param: 'subscriber_hash'" if subscriber_hash.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}/queue/{subscriber_hash}'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s).sub('{' + 'subscriber_hash' + '}', subscriber_hash.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#get_workflow_email_subscriber_queue(workflow_id, workflow_email_id, opts = {}) ⇒ Object

List automated email subscribers



122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 122

def get_workflow_email_subscriber_queue(workflow_id, workflow_email_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}/queue'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#list(opts = {}) ⇒ Object

List automations



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 53

def list(opts = {})
  fail ArgumentError, 'invalid value for "opts[:"count"]", must be smaller than or equal to 1000.' if !opts[:'count'].nil? && opts[:'count'] > 1000
  fail ArgumentError, 'invalid value for "status", must be one of save, paused, sending' if opts[:'status'] && !['save', 'paused', 'sending'].include?(opts[:'status'])

  query_params = {}
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil?
  query_params[:'before_create_time'] = opts[:'before_create_time'] if !opts[:'before_create_time'].nil?
  query_params[:'since_create_time'] = opts[:'since_create_time'] if !opts[:'since_create_time'].nil?
  query_params[:'before_start_time'] = opts[:'before_start_time'] if !opts[:'before_start_time'].nil?
  query_params[:'since_start_time'] = opts[:'since_start_time'] if !opts[:'since_start_time'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  post_body = nil

  local_var_path = '/automations'
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#list_all_workflow_emails(workflow_id, opts = {}) ⇒ Object

List automated emails



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 93

def list_all_workflow_emails(workflow_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/emails'.sub('{' + 'workflow_id' + '}', workflow_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#list_workflow_email_subscribers_removed(workflow_id, opts = {}) ⇒ Object

List subscribers removed from workflow



153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 153

def list_workflow_email_subscribers_removed(workflow_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/removed-subscribers'.sub('{' + 'workflow_id' + '}', workflow_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#pause_all_emails(workflow_id, opts = {}) ⇒ Object

Pause automation emails



212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 212

def pause_all_emails(workflow_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/actions/pause-all-emails'.sub('{' + 'workflow_id' + '}', workflow_id.to_s)
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#pause_workflow_email(workflow_id, workflow_email_id, opts = {}) ⇒ Object

Pause automated email



240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 240

def pause_workflow_email(workflow_id, workflow_email_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}/actions/pause'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s)
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#remove_workflow_email_subscriber(workflow_id, body, opts = {}) ⇒ Object

Remove subscriber from workflow



286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 286

def remove_workflow_email_subscriber(workflow_id, body, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/automations/{workflow_id}/removed-subscribers'.sub('{' + 'workflow_id' + '}', workflow_id.to_s)
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#start_all_emails(workflow_id, opts = {}) ⇒ Object

Start automation emails



226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 226

def start_all_emails(workflow_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/actions/start-all-emails'.sub('{' + 'workflow_id' + '}', workflow_id.to_s)
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#start_workflow_email(workflow_id, workflow_email_id, opts = {}) ⇒ Object

Start automated email



255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 255

def start_workflow_email(workflow_id, workflow_email_id, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}/actions/start'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s)
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end

#update_workflow_email(workflow_id, workflow_email_id, body, opts = {}) ⇒ Object

Update workflow email



182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/MailchimpMarketing/api/automations_api.rb', line 182

def update_workflow_email(workflow_id, workflow_email_id, body, opts = {})
  fail ArgumentError, "Missing required param: 'workflow_id'" if workflow_id.nil?
  fail ArgumentError, "Missing required param: 'workflow_email_id'" if workflow_email_id.nil?
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/automations/{workflow_id}/emails/{workflow_email_id}'.sub('{' + 'workflow_id' + '}', workflow_id.to_s).sub('{' + 'workflow_email_id' + '}', workflow_email_id.to_s)
  data = @api_client.call_api(:PATCH, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end