postmark-mitt 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/README.rdoc +73 -0
- data/Rakefile +47 -0
- data/VERSION +1 -0
- data/lib/postmark/mitt.rb +102 -0
- data/lib/postmark_mitt.rb +4 -0
- data/spec/fixtures/email.json +54 -0
- data/spec/postmark/mitt_spec.rb +89 -0
- data/spec/spec_helper.rb +18 -0
- metadata +135 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Randy Schmidt
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
= Postmark Mitt
|
2
|
+
|
3
|
+
(This is only a prototype at the moment, it hasn't been built as a real gem yet. There are no tests.)
|
4
|
+
|
5
|
+
This gem provides a little wrapper object for taking JSON from Postmark's incoming email system and composing it back into an object resembling an email. This comes in handy when you are trying to figure out what to do with the email.
|
6
|
+
|
7
|
+
== Install
|
8
|
+
|
9
|
+
gem install postmark-mitt
|
10
|
+
|
11
|
+
== Example
|
12
|
+
|
13
|
+
require 'lib/postmark_mitt'
|
14
|
+
|
15
|
+
# if you are just playing with this library
|
16
|
+
email = Postmark::Mitt.new(File.read("path/to/json/file/in/spec/fixtures"))
|
17
|
+
|
18
|
+
# if you are doing this in a controller
|
19
|
+
email = Postmark::Mitt.new(request.body.read)
|
20
|
+
|
21
|
+
email.to # "api-hash@inbound.postmarkapp.com"
|
22
|
+
email.from # Bob Bobson <bob@bob.com>
|
23
|
+
email.from_email # bob@bob.com
|
24
|
+
email.text_body
|
25
|
+
email.html_body
|
26
|
+
email.headers # returns a hash of the headers
|
27
|
+
|
28
|
+
email.attachments # array of attachment objects
|
29
|
+
|
30
|
+
attachment = email.attachments.first
|
31
|
+
attachment.file_name
|
32
|
+
attachment.content_type
|
33
|
+
attachment.read # will base64 decode the content... eventually this will lazy-load the file from Postmark
|
34
|
+
attachment.size # NYI
|
35
|
+
# You get the idea
|
36
|
+
|
37
|
+
A lot of times you want to do something with the email, like create a post
|
38
|
+
|
39
|
+
mitt = Postmark::Mitt.new(request.body.read)
|
40
|
+
Post.create_from_postmark(mitt)
|
41
|
+
|
42
|
+
class Post
|
43
|
+
def self.create_from_postmark(mitt)
|
44
|
+
author = User.find_by_api_email(mitt.to)
|
45
|
+
handle_no_author # send an email back saying we couldn't find them
|
46
|
+
post = new
|
47
|
+
post.title = mitt.subject
|
48
|
+
post.author = author
|
49
|
+
post.photo = mitt.attachments.first.read
|
50
|
+
post.message_id = mitt.message_id # Make sure we don't process the same email twice
|
51
|
+
# You get the idea, right?
|
52
|
+
post.save
|
53
|
+
post
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
== Note on Patches/Pull Requests
|
58
|
+
|
59
|
+
* Fork the project.
|
60
|
+
* Make your feature addition or bug fix.
|
61
|
+
* Add tests for it. This is important so I don't break it in a
|
62
|
+
future version unintentionally.
|
63
|
+
* Commit, do not mess with rakefile, version, or history.
|
64
|
+
* Send me a pull request. Bonus points for topic branches.
|
65
|
+
|
66
|
+
== Authors & Contributors
|
67
|
+
|
68
|
+
* Randy Schmidt
|
69
|
+
|
70
|
+
== Copyright
|
71
|
+
|
72
|
+
Copyright (c) 2011 Randy Schmidt. See LICENSE for details.
|
73
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "postmark-mitt"
|
16
|
+
gem.homepage = "http://github.com/r38y/postmark-mitt"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %q{PROTOTYPE Mitt for incoming email through Postmark}
|
19
|
+
gem.description = %q{(Prototype) This gem will help you take JSON posted to your app from incoming email through Postmark. It will turn it back into an object with methods to help inspect the contents of the email}
|
20
|
+
gem.email = "randy@forge38.com"
|
21
|
+
gem.authors = ["Randy Schmidt"]
|
22
|
+
gem.add_dependency "multi_json"
|
23
|
+
end
|
24
|
+
Jeweler::RubygemsDotOrgTasks.new
|
25
|
+
|
26
|
+
require 'rspec/core'
|
27
|
+
require 'rspec/core/rake_task'
|
28
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
29
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
33
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
34
|
+
spec.rcov = true
|
35
|
+
end
|
36
|
+
|
37
|
+
task :default => :spec
|
38
|
+
|
39
|
+
require 'rake/rdoctask'
|
40
|
+
Rake::RDocTask.new do |rdoc|
|
41
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
42
|
+
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
44
|
+
rdoc.title = "postmark-mitt #{version}"
|
45
|
+
rdoc.rdoc_files.include('README*')
|
46
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module Postmark
|
2
|
+
class Mitt
|
3
|
+
VERSION = "0.0.1"
|
4
|
+
|
5
|
+
def initialize(json)
|
6
|
+
@raw = json
|
7
|
+
@source = MultiJson.decode(json)
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :raw, :source
|
11
|
+
|
12
|
+
def inspect
|
13
|
+
"<Postmark::Mitt: #{message_id}>"
|
14
|
+
end
|
15
|
+
|
16
|
+
def subject
|
17
|
+
source["Subject"]
|
18
|
+
end
|
19
|
+
|
20
|
+
def from
|
21
|
+
source["From"].gsub('"', '')
|
22
|
+
end
|
23
|
+
|
24
|
+
def from_email
|
25
|
+
if match = from.match(/^.+<(.+)>$/)
|
26
|
+
match[1]
|
27
|
+
else
|
28
|
+
from_email
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def to
|
33
|
+
source["To"]
|
34
|
+
end
|
35
|
+
|
36
|
+
def bcc
|
37
|
+
source["Bcc"]
|
38
|
+
end
|
39
|
+
|
40
|
+
def cc
|
41
|
+
source["Cc"]
|
42
|
+
end
|
43
|
+
|
44
|
+
def reply_to
|
45
|
+
source["ReplyTo"]
|
46
|
+
end
|
47
|
+
|
48
|
+
def html_body
|
49
|
+
source["HtmlBody"]
|
50
|
+
end
|
51
|
+
|
52
|
+
def text_body
|
53
|
+
source["TextBody"]
|
54
|
+
end
|
55
|
+
|
56
|
+
def mailbox_hash
|
57
|
+
source["MailboxHash"]
|
58
|
+
end
|
59
|
+
|
60
|
+
def tag
|
61
|
+
source["Tag"]
|
62
|
+
end
|
63
|
+
|
64
|
+
def headers
|
65
|
+
@headers ||= source["Headers"].inject({}){|hash,obj| hash[obj["Name"]] = obj["Value"]; hash}
|
66
|
+
end
|
67
|
+
|
68
|
+
def message_id
|
69
|
+
source["MessageID"]
|
70
|
+
end
|
71
|
+
|
72
|
+
def attachments
|
73
|
+
@attachments ||= begin
|
74
|
+
raw_attachments = source["Attachments"] || []
|
75
|
+
raw_attachments.map{|a| Attachment.new(a)}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class Attachment
|
80
|
+
def initialize(attachment_source)
|
81
|
+
@source = attachment_source
|
82
|
+
end
|
83
|
+
attr_accessor :source
|
84
|
+
|
85
|
+
def content_type
|
86
|
+
source["ContentType"]
|
87
|
+
end
|
88
|
+
|
89
|
+
def file_name
|
90
|
+
source["Name"]
|
91
|
+
end
|
92
|
+
|
93
|
+
def read
|
94
|
+
Base64.decode64(source["Content"])
|
95
|
+
end
|
96
|
+
|
97
|
+
def size
|
98
|
+
"NYI"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
{
|
2
|
+
"Attachments": [
|
3
|
+
{
|
4
|
+
"Content": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAIAAAAP3aGbAAAABmJLR0QA\/wD\/AP+gvaeTAAAHFklEQVR4nO3dUWojSRRFwdHQ+9+yegE99BQ4eXonFfFt7HJJHPLnkq\/3+\/0PQMG\/n34AgKcEC8gQLCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyBAsIEOwgAzBAjIEC8gQLCBDsIAMwQIyBAv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BAvIECwgQ7CADMECMgQLyBAsIEOwgAzBAjIEC8gQLCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyBAsIEOwgAzBAjIEC8gQLCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyPgN6\/l0MFbvnZQAAAAASUVORK5CYII=",
|
5
|
+
"ContentType": "image\/png",
|
6
|
+
"Name": "chart.png"
|
7
|
+
}
|
8
|
+
],
|
9
|
+
"Bcc": "FBI <hi@fbi.com>",
|
10
|
+
"Cc": "Your Mom <hithere@hotmail.com>",
|
11
|
+
"From": "\"Bob Bobson\" <bob@bob.com>",
|
12
|
+
"Headers": [
|
13
|
+
{
|
14
|
+
"Name": "Received-SPF",
|
15
|
+
"Value": "None (no SPF record) identity=mailfrom; client-ip=209.85.212.52; helo=mail-vw0-f52.google.com; envelope-from=bob@bob.com; receiver=4e8d6dec234dd90018e7bfd2b5d79107@inbound.postmarkapp.com"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"Name": "MIME-Version",
|
19
|
+
"Value": "1.0"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"Name": "Date",
|
23
|
+
"Value": "Thu, 31 Mar 2011 12:01:17 -0400"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"Name": "Message-ID",
|
27
|
+
"Value": "<AANLkTin3nR52muA3Pner1eoLo6GLQz_5iZLTPvwEjZNu@mail.gmail.com>"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"Name": "Subject",
|
31
|
+
"Value": "Hi There"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"Name": "From",
|
35
|
+
"Value": "Bob Bobson <bob@bob.com>"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"Name": "To",
|
39
|
+
"Value": "api-hash@inbound.postmarkapp.com"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"Name": "Content-Type",
|
43
|
+
"Value": "multipart\/mixed"
|
44
|
+
}
|
45
|
+
],
|
46
|
+
"HtmlBody": "<p>We no speak americano</p>",
|
47
|
+
"MailboxHash": "moitoken",
|
48
|
+
"MessageID": "a8c1040e-db1c-4e18-ac79-bc5f64c7ce2c",
|
49
|
+
"ReplyTo": "new-comment+sometoken@yeah.com",
|
50
|
+
"Subject": "Hi There",
|
51
|
+
"Tag": "yourit",
|
52
|
+
"TextBody": "\nThis is awesome!\n\n",
|
53
|
+
"To": "api-hash@inbound.postmarkapp.com"
|
54
|
+
}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/..' + '/spec_helper')
|
2
|
+
|
3
|
+
describe Postmark::Mitt do
|
4
|
+
let(:mitt) do
|
5
|
+
Postmark::Mitt.new(read_fixture)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have a subject" do
|
9
|
+
mitt.subject.should == "Hi There"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have a html_body" do
|
13
|
+
mitt.html_body.should == "<p>We no speak americano</p>"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have a text_body" do
|
17
|
+
mitt.text_body.should == "\nThis is awesome!\n\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be to someone" do
|
21
|
+
mitt.to.should == "api-hash@inbound.postmarkapp.com"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be from someone" do
|
25
|
+
mitt.from.should == "Bob Bobson <bob@bob.com>"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should pull out the from_email" do
|
29
|
+
mitt.from_email.should == "bob@bob.com"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should have a bcc" do
|
33
|
+
mitt.bcc.should == "FBI <hi@fbi.com>"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have a cc" do
|
37
|
+
mitt.cc.should == "Your Mom <hithere@hotmail.com>"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should have a reply_to" do
|
41
|
+
mitt.reply_to.should == "new-comment+sometoken@yeah.com"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should have a mailbox_hash" do
|
45
|
+
mitt.mailbox_hash.should == 'moitoken'
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have a tag" do
|
49
|
+
mitt.tag.should == 'yourit'
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should have a message_id" do
|
53
|
+
mitt.message_id.should == "a8c1040e-db1c-4e18-ac79-bc5f64c7ce2c"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should have headers" do
|
57
|
+
mitt.headers["Date"].should =="Thu, 31 Mar 2011 12:01:17 -0400"
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should have an attachment" do
|
61
|
+
mitt.attachments.size.should == 1
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should have attachment objects" do
|
65
|
+
mitt.attachments.first.class.name.should == 'Postmark::Mitt::Attachment'
|
66
|
+
end
|
67
|
+
|
68
|
+
describe Postmark::Mitt::Attachment do
|
69
|
+
let(:attachment) do
|
70
|
+
mitt.attachments.first
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should have a content_type" do
|
74
|
+
attachment.content_type.should == 'image/png'
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should have a file_name" do
|
78
|
+
attachment.file_name.should == 'chart.png'
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should read the content" do
|
82
|
+
attachment.read.should_not be_empty
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should have a size" do
|
86
|
+
attachment.size.should == "NYI"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'postmark_mitt'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
SPEC_ROOT = Pathname.new(File.dirname(__FILE__))
|
11
|
+
|
12
|
+
def read_fixture(file='email.json')
|
13
|
+
File.read(File.join(SPEC_ROOT, 'fixtures', 'email.json'))
|
14
|
+
end
|
15
|
+
|
16
|
+
RSpec.configure do |config|
|
17
|
+
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: postmark-mitt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Randy Schmidt
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-18 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: multi_json
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.3.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: bundler
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.0
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: jeweler
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.5.2
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rcov
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: multi_json
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
description: (Prototype) This gem will help you take JSON posted to your app from incoming email through Postmark. It will turn it back into an object with methods to help inspect the contents of the email
|
83
|
+
email: randy@forge38.com
|
84
|
+
executables: []
|
85
|
+
|
86
|
+
extensions: []
|
87
|
+
|
88
|
+
extra_rdoc_files:
|
89
|
+
- LICENSE
|
90
|
+
- README.rdoc
|
91
|
+
files:
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- README.rdoc
|
95
|
+
- Rakefile
|
96
|
+
- VERSION
|
97
|
+
- lib/postmark/mitt.rb
|
98
|
+
- lib/postmark_mitt.rb
|
99
|
+
- spec/fixtures/email.json
|
100
|
+
- spec/postmark/mitt_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
has_rdoc: true
|
103
|
+
homepage: http://github.com/r38y/postmark-mitt
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: -556844520113005002
|
117
|
+
segments:
|
118
|
+
- 0
|
119
|
+
version: "0"
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
requirements: []
|
127
|
+
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.5.2
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: PROTOTYPE Mitt for incoming email through Postmark
|
133
|
+
test_files:
|
134
|
+
- spec/postmark/mitt_spec.rb
|
135
|
+
- spec/spec_helper.rb
|