simple_spark 1.0.1 → 1.0.2

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: 94e0ab142551cdc61a74cba587efde10c76ab7ad
4
- data.tar.gz: fb6d87c9ddd7a35d1b70c9437d544b13b19aed7f
3
+ metadata.gz: 87cc7e24b5f20c589dc7622c84ca759a66b130ce
4
+ data.tar.gz: 5d5a3e6eb553d94d27db7ddb95dc5d79ff4f1bac
5
5
  SHA512:
6
- metadata.gz: 7417207ecb402bf9a479f010fbb58619f086d022951ac30e0b2eb6b8aee7559d7fa40f7e61eebde6ebf7d0c4984fd202b399214aea093eabef98ef3acf6367c6
7
- data.tar.gz: ad4fab404d329aeb17979174aba4fd7cc933ad8f611d80609763aa788df354af9c7813c5e37fda7511209d205bbe3a7597ef6cb507e3dc1b94286201f50b9d7f
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
@@ -1,3 +1,3 @@
1
1
  module SimpleSpark
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -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.1
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-23 00:00:00.000000000 Z
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