Module: Marketing

Included in:
Cxf::User
Defined in:
lib/user/marketing/marketing.rb

Instance Method Summary collapse

Instance Method Details

#create_automation(data) ⇒ Object

Create automation.

Create an automation with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Automation'
}
@data = @cxf_user.create_automation(data)


56
57
58
# File 'lib/user/marketing/marketing.rb', line 56

def create_automation(data)
  @client.raw('post', '/marketing/automation/', nil, data_transform(data))
end

#delete_automation(id) ⇒ Object

Delete automation.

Delete an automation.

Parameters

id

(Integer) – Automation id.

Example

@data = @cxf_user.delete_automation(5)


80
81
82
# File 'lib/user/marketing/marketing.rb', line 80

def delete_automation(id)
  @client.raw('delete', "/marketing/automation/#{id}")
end

#duplicate_automation(id, data) ⇒ Object

Duplicate automation.

Duplicate an automation.

Parameters

id

(Integer) – Automation id.

data

(Hash) – Data to be submitted.

Example

data = {
  options: []
}
@data = @cxf_user.duplicate_automation(1, data.to_json)


120
121
122
# File 'lib/user/marketing/marketing.rb', line 120

def duplicate_automation(id, data)
  @client.raw('post', "/marketing/automation/#{id}/duplicate", nil, data)
end

#get_automation(id, options = nil) ⇒ Object

Get automation.

Get an automation info.

Parameters

id

(Integer) – Automation id.

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @cxf_user.get_automation(1)

Second Example

options = {
  fields: 'title, id'
}
@data = @cxf_user.get_automation(1, options)


41
42
43
# File 'lib/user/marketing/marketing.rb', line 41

def get_automation(id, options = nil)
  @client.raw('get', "/marketing/automation/#{id}", options)
end

#get_automation_executions(id) ⇒ Object

Get automation executions.

Get executions of an automation.

Parameters

id

(Integer) – Automation id.

Example

@data = @cxf_user.get_automation_executions(1)


92
93
94
# File 'lib/user/marketing/marketing.rb', line 92

def get_automation_executions(id)
  @client.raw('get', "/marketing/automation/#{id}/executions")
end

#get_automations(options = nil) ⇒ Object

Get automations.

Get a collection of automations.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @cxf_user.get_automations

Second Example

options = {
  fields: 'title'
}
@data = @cxf_user.get_automations(options)


22
23
24
# File 'lib/user/marketing/marketing.rb', line 22

def get_automations(options = nil)
  @client.raw('get', '/marketing/automation', options)
end

#reset_automation(id) ⇒ Object

Reset automation.

Reset an automation.

Parameters

id

(Integer) – Automation id.

Example

@data = @cxf_user.reset_automation(1)


104
105
106
# File 'lib/user/marketing/marketing.rb', line 104

def reset_automation(id)
  @client.raw('post', "/marketing/automation/#{id}/reset")
end

#update_automation(id, data) ⇒ Object

Update automation.

Update an automation info.

Parameters

id

(Integer) – Automation id.

data

(Hash) – Data to be submitted.



67
68
69
70
# File 'lib/user/marketing/marketing.rb', line 67

def update_automation(id, data)
  # FIXME: Method doesn't work.
  @client.raw('put', "/marketing/automation/#{id}", nil, data_transform(data))
end