send_with_us 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/send_with_us/api.rb
CHANGED
@@ -130,9 +130,7 @@ module SendWithUs
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
|
134
|
-
puts payload
|
135
|
-
SendWithUs::ApiRequest.new(@configuration).post(:send, payload)
|
133
|
+
SendWithUs::ApiRequest.new(@configuration).post(:send, payload.to_json)
|
136
134
|
end
|
137
135
|
|
138
136
|
def drips_unsubscribe(email_address)
|
@@ -19,7 +19,7 @@ module SendWithUs
|
|
19
19
|
def get(endpoint)
|
20
20
|
request(Net::HTTP::Get, request_path(endpoint))
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def delete(endpoint)
|
24
24
|
request(Net::HTTP::Delete, request_path(endpoint))
|
25
25
|
end
|
@@ -51,8 +51,7 @@ module SendWithUs
|
|
51
51
|
when Net::HTTPForbidden then
|
52
52
|
raise SendWithUs::ApiInvalidKey, "Invalid api key: #{@configuration.api_key}"
|
53
53
|
when Net::HTTPBadRequest then
|
54
|
-
raise SendWithUs::ApiBadRequest,
|
55
|
-
"Bad request: \"#{path}\" with payload \"#{payload}\""
|
54
|
+
raise SendWithUs::ApiBadRequest.new("There was an error processing your request: #{@response.body}, with payload: #{payload}")
|
56
55
|
when Net::HTTPSuccess
|
57
56
|
puts @response.body if @configuration.debug
|
58
57
|
@response
|
data/lib/send_with_us/version.rb
CHANGED
@@ -37,7 +37,9 @@ class TestApiRequest < MiniTest::Unit::TestCase
|
|
37
37
|
|
38
38
|
def test_send_with_bad_request
|
39
39
|
build_objects
|
40
|
-
Net::
|
40
|
+
bad_request = Net::HTTPBadRequest.new(1.0, 400, 'OK')
|
41
|
+
bad_request.stubs(:body).returns("This is a test body")
|
42
|
+
Net::HTTP.any_instance.stubs(:request).returns(bad_request)
|
41
43
|
assert_raises( SendWithUs::ApiBadRequest ) { @request.post(:send, @payload) }
|
42
44
|
end
|
43
45
|
|
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.9.
|
4
|
+
version: 1.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|