simple_spark 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/simple_spark/exceptions.rb +1 -1
- data/lib/simple_spark/version.rb +1 -1
- data/spec/simple_spark/exceptions_spec.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87cc7e24b5f20c589dc7622c84ca759a66b130ce
|
4
|
+
data.tar.gz: 5d5a3e6eb553d94d27db7ddb95dc5d79ff4f1bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9af00dcf83ff0cc059499d278b92e822c3e47d78c4c20469db97ad362b4d89c4e790c262db8e3a4a162f0452089241615b6ca3d3fec8d445a19a97a28815a97
|
7
|
+
data.tar.gz: a2cc037c27a0db41072f920036c65e46d55e25df97c75aeb9a53ce5b3b21282d992dda80d057beb294cbac5d488db939683540ef4da4a6ec061dc9beeb6a2257
|
data/README.md
CHANGED
@@ -715,6 +715,10 @@ simple_spark.templates.delete(yourtemplateid)
|
|
715
715
|
|
716
716
|
## Changelog
|
717
717
|
|
718
|
+
### 1.0.2
|
719
|
+
|
720
|
+
Add sparkpost error code into exception message to allow more specific error handling
|
721
|
+
|
718
722
|
### 1.0.1
|
719
723
|
|
720
724
|
Suppress Excon warning for using :debug parameter
|
@@ -16,7 +16,7 @@ module SimpleSpark
|
|
16
16
|
|
17
17
|
def self.fail_with_exception_for_status(status, errors)
|
18
18
|
exception = status_codes[status.to_s] || status_codes['default']
|
19
|
-
fail exception.new(errors), errors.map { |e| "#{e['message']} #{status} " + (e['description'] ? ": #{e['description']}" : '') }.join(', ')
|
19
|
+
fail exception.new(errors), errors.map { |e| "#{e['message']} #{status} (Error Code: #{e['code']})" + (e['description'] ? ": #{e['description']}" : '') }.join(', ')
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.status_codes
|
data/lib/simple_spark/version.rb
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SimpleSpark::Exceptions::Error do
|
4
|
+
describe :fail_with_exception_for_status do
|
5
|
+
it 'will respond with the SparkPost error code' do
|
6
|
+
errors = [{'message' => "Test Error Message", 'code' => 3005}]
|
7
|
+
expect{SimpleSpark::Exceptions::Error.fail_with_exception_for_status(400, errors)}.to raise_error(SimpleSpark::Exceptions::BadRequest, "Test Error Message 400 (Error Code: 3005)")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_spark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jak Charlton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/simple_spark/version.rb
|
81
81
|
- simple_spark.gemspec
|
82
82
|
- spec/simple_spark/client_spec.rb
|
83
|
+
- spec/simple_spark/exceptions_spec.rb
|
83
84
|
- spec/spec_helper.rb
|
84
85
|
homepage: ''
|
85
86
|
licenses:
|
@@ -107,4 +108,5 @@ specification_version: 4
|
|
107
108
|
summary: A library for accessing the SparkPost REST API http://www.sparkpost.com
|
108
109
|
test_files:
|
109
110
|
- spec/simple_spark/client_spec.rb
|
111
|
+
- spec/simple_spark/exceptions_spec.rb
|
110
112
|
- spec/spec_helper.rb
|