Class: EmailDirect::Workflow

Inherits:
Object
  • Object
show all
Defined in:
lib/emaildirect/workflow.rb

Overview

Represents a workflow and associated functionality

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow_id) ⇒ Workflow

Returns a new instance of Workflow.



16
17
18
# File 'lib/emaildirect/workflow.rb', line 16

def initialize(workflow_id)
  @workflow_id = workflow_id
end

Instance Attribute Details

#workflow_idObject (readonly)

Returns the value of attribute workflow_id.



14
15
16
# File 'lib/emaildirect/workflow.rb', line 14

def workflow_id
  @workflow_id
end

Class Method Details

.allObject



8
9
10
11
# File 'lib/emaildirect/workflow.rb', line 8

def all
  response = EmailDirect.get '/Workflows'
  Hashie::Mash.new(response)
end

Instance Method Details

#add_emails(email_addresses) ⇒ Object



60
61
62
63
64
# File 'lib/emaildirect/workflow.rb', line 60

def add_emails(email_addresses)
  options = { :EmailAddresses => Array(email_addresses) }
  response = post 'AddEmails', :body => options.to_json
  Hashie::Mash.new(response)
end

#detailsObject



20
21
22
23
# File 'lib/emaildirect/workflow.rb', line 20

def details
  response = get
  Hashie::Mash.new(response)
end

#members(options = {}) ⇒ Object



25
26
27
28
# File 'lib/emaildirect/workflow.rb', line 25

def members(options = {})
  response = get 'Members', :query => options
  Hashie::Mash.new(response)
end

#remove_emails(email_addresses) ⇒ Object



66
67
68
69
70
# File 'lib/emaildirect/workflow.rb', line 66

def remove_emails(email_addresses)
  options = { :EmailAddresses => Array(email_addresses) }
  response = post 'RemoveEmails', :body => options.to_json
  Hashie::Mash.new(response)
end

#send_node_details(send_node_id) ⇒ Object



40
41
42
43
# File 'lib/emaildirect/workflow.rb', line 40

def send_node_details(send_node_id)
  response = get "SendNodes/#{send_node_id}"
  Hashie::Mash.new(response)
end

#send_node_stats(send_node_id, options = {}) ⇒ Object



45
46
47
48
# File 'lib/emaildirect/workflow.rb', line 45

def send_node_stats(send_node_id, options = {})
  response = get "SendNodes/#{send_node_id}/Stats", :query => options
  Hashie::Mash.new(response)
end

#send_nodesObject



35
36
37
38
# File 'lib/emaildirect/workflow.rb', line 35

def send_nodes
  response = get 'SendNodes'
  Hashie::Mash.new(response)
end

#startObject



50
51
52
53
# File 'lib/emaildirect/workflow.rb', line 50

def start
  response = EmailDirect.put '/Workflows/Start', :body => workflow_id.to_json
  Hashie::Mash.new(response)
end

#stats(options = {}) ⇒ Object



30
31
32
33
# File 'lib/emaildirect/workflow.rb', line 30

def stats(options = {})
  response = get 'Stats', :query => options
  Hashie::Mash.new(response)
end

#stopObject



55
56
57
58
# File 'lib/emaildirect/workflow.rb', line 55

def stop
  response = EmailDirect.put '/Workflows/Stop', :body => workflow_id.to_json
  Hashie::Mash.new(response)
end