griddler-mailgun 1.0.2 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2377ee3b434c8ed1763841a6158052ef0d5cdfcd
4
- data.tar.gz: 3138c2e3d6962b70aa89c2df0e262ef74eea0bb2
3
+ metadata.gz: f41f83fbfcb706db836f08b8bd1452aefbc68373
4
+ data.tar.gz: d67ba9fbcea79255087036e2a3104da2c6ebf17c
5
5
  SHA512:
6
- metadata.gz: 082e170f993d4f7751361d33f5bb6ff211612ddb6d957675fdda01f8c922d48b88ff3833fa9517de0ff7d90eede0dc53451e9dbf0371ad81237e845a10122fde
7
- data.tar.gz: 0a2a0956210186cb7d228f8b6fec99d2d83f37a0a1439d418a90fca09b639ef3f07a444fe8138c47cb286bfa82ba61276373417a4716a90c1a89baa6276f083d
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.0.0'
16
- gem 'griddler-mailgun', '~> 1.0.1'
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
- attachment_count = params['attachment-count'].to_i
83
+ if params["attachment-count"].present?
84
+ attachment_count = params["attachment-count"].to_i
84
85
 
85
- attachment_count.times.map do |index|
86
- params.delete("attachment-#{index+1}")
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
@@ -1,5 +1,5 @@
1
1
  module Griddler
2
2
  module Mailgun
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  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
@@ -1,3 +1,4 @@
1
+ require 'griddler'
1
2
  require 'griddler/testing'
2
3
  require 'griddler/mailgun'
3
4
  require 'action_dispatch'
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.2
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: 2015-01-30 00:00:00.000000000 Z
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: