griddler-cloudmailin 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +23 -0
- data/README.md +21 -0
- data/Rakefile +2 -0
- data/griddler-cloudmailin.gemspec +26 -0
- data/lib/griddler/cloudmailin.rb +5 -0
- data/lib/griddler/cloudmailin/adapter.rb +35 -0
- data/lib/griddler/cloudmailin/version.rb +5 -0
- data/spec/griddler/cloudmailin/adapter_spec.rb +50 -0
- data/spec/spec_helper.rb +8 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fedb235f9299777b382940abbebbdecb9ef76f48
|
4
|
+
data.tar.gz: 10cd44cd4cc53fd480d48df5dc49a562a21fe676
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 346ae7e46d5fcbec5a80da8a01acbf9acace8d883103b45b4550f8228cf8c5951c886565c4f2fa034a00fd89553bf80a00e38811998644656a1e04d2b735dd79
|
7
|
+
data.tar.gz: a2e66410901a3c7056a0e692a2d7fe821a7e2a59b08fc490940d993ec7631883b1651db592c23dda197b9f9d853da1205a496cbaead507c8ec8036fce1bbec11
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2014
|
2
|
+
Portions copyright (c) 2014 Caleb Thompson, Joel Oliveira and thoughtbot, inc.
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Griddler::Cloudmailin
|
2
|
+
|
3
|
+
An adapter for [Griddler](https://github.com/thoughtbot/griddler) to allow
|
4
|
+
[Cloudmailin](http://cloudmailin.com) to be used with the gem.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'griddler'
|
12
|
+
gem 'griddler-cloudmailin'
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
TODO: Write usage instructions here
|
18
|
+
|
19
|
+
## More Information
|
20
|
+
|
21
|
+
* [Cloudmailin Docs](http://docs.cloudmailin.com/)
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'griddler/cloudmailin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "griddler-cloudmailin"
|
8
|
+
spec.version = Griddler::Cloudmailin::VERSION
|
9
|
+
spec.authors = ["calebthompson"]
|
10
|
+
spec.email = ["caleb@calebthompson.io"]
|
11
|
+
spec.summary = %q{Griddler Cloudmailin}
|
12
|
+
spec.description = %q{Griddler Cloudmailin}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
|
25
|
+
spec.add_dependency "griddler"
|
26
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'active_support/core_ext/string/strip'
|
2
|
+
|
3
|
+
module Griddler
|
4
|
+
module Cloudmailin
|
5
|
+
class Adapter
|
6
|
+
def initialize(params)
|
7
|
+
@params = params
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.normalize_params(params)
|
11
|
+
adapter = new(params)
|
12
|
+
adapter.normalize_params
|
13
|
+
end
|
14
|
+
|
15
|
+
def normalize_params
|
16
|
+
{
|
17
|
+
to: params[:envelope][:to].split(','),
|
18
|
+
cc: ccs,
|
19
|
+
from: params[:envelope][:from],
|
20
|
+
subject: params[:headers][:Subject],
|
21
|
+
text: params[:plain],
|
22
|
+
attachments: params.fetch(:attachments) { [] },
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :params
|
29
|
+
|
30
|
+
def ccs
|
31
|
+
params[:headers][:Cc].to_s.split(',').map(&:strip)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Griddler::Cloudmailin::Adapter, '.normalize_params' do
|
4
|
+
it_should_behave_like 'Griddler adapter', :cloudmailin, {
|
5
|
+
envelope: {
|
6
|
+
to: 'Hello World <hi@example.com>',
|
7
|
+
from: 'There <there@example.com>',
|
8
|
+
},
|
9
|
+
plain: 'hi',
|
10
|
+
headers: { Cc: 'emily@example.com' },
|
11
|
+
}
|
12
|
+
|
13
|
+
it 'normalizes parameters' do
|
14
|
+
expect(Griddler::Cloudmailin::Adapter.normalize_params(default_params)).to be_normalized_to({
|
15
|
+
to: ['Some Identifier <some-identifier@example.com>'],
|
16
|
+
cc: ['emily@example.com'],
|
17
|
+
from: 'Joe User <joeuser@example.com>',
|
18
|
+
subject: 'Re: [ThisApp] That thing',
|
19
|
+
text: /Dear bob/
|
20
|
+
})
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'passes the received array of files' do
|
24
|
+
params = default_params.merge({ attachments: [upload_1, upload_2] })
|
25
|
+
|
26
|
+
normalized_params = Griddler::Cloudmailin::Adapter.normalize_params(params)
|
27
|
+
expect(normalized_params[:attachments]).to eq [upload_1, upload_2]
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'has no attachments' do
|
31
|
+
params = default_params
|
32
|
+
|
33
|
+
normalized_params = Griddler::Cloudmailin::Adapter.normalize_params(params)
|
34
|
+
expect(normalized_params[:attachments]).to be_empty
|
35
|
+
end
|
36
|
+
|
37
|
+
def default_params
|
38
|
+
{
|
39
|
+
envelope: { to: 'Some Identifier <some-identifier@example.com>', from: 'Joe User <joeuser@example.com>' },
|
40
|
+
headers: { Subject: 'Re: [ThisApp] That thing', Cc: 'emily@example.com' },
|
41
|
+
plain: <<-EOS.strip_heredoc.strip
|
42
|
+
Dear bob
|
43
|
+
|
44
|
+
Reply ABOVE THIS LINE
|
45
|
+
|
46
|
+
hey sup
|
47
|
+
EOS
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: griddler-cloudmailin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- calebthompson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: griddler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Griddler Cloudmailin
|
70
|
+
email:
|
71
|
+
- caleb@calebthompson.io
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- griddler-cloudmailin.gemspec
|
82
|
+
- lib/griddler/cloudmailin.rb
|
83
|
+
- lib/griddler/cloudmailin/adapter.rb
|
84
|
+
- lib/griddler/cloudmailin/version.rb
|
85
|
+
- spec/griddler/cloudmailin/adapter_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
homepage: ''
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.4.5
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Griddler Cloudmailin
|
111
|
+
test_files:
|
112
|
+
- spec/griddler/cloudmailin/adapter_spec.rb
|
113
|
+
- spec/spec_helper.rb
|