19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/lita/handlers/pivotal_tracker.rb', line 19
def pt_add(response)
response.reply("USAGE: #{t('help.add.syntax')}") and return if response.matches[0][1].nil? || response.matches[0][2].nil?
project_id, project_name = id_and_name_for_project_name(response.matches[0][2])
response.reply("Couldn't find project with name containing '#{project_name}'") and return unless project_id
pt_params = {}
pt_params[:story_type] = response.matches[0][0] if response.matches[0][0]
pt_params[:name] = response.matches[0][1]
result = api_request('post', "projects/#{project_id}/stories", pt_params)
response.reply("BAM! Added #{result['story_type'].capitalize} '#{result['name']}' to '#{project_name}' #{result['url']}")
end
|