multi_mail 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fcb39c73b30d0f52705ccc4d3f24bcb1142a974d
4
+ data.tar.gz: c1a3e5183e6755f559475f3a4dcda2f8103d89fb
5
+ SHA512:
6
+ metadata.gz: b93ac384cfad8aa761a4cf21073a1c5ac4379493be11e8823f82006b8b8f2500e0868a5a1f545c09f22ecde04e107ec54d3cba42aaedfbb6f27a03e6f7f84196
7
+ data.tar.gz: f850d3ba49bc77ba05a54d0851920495bfa8ae4030d5a6f574d436009b6a115032b3e1ac5bccf0e59251ce379425ca6161713b6a6c12733598069628662dfffd
data/lib/multi_mail.rb CHANGED
@@ -6,7 +6,6 @@ require 'iconv' unless RUBY_VERSION >= '1.9'
6
6
 
7
7
  require 'faraday'
8
8
  require 'mail'
9
- require 'multimap'
10
9
  require 'rack'
11
10
 
12
11
  require 'mail_ext/message'
@@ -101,6 +100,7 @@ module MultiMail
101
100
  end
102
101
  end
103
102
 
103
+ require 'multi_mail/multimap'
104
104
  require 'multi_mail/service'
105
105
  require 'multi_mail/receiver'
106
106
  require 'multi_mail/message/base'
@@ -0,0 +1,63 @@
1
+ # @note The multimap gem was yanked, so we re-implement its functionality.
2
+ # @see https://github.com/josh/multimap
3
+ module MultiMail
4
+ class Multimap
5
+ def initialize
6
+ @hash = {}
7
+ end
8
+
9
+ def [](key)
10
+ @hash[key]
11
+ end
12
+
13
+ def []=(key, value)
14
+ @hash[key] ||= []
15
+ @hash[key] << value
16
+ end
17
+
18
+ def ==(other)
19
+ if Multimap === other
20
+ @hash == other.hash
21
+ else
22
+ @hash == other
23
+ end
24
+ end
25
+
26
+ def size
27
+ @hash.values.flatten.size
28
+ end
29
+
30
+ def each_pair
31
+ @hash.each_pair do |key,values|
32
+ values.each do |value|
33
+ yield key, value
34
+ end
35
+ end
36
+ end
37
+
38
+ def merge(other)
39
+ dup.update(other)
40
+ end
41
+
42
+ def update(other)
43
+ if Multimap === other
44
+ other.each_pair do |key,value|
45
+ self[key] = value
46
+ end
47
+ else
48
+ raise ArgumentError
49
+ end
50
+ self
51
+ end
52
+
53
+ def to_hash
54
+ @hash.dup
55
+ end
56
+
57
+ protected
58
+
59
+ def hash
60
+ @hash
61
+ end
62
+ end
63
+ end
@@ -4,7 +4,7 @@ module MultiMail
4
4
  class Postmark < MultiMail::Message::Base
5
5
  # Returns the message headers in Postmark format.
6
6
  #
7
- # @return [Multimap] the message headers in Postmark format
7
+ # @return [Array<Hash>] the message headers in Postmark format
8
8
  def postmark_headers
9
9
  array = []
10
10
  header_fields.each do |field|
@@ -20,7 +20,7 @@ module MultiMail
20
20
 
21
21
  # Returns the message's attachments in Postmark format.
22
22
  #
23
- # @return [Multimap] the attachments in Postmark format
23
+ # @return [Array<Hash>] the attachments in Postmark format
24
24
  # @see http://developer.postmarkapp.com/developer-build.html#attachments
25
25
  def postmark_attachments
26
26
  attachments.map do |attachment|
@@ -41,7 +41,7 @@ module MultiMail
41
41
 
42
42
  unless response.status == 200
43
43
  case body['ErrorCode']
44
- when 0
44
+ when 10
45
45
  raise InvalidAPIKey, body['Message']
46
46
  when 300
47
47
  case body['Message']
@@ -123,7 +123,7 @@ module MultiMail
123
123
  end
124
124
 
125
125
  # Flatten the parameters.
126
- map.each do |key,value|
126
+ map.each_pair do |key,value|
127
127
  if Array === value && value.size == 1
128
128
  params[key] = value.first
129
129
  else
@@ -1,3 +1,3 @@
1
1
  module MultiMail
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/multi_mail.gemspec CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_runtime_dependency 'faraday', '~> 0.8.0'
20
20
  s.add_runtime_dependency 'mail', '~> 2.5.3' # Rails 3.2.13, less buggy than 2.4.x
21
- s.add_runtime_dependency 'multimap', '~> 1.1.2'
22
21
  s.add_runtime_dependency 'rack', '~> 1.4'
23
22
 
24
23
  # For testing
@@ -65,7 +65,7 @@ describe MultiMail::Sender::Postmark do
65
65
  expect{
66
66
  message.delivery_method MultiMail::Sender::Postmark, :api_key => 'xxx'
67
67
  message.deliver
68
- }.to raise_error(MultiMail::InvalidAPIKey, 'Bad or missing server or user API token.')
68
+ }.to raise_error(MultiMail::InvalidAPIKey, 'Bad or missing Server API token.')
69
69
  end
70
70
  end
71
71
 
metadata CHANGED
@@ -1,234 +1,194 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: multi_mail
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Open North
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2014-01-08 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2014-04-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: faraday
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 63
30
- segments:
31
- - 0
32
- - 8
33
- - 0
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
34
19
  version: 0.8.0
35
20
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: mail
39
21
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 29
46
- segments:
47
- - 2
48
- - 5
49
- - 3
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: mail
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
50
33
  version: 2.5.3
51
34
  type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: multimap
55
35
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 23
62
- segments:
63
- - 1
64
- - 1
65
- - 2
66
- version: 1.1.2
67
- type: :runtime
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.5.3
41
+ - !ruby/object:Gem::Dependency
70
42
  name: rack
71
- prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 7
78
- segments:
79
- - 1
80
- - 4
81
- version: "1.4"
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.4'
82
48
  type: :runtime
83
- version_requirements: *id004
84
- - !ruby/object:Gem::Dependency
85
- name: coveralls
86
49
  prerelease: false
87
- requirement: &id005 !ruby/object:Gem::Requirement
88
- none: false
89
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
90
59
  - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
96
62
  type: :development
97
- version_requirements: *id005
98
- - !ruby/object:Gem::Dependency
99
- name: json
100
63
  prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
102
- none: false
103
- requirements:
104
- - - ~>
105
- - !ruby/object:Gem::Version
106
- hash: 5
107
- segments:
108
- - 1
109
- - 7
110
- - 7
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
111
75
  version: 1.7.7
112
76
  type: :development
113
- version_requirements: *id006
114
- - !ruby/object:Gem::Dependency
115
- name: rake
116
77
  prerelease: false
117
- requirement: &id007 !ruby/object:Gem::Requirement
118
- none: false
119
- requirements:
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.7.7
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
120
87
  - - ">="
121
- - !ruby/object:Gem::Version
122
- hash: 3
123
- segments:
124
- - 0
125
- version: "0"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
126
90
  type: :development
127
- version_requirements: *id007
128
- - !ruby/object:Gem::Dependency
129
- name: rspec
130
91
  prerelease: false
131
- requirement: &id008 !ruby/object:Gem::Requirement
132
- none: false
133
- requirements:
134
- - - ~>
135
- - !ruby/object:Gem::Version
136
- hash: 23
137
- segments:
138
- - 2
139
- - 10
140
- version: "2.10"
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.10'
141
104
  type: :development
142
- version_requirements: *id008
143
- - !ruby/object:Gem::Dependency
144
- name: vcr
145
105
  prerelease: false
146
- requirement: &id009 !ruby/object:Gem::Requirement
147
- none: false
148
- requirements:
149
- - - ~>
150
- - !ruby/object:Gem::Version
151
- hash: 31
152
- segments:
153
- - 2
154
- - 4
155
- - 0
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: vcr
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
156
117
  version: 2.4.0
157
118
  type: :development
158
- version_requirements: *id009
159
- - !ruby/object:Gem::Dependency
160
- name: mandrill-api
161
119
  prerelease: false
162
- requirement: &id010 !ruby/object:Gem::Requirement
163
- none: false
164
- requirements:
165
- - - ~>
166
- - !ruby/object:Gem::Version
167
- hash: 81
168
- segments:
169
- - 1
170
- - 0
171
- - 35
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 2.4.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: mandrill-api
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
172
131
  version: 1.0.35
173
132
  type: :development
174
- version_requirements: *id010
175
- - !ruby/object:Gem::Dependency
176
- name: postmark
177
133
  prerelease: false
178
- requirement: &id011 !ruby/object:Gem::Requirement
179
- none: false
180
- requirements:
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.0.35
139
+ - !ruby/object:Gem::Dependency
140
+ name: postmark
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
181
143
  - - ">="
182
- - !ruby/object:Gem::Version
183
- hash: 3
184
- segments:
185
- - 0
186
- version: "0"
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
187
146
  type: :development
188
- version_requirements: *id011
189
- - !ruby/object:Gem::Dependency
190
- name: rest-client
191
147
  prerelease: false
192
- requirement: &id012 !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ~>
196
- - !ruby/object:Gem::Version
197
- hash: 1
198
- segments:
199
- - 1
200
- - 6
201
- - 7
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rest-client
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
202
159
  version: 1.6.7
203
160
  type: :development
204
- version_requirements: *id012
205
- - !ruby/object:Gem::Dependency
206
- name: sendgrid_webapi
207
161
  prerelease: false
208
- requirement: &id013 !ruby/object:Gem::Requirement
209
- none: false
210
- requirements:
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.6.7
167
+ - !ruby/object:Gem::Dependency
168
+ name: sendgrid_webapi
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
211
171
  - - ">="
212
- - !ruby/object:Gem::Version
213
- hash: 3
214
- segments:
215
- - 0
216
- version: "0"
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
217
174
  type: :development
218
- version_requirements: *id013
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
219
181
  description:
220
- email:
182
+ email:
221
183
  - info@opennorth.ca
222
- executables:
184
+ executables:
223
185
  - multi_mail_post
224
186
  extensions: []
225
-
226
187
  extra_rdoc_files: []
227
-
228
- files:
229
- - .gitignore
230
- - .travis.yml
231
- - .yardopts
188
+ files:
189
+ - ".gitignore"
190
+ - ".travis.yml"
191
+ - ".yardopts"
232
192
  - Gemfile
233
193
  - LICENSE
234
194
  - README.md
@@ -245,6 +205,7 @@ files:
245
205
  - lib/multi_mail/mandrill/receiver.rb
246
206
  - lib/multi_mail/mandrill/sender.rb
247
207
  - lib/multi_mail/message/base.rb
208
+ - lib/multi_mail/multimap.rb
248
209
  - lib/multi_mail/postmark/message.rb
249
210
  - lib/multi_mail/postmark/receiver.rb
250
211
  - lib/multi_mail/postmark/sender.rb
@@ -312,41 +273,31 @@ files:
312
273
  - spec/service_spec.rb
313
274
  - spec/simple/receiver_spec.rb
314
275
  - spec/spec_helper.rb
315
- has_rdoc: true
316
276
  homepage: http://github.com/opennorth/multi_mail
317
- licenses:
277
+ licenses:
318
278
  - MIT
279
+ metadata: {}
319
280
  post_install_message:
320
281
  rdoc_options: []
321
-
322
- require_paths:
282
+ require_paths:
323
283
  - lib
324
- required_ruby_version: !ruby/object:Gem::Requirement
325
- none: false
326
- requirements:
284
+ required_ruby_version: !ruby/object:Gem::Requirement
285
+ requirements:
327
286
  - - ">="
328
- - !ruby/object:Gem::Version
329
- hash: 3
330
- segments:
331
- - 0
332
- version: "0"
333
- required_rubygems_version: !ruby/object:Gem::Requirement
334
- none: false
335
- requirements:
287
+ - !ruby/object:Gem::Version
288
+ version: '0'
289
+ required_rubygems_version: !ruby/object:Gem::Requirement
290
+ requirements:
336
291
  - - ">="
337
- - !ruby/object:Gem::Version
338
- hash: 3
339
- segments:
340
- - 0
341
- version: "0"
292
+ - !ruby/object:Gem::Version
293
+ version: '0'
342
294
  requirements: []
343
-
344
295
  rubyforge_project:
345
- rubygems_version: 1.6.2
296
+ rubygems_version: 2.2.2
346
297
  signing_key:
347
- specification_version: 3
298
+ specification_version: 4
348
299
  summary: Easily switch between email APIs
349
- test_files:
300
+ test_files:
350
301
  - spec/cloudmailin/receiver_spec.rb
351
302
  - spec/fixtures/cloudmailin/json/attachment_store.txt
352
303
  - spec/fixtures/cloudmailin/json/spam.txt