send_with_us 1.0.4 → 1.0.5

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: de064297eaee13a65efcd5424b3466a19b67c0e8
4
- data.tar.gz: 4fa7d095bb9dcae5f59b0ff2715a9bdc1d083d5f
3
+ metadata.gz: 4af3e368512e19608207ecc65ef6a8e6cd8deb0b
4
+ data.tar.gz: f1f2ac7ebb7d14164f768dab256669fe5e1822da
5
5
  SHA512:
6
- metadata.gz: f69c00aea2404388296838449d83a550608d2e06ebadcace72b88fff42395ef7b6d75e7fe6b2a77c716da6162ffbae1eca0c91a60abf2d530b93c3687dba18d8
7
- data.tar.gz: 4ac1dde712316fee5284474fd75a00848161dd395573adbe3ca3521079c2df8aa9ad5a8d0081e8ea3325749f0a3ed74ba15f921f5796d433df32e98d7e8f5a1d
6
+ metadata.gz: 5071d2e5c5c453c26802b024483e61ce3dd93a03410c8eddacf7bfa493eed1fe42c4f814386c3bc5ec3e872ba20800162e4442e1f8fab6d89ee860f19bf1ed2b
7
+ data.tar.gz: b5088e7f4267e46867e29bd12acc7b7583bfa159736c697caa16bf2091fa2cddaaf951e074604a195036c957c9b687c3465f8e181a869ab70bec03c0f38923ab
@@ -1,3 +1,4 @@
1
+ 1.0.5 - Add attachment support
1
2
  1.0.4 - Add drip campaign unsubscribe support
2
3
  1.0.3 - Don't allow nil email_id
3
4
  1.0.2 - More sensible error messages
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- send_with_us (1.0.4)
4
+ send_with_us (1.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 [yyyy] [name of copyright owner]
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
- # COMING SOON
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 Exception => e
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 Exception => e
92
+ rescue => e
94
93
  puts "Error - #{e.class.name}: #{e.message}"
95
94
  end
96
95
  ```
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SendWithUs
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
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
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: 2013-11-23 00:00:00.000000000 Z
13
+ date: 2014-02-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake