send_with_us 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +1 -1
- data/README.md +3 -4
- data/lib/send_with_us/api.rb +13 -1
- data/lib/send_with_us/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4af3e368512e19608207ecc65ef6a8e6cd8deb0b
|
4
|
+
data.tar.gz: f1f2ac7ebb7d14164f768dab256669fe5e1822da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5071d2e5c5c453c26802b024483e61ce3dd93a03410c8eddacf7bfa493eed1fe42c4f814386c3bc5ec3e872ba20800162e4442e1f8fab6d89ee860f19bf1ed2b
|
7
|
+
data.tar.gz: b5088e7f4267e46867e29bd12acc7b7583bfa159736c697caa16bf2091fa2cddaaf951e074604a195036c957c9b687c3465f8e181a869ab70bec03c0f38923ab
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE
CHANGED
@@ -187,7 +187,7 @@
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
188
188
|
identification within third-party archives.
|
189
189
|
|
190
|
-
Copyright
|
190
|
+
Copyright 2013 Techdrop Labs Inc.
|
191
191
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
193
193
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -47,8 +47,7 @@ begin
|
|
47
47
|
reply_to: 'info@testco.com' })
|
48
48
|
puts result
|
49
49
|
|
50
|
-
#
|
51
|
-
# cc/bb support is coming soon, here's a taste test
|
50
|
+
# full cc/bcc support
|
52
51
|
result = obj.send_with(
|
53
52
|
'email_id',
|
54
53
|
{ name: 'Matt', address: 'recipient@testco.com' },
|
@@ -67,7 +66,7 @@ begin
|
|
67
66
|
address: 'bcc2@test.com' }
|
68
67
|
])
|
69
68
|
puts result
|
70
|
-
rescue
|
69
|
+
rescue => e
|
71
70
|
puts "Error - #{e.class.name}: #{e.message}"
|
72
71
|
end
|
73
72
|
```
|
@@ -90,7 +89,7 @@ In your application code where you want to send an email:
|
|
90
89
|
begin
|
91
90
|
result = SendWithUs::Api.new.send_with('email_id', { address: 'recipient@testco.com' }, { company_name: 'TestCo' })
|
92
91
|
puts result
|
93
|
-
rescue
|
92
|
+
rescue => e
|
94
93
|
puts "Error - #{e.class.name}: #{e.message}"
|
95
94
|
end
|
96
95
|
```
|
data/lib/send_with_us/api.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "base64"
|
2
|
+
|
1
3
|
module SendWithUs
|
2
4
|
class ApiNilEmailId < StandardError; end
|
3
5
|
|
@@ -21,7 +23,7 @@ module SendWithUs
|
|
21
23
|
@configuration = SendWithUs::Config.new(settings)
|
22
24
|
end
|
23
25
|
|
24
|
-
def send_with(email_id, to, data = {}, from = {}, cc={}, bcc={})
|
26
|
+
def send_with(email_id, to, data = {}, from = {}, cc={}, bcc={}, files=[])
|
25
27
|
|
26
28
|
if email_id.nil?
|
27
29
|
raise SendWithUs::ApiNilEmailId, 'email_id cannot be nil'
|
@@ -40,6 +42,16 @@ module SendWithUs
|
|
40
42
|
payload[:bcc] = bcc
|
41
43
|
end
|
42
44
|
|
45
|
+
files.each do |path|
|
46
|
+
file = open(path).read
|
47
|
+
id = File.basename(path)
|
48
|
+
data = Base64.encode64(file)
|
49
|
+
if payload[:files].nil?
|
50
|
+
payload[:files] = []
|
51
|
+
end
|
52
|
+
payload[:files] << {id: id, data: data}
|
53
|
+
end
|
54
|
+
|
43
55
|
payload = payload.to_json
|
44
56
|
SendWithUs::ApiRequest.new(@configuration).send_with(payload)
|
45
57
|
end
|
data/lib/send_with_us/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: send_with_us
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Harris
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|