Class: Workflow

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Workflow

Returns a new instance of Workflow.


4
5
6
7
8
# File 'lib/zipmark/workflow.rb', line 4

def initialize(options = {})
  self.client = options[:client]
  self.data = options[:data]
  self.name = options[:name]
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.


2
3
4
# File 'lib/zipmark/workflow.rb', line 2

def client
  @client
end

#dataObject

Returns the value of attribute data.


2
3
4
# File 'lib/zipmark/workflow.rb', line 2

def data
  @data
end

#nameObject

Returns the value of attribute name.


2
3
4
# File 'lib/zipmark/workflow.rb', line 2

def name
  @name
end

Instance Method Details

#tokenObject


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/zipmark/workflow.rb', line 10

def token
  JWT.encode(
    {
      workflow: name,
      application_id: client.adapter.username,
      iat:     Time.now.to_i,
      data:    data
    },
    client.adapter.password
  )
end