Class: OpenWFE::Extras::BasecampParticipant

Inherits:
Object
  • Object
show all
Includes:
LocalParticipant, TemplateMixin
Defined in:
lib/openwfe/extras/participants/basecamp_participants.rb

Instance Method Summary collapse

Constructor Details

#initialize(params, &block) ⇒ BasecampParticipant

Returns a new instance of BasecampParticipant.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/openwfe/extras/participants/basecamp_participants.rb', line 51

def initialize (params, &block)

    super()

    @template = params[:template]
    @block_template = block

    @company_id = params[:company_id]
    #@project_id = params[:project_id]

    @responsible_party_id = params[:responsible_party_id]
    @todo_list_id = params[:todo_list_id]

    ssl = params[:ssl]
    ssl = true if ssl == nil

    @camp = Basecamp.new(
        params[:host], params[:username], params[:password], ssl)
end

Instance Method Details

#consume(workitem) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/openwfe/extras/participants/basecamp_participants.rb', line 71

def consume (workitem)

    text = workitem['todo_text'] || eval_template(wi)

    resp = workitem['todo_responsible_party'] || @responsible_party_id
    list = workitem['toto_list_id'] || @todo_list_id

    todo = @camp.create_item list, text, resp

    workitem['todo_id'] = todo.id

    reply_to_engine workitem
end