send_with_us 1.1.0 → 1.1.1
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.
- data/Gemfile.lock +1 -1
- data/README.md +20 -2
- data/lib/send_with_us/api_request.rb +3 -2
- data/lib/send_with_us/version.rb +1 -1
- data/test/lib/send_with_us/api_request_test.rb +12 -0
- metadata +21 -13
- checksums.yaml +0 -7
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,7 @@ begin
|
|
36
36
|
'EMAIL_ID',
|
37
37
|
{ address: "user@example.com" })
|
38
38
|
puts result
|
39
|
-
|
39
|
+
|
40
40
|
# with all optional params
|
41
41
|
result = obj.send_with(
|
42
42
|
'email_id',
|
@@ -46,7 +46,7 @@ begin
|
|
46
46
|
address: 'company@example.com',
|
47
47
|
reply_to: 'info@example.com' })
|
48
48
|
puts result
|
49
|
-
|
49
|
+
|
50
50
|
# full cc/bcc support
|
51
51
|
result = obj.send_with(
|
52
52
|
'email_id',
|
@@ -84,6 +84,22 @@ rescue => e
|
|
84
84
|
end
|
85
85
|
```
|
86
86
|
|
87
|
+
### Remove Customer from Drip Campaign
|
88
|
+
```ruby
|
89
|
+
require 'rubygems'
|
90
|
+
require 'send_with_us'
|
91
|
+
|
92
|
+
begin
|
93
|
+
obj = SendWithUs::Api.new( api_key: 'YOUR API KEY', debug: true )
|
94
|
+
|
95
|
+
result = obj.drip_unsubscribe('customer@example.com')
|
96
|
+
|
97
|
+
puts result
|
98
|
+
rescue => e
|
99
|
+
puts "Error - #{e.class.name}: #{e.message}"
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
87
103
|
### Rails
|
88
104
|
|
89
105
|
For a Rails app, create `send_with_us.rb` in `/config/initializers/`
|
@@ -113,6 +129,8 @@ The following errors may be generated:
|
|
113
129
|
|
114
130
|
```ruby
|
115
131
|
SendWithUs::ApiInvalidEndpoint - the target URI is probably incorrect or email_id is invalid
|
132
|
+
SendWithUs::ApiInvalidKey - the sendwithus API key is invalid
|
133
|
+
SendWithUs::ApiBadRequest - the API request is invalid
|
116
134
|
SendWithUs::ApiConnectionRefused - the target URI is probably incorrect
|
117
135
|
SendWithUs::ApiUnknownError - an unhandled HTTP error occurred
|
118
136
|
```
|
@@ -45,9 +45,10 @@ module SendWithUs
|
|
45
45
|
when Net::HTTPNotFound then
|
46
46
|
raise SendWithUs::ApiInvalidEndpoint, path
|
47
47
|
when Net::HTTPForbidden then
|
48
|
-
raise SendWithUs::ApiInvalidKey,
|
48
|
+
raise SendWithUs::ApiInvalidKey, "Invalid api key: #{@configuration.api_key}"
|
49
49
|
when Net::HTTPBadRequest then
|
50
|
-
raise SendWithUs::ApiBadRequest,
|
50
|
+
raise SendWithUs::ApiBadRequest,
|
51
|
+
"Bad request: \"#{path}\" with payload \"#{payload}\""
|
51
52
|
when Net::HTTPSuccess
|
52
53
|
puts @response.body if @configuration.debug
|
53
54
|
@response
|
data/lib/send_with_us/version.rb
CHANGED
@@ -42,6 +42,18 @@ class TestApiRequest < MiniTest::Unit::TestCase
|
|
42
42
|
assert_raises( SendWithUs::ApiInvalidEndpoint ) { @request.post(:send, @payload) }
|
43
43
|
end
|
44
44
|
|
45
|
+
def test_send_with_forbidden_exception
|
46
|
+
build_objects
|
47
|
+
Net::HTTP.any_instance.stubs(:request).returns(Net::HTTPForbidden.new(1.0, 403, "OK"))
|
48
|
+
assert_raises( SendWithUs::ApiInvalidKey ) { @request.post(:send, @payload) }
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_send_with_bad_request
|
52
|
+
build_objects
|
53
|
+
Net::HTTP.any_instance.stubs(:request).returns(Net::HTTPBadRequest.new(1.0, 400, "OK"))
|
54
|
+
assert_raises( SendWithUs::ApiBadRequest ) { @request.post(:send, @payload) }
|
55
|
+
end
|
56
|
+
|
45
57
|
def test_send_with_unknown_exception
|
46
58
|
build_objects
|
47
59
|
Net::HTTP.any_instance.stubs(:request).returns(Net::HTTPNotAcceptable.new(1.0, 406, "OK"))
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: send_with_us
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Matt Harris
|
@@ -10,48 +11,54 @@ authors:
|
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2014-05-
|
14
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rake
|
17
18
|
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
18
20
|
requirements:
|
19
|
-
- - '>='
|
21
|
+
- - ! '>='
|
20
22
|
- !ruby/object:Gem::Version
|
21
23
|
version: '0'
|
22
24
|
type: :development
|
23
25
|
prerelease: false
|
24
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
25
28
|
requirements:
|
26
|
-
- - '>='
|
29
|
+
- - ! '>='
|
27
30
|
- !ruby/object:Gem::Version
|
28
31
|
version: '0'
|
29
32
|
- !ruby/object:Gem::Dependency
|
30
33
|
name: shoulda
|
31
34
|
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
32
36
|
requirements:
|
33
|
-
- - '>='
|
37
|
+
- - ! '>='
|
34
38
|
- !ruby/object:Gem::Version
|
35
39
|
version: '0'
|
36
40
|
type: :development
|
37
41
|
prerelease: false
|
38
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
39
44
|
requirements:
|
40
|
-
- - '>='
|
45
|
+
- - ! '>='
|
41
46
|
- !ruby/object:Gem::Version
|
42
47
|
version: '0'
|
43
48
|
- !ruby/object:Gem::Dependency
|
44
49
|
name: mocha
|
45
50
|
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
46
52
|
requirements:
|
47
|
-
- - '>='
|
53
|
+
- - ! '>='
|
48
54
|
- !ruby/object:Gem::Version
|
49
55
|
version: '0'
|
50
56
|
type: :development
|
51
57
|
prerelease: false
|
52
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
53
60
|
requirements:
|
54
|
-
- - '>='
|
61
|
+
- - ! '>='
|
55
62
|
- !ruby/object:Gem::Version
|
56
63
|
version: '0'
|
57
64
|
description: SendWithUs.com Ruby Client
|
@@ -83,26 +90,27 @@ files:
|
|
83
90
|
- test/test_helper.rb
|
84
91
|
homepage: https://github.com/sendwithus/sendwithus_ruby
|
85
92
|
licenses: []
|
86
|
-
metadata: {}
|
87
93
|
post_install_message:
|
88
94
|
rdoc_options: []
|
89
95
|
require_paths:
|
90
96
|
- lib
|
91
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
92
99
|
requirements:
|
93
|
-
- - '>='
|
100
|
+
- - ! '>='
|
94
101
|
- !ruby/object:Gem::Version
|
95
102
|
version: '0'
|
96
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
97
105
|
requirements:
|
98
|
-
- - '>='
|
106
|
+
- - ! '>='
|
99
107
|
- !ruby/object:Gem::Version
|
100
108
|
version: '0'
|
101
109
|
requirements: []
|
102
110
|
rubyforge_project:
|
103
|
-
rubygems_version:
|
111
|
+
rubygems_version: 1.8.23
|
104
112
|
signing_key:
|
105
|
-
specification_version:
|
113
|
+
specification_version: 3
|
106
114
|
summary: SendWithUs.com Ruby Client
|
107
115
|
test_files:
|
108
116
|
- test/lib/send_with_us/api_request_test.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 1e1ccb915c665ef78694fb507017fde34ae43b83
|
4
|
-
data.tar.gz: 4f6b82c1110f7284652f71dcfa0eeb5957bd67b9
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 0187466927694f4dc3ee0aaabfe0f67fd7bf11fae095a857ea77af5cb6f9ca114240ab435477e4d5c1816093bfc51bd8532cc8d908470e39d90c596e1bfc5670
|
7
|
-
data.tar.gz: b3b1ce4aee881938c37ec44aaf1b5211509c22f9a5aa44cc11631e9f0a966c952750b871bff2c249043521a09be4e62c38f8f7e78eda6fa511458c3308c69cc0
|