Skip to content

Commit

Permalink
email after archive
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat-123 committed Nov 9, 2013
1 parent 080f052 commit 510673e
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ gem 'rspec', :group => :test
gem 'rack-test', :require => "rack/test", :group => :test gem 'rack-test', :require => "rack/test", :group => :test
gem 'flexmock', :group => :test gem 'flexmock', :group => :test
gem 'mock_redis', :group => :test gem 'mock_redis', :group => :test

# Mail Gems
gem 'rest-client'
gem 'multimap'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ GEM
mock_redis (0.6.2) mock_redis (0.6.2)
multi_json (1.3.6) multi_json (1.3.6)
multi_xml (0.5.1) multi_xml (0.5.1)
multimap (1.1.2)
multipart-post (1.1.5) multipart-post (1.1.5)
nokogiri (1.5.5) nokogiri (1.5.5)
nori (2.0.4) nori (2.0.4)
Expand Down Expand Up @@ -194,12 +195,14 @@ DEPENDENCIES
jaconda jaconda
mail mail
mock_redis mock_redis
multimap
nokogiri nokogiri
pry pry
rack-test rack-test
rake rake
redis redis
redis-namespace redis-namespace
rest-client
restforce restforce
rspec rspec
ruby-trello ruby-trello
Expand Down
Binary file added apps/email_after_archive/assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions apps/email_after_archive/assets/views/button/overlay.hbs
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
Set overlay: true in the config
This file will be rendered on the overlay
The below code sample is taken from the Pivotal App
-->

<h3>Edit the Story Details</h3>
{{#each tickets}}
{{#ticket}}
<ol>
<li>
<label for="title">Story Title</label>
<input name="title" value="{{subject}}">
</li>
<li>
<label for="description">Story Description</label>
<textarea name="description">
{{content.text}} \n
https://{{../../company.subdomain}}.supportbee.com/tickets/{{id}}
</textarea>
</li>
</ol>
{{/ticket}}
{{/each}}
32 changes: 32 additions & 0 deletions apps/email_after_archive/config.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Email_after_archive
slug: email_after_archive
access: public

description: "This is to test and a boilerplate app.
Accepts newline"

category: Integration

tags:
- tag1
- tag2

developer:
name: <Your Name>
email: <Your Email>
twitter: "<Your Twitter Handle>"
github: <Your Github Handle>

# The following config keys are used by Action Handlers
# Set button 'overlay' to true, if you want to have an overlay
# The valid values for screens are [ticket, all, unassigned, my, groups]
# Remove the following section if you do not want to define Action Handlers

action:
button:
overlay: false
screens:
- ticket
- all
- unassigned
label: Send To Email_after_archive
53 changes: 53 additions & 0 deletions apps/email_after_archive/email_after_archive.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,53 @@
module EmailAfterArchive
module EventHandler
# Handle 'ticket.created' event
def ticket_created
return true
end

def ticket_archived
recd_user = payload.agent.email
RestClient.post "https://api:#{settings.API_KEY}" \
"@api.mailgun.net/v2/#{mailgun_domain}/messages",
:from => "Excited User <rajat188@gmail.com>",
:to => "#{payload.agent.email}",
:subject => "#{settings.subject}",
:text => "#{settings.email_body}"
end

# Handle all events
def all_events
return true
end
end
end

module EmailAfterArchive
module ActionHandler
def button
# Handle Action here
[200, "Success"]
end
end
end

module EmailAfterArchive
class Base < SupportBeeApp::Base
# Define Settings
string :API_KEY, :required => true, :hint => 'This is the API Key from mailgun console'
string :subject, :required => true, :hint => 'Say Hello to your customers'
string :email_body, :required => true, :hint => 'The body of the email'
string :mailgun_domain, :required => true, :hint => 'The sub domain available in mailgun'
# string :name, :required => true, :hint => 'Tell me your name'
# string :username, :required => true, :label => 'User Name'
# password :password, :required => true
# boolean :notify_me, :default => true, :label => 'Notify Me'

# White list settings for logging
# white_list :name, :username

# Define public and private methods here which will be available
# in the EventHandler and ActionHandler modules
end
end

0 comments on commit 510673e

Please sign in to comment.