griddler-mailgun 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/griddler/mailgun/adapter.rb +7 -3
- data/lib/griddler/mailgun/version.rb +1 -1
- data/spec/griddler/mailgun/adapter_spec.rb +9 -0
- data/spec/spec_helper.rb +1 -0
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f41f83fbfcb706db836f08b8bd1452aefbc68373
|
4
|
+
data.tar.gz: d67ba9fbcea79255087036e2a3104da2c6ebf17c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7363af24241d91f4030a9fa81e3411884766777b1f32d6d1632bb2433b135aecc871ee561f64f541ad4f55ab2bd5042db4aad320c5b5420426a95550005c1f91
|
7
|
+
data.tar.gz: af65fc016ac75f4599548a08fa07de8e05362b736e8c2d5081fba68e8d8661917b14b1cf5da5ee962a2073b53a88ece65bd34869f331d95f4780ce4b1891ebed
|
data/README.md
CHANGED
@@ -12,8 +12,8 @@ parse emails forwarded to your application from [mailgun](http://mailgun.com/).
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem 'griddler', '~> 1.
|
16
|
-
gem 'griddler-mailgun', '~> 1.0.
|
15
|
+
gem 'griddler', '~> 1.1.0'
|
16
|
+
gem 'griddler-mailgun', '~> 1.0.3'
|
17
17
|
```
|
18
18
|
|
19
19
|
Then execute:
|
@@ -30,7 +30,7 @@ bundle install
|
|
30
30
|
|
31
31
|
Mailgun uses [routes](http://documentation.mailgun.com/user_manual.html#routes) to filter incoming emails and forward them to your app. A route is made up of a filter and an action. [The filter](http://documentation.mailgun.com/api-routes.html#filters) matches emails based on its properties and [the action](http://documentation.mailgun.com/api-routes.html#actions) determines what happens to the matched email.
|
32
32
|
|
33
|
-
For example, to forward any email sent to an example.net address to http://example.com/email_processor
|
33
|
+
For example, to forward any email sent to an example.net address to http://example.com/email_processor
|
34
34
|
the following route would be used:
|
35
35
|
|
36
36
|
Filter Expression:
|
@@ -80,10 +80,14 @@ module Griddler
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def attachment_files
|
83
|
-
|
83
|
+
if params["attachment-count"].present?
|
84
|
+
attachment_count = params["attachment-count"].to_i
|
84
85
|
|
85
|
-
|
86
|
-
|
86
|
+
attachment_count.times.map do |index|
|
87
|
+
params.delete("attachment-#{index+1}")
|
88
|
+
end
|
89
|
+
else
|
90
|
+
params["attachments"] || []
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
@@ -30,6 +30,15 @@ describe Griddler::Mailgun::Adapter, '.normalize_params' do
|
|
30
30
|
expect(normalized_params[:attachments]).to eq [upload_1, upload_2]
|
31
31
|
end
|
32
32
|
|
33
|
+
it "receives attachments sent from store action" do
|
34
|
+
params = default_params.merge(
|
35
|
+
"attachments" => [{ url: "sample.url", name: "sample name" },
|
36
|
+
{ url: "sample2.url", name: "sample name 2" }]
|
37
|
+
)
|
38
|
+
normalized_params = Griddler::Mailgun::Adapter.normalize_params(params)
|
39
|
+
expect(normalized_params[:attachments].length).to eq 2
|
40
|
+
end
|
41
|
+
|
33
42
|
it 'has no attachments' do
|
34
43
|
normalized_params = Griddler::Mailgun::Adapter.normalize_params(default_params)
|
35
44
|
expect(normalized_params[:attachments]).to be_empty
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: griddler-mailgun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Pauly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -103,4 +103,3 @@ test_files:
|
|
103
103
|
- spec/fixtures/photo2.jpg
|
104
104
|
- spec/griddler/mailgun/adapter_spec.rb
|
105
105
|
- spec/spec_helper.rb
|
106
|
-
has_rdoc:
|