Module: Marketing

Included in:
Mints::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 submited.

Example

data = {
  "title": "New Automation"
}
@data = @mints_user.create_automation(data)

54
55
56
# File 'lib/user/marketing/marketing.rb', line 54

def create_automation(data)
    return @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 = @mints_user.delete_automation(5)

77
78
79
# File 'lib/user/marketing/marketing.rb', line 77

def delete_automation(id)
    return @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 submited.

Example

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

117
118
119
# File 'lib/user/marketing/marketing.rb', line 117

def duplicate_automation(id, data)
    return @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 = @mints_user.get_automation(1)

Second Example

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

39
40
41
# File 'lib/user/marketing/marketing.rb', line 39

def get_automation(id, options = nil)
    return @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 = @mints_user.get_automation_executions(1)

89
90
91
# File 'lib/user/marketing/marketing.rb', line 89

def get_automation_executions(id)
    return @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 = @mints_user.get_automations

Second Example

options = {
  "fields": "title"
}
@data = @mints_user.get_automations(options)

20
21
22
# File 'lib/user/marketing/marketing.rb', line 20

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

#reset_automation(id) ⇒ Object

Reset automation.

Reset an automation.

Parameters

id

(Integer) – Automation id.

Example

@data = @mints_user.reset_automation(1)

101
102
103
# File 'lib/user/marketing/marketing.rb', line 101

def reset_automation(id)
    return @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 submited.


65
66
67
# File 'lib/user/marketing/marketing.rb', line 65

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