action_kit_rest 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3500361e0719b8b564154f8bea6dcce45526730195e73c18afacdb9ed3502614
4
- data.tar.gz: 26ed612e62d9b83e0d4a316b3916fe97cdea57be0571634e0b6a127e2d1bd628
3
+ metadata.gz: d24d7ecd5f9cb702d4dbdbdcc26bc37ab1dfc0090f2fb4549dabf39dbaf91c87
4
+ data.tar.gz: 12b707b5a2c38d048060aeee7a6ec75381d55e6a7193bd483e9eacc9b855d1c3
5
5
  SHA512:
6
- metadata.gz: fed8a4d19a5326a5070b8c5c97a316807396fdde90db77012427d8f4494fb1957dba9474d1e86ec4c09878f08129815fd3804b12a3f1c86335a850b7e8f9d2e4
7
- data.tar.gz: 42e90e7c04f84e9747bea56523399fd429c828475de3906fbc3e19745d4877d4877fd38efc0f9cc0c6a4e691b03cfea41ceb48b20033d108ce74e97c96230624
6
+ metadata.gz: bdaf0361faaaa5a8c64ac0c86e12ddec395480ebe05acb7d6a6363e6706d7ff6237f39ea0d76a19cde34abecd7466f6b806fa11b764de39a18449085a2e106fb
7
+ data.tar.gz: 81e7b01b4712966e4960423b67c4cdca85e6e03913b29716f47813d269936ab994d3d337916bd530d458915ef055a186e38ecd71cf24bdbdcb203cbd4683dfa4
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: action_kit_rest 0.3.4 ruby lib
5
+ # stub: action_kit_rest 0.3.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "action_kit_rest".freeze
9
- s.version = "0.3.4"
9
+ s.version = "0.3.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Nathan Woodhull".freeze, "Diego Marcet".freeze, "Jacinda Moore".freeze]
14
- s.date = "2018-05-17"
14
+ s.date = "2018-05-21"
15
15
  s.description = "Gem for interacting with the ActionKit API".freeze
16
16
  s.email = "systems@controlshiftlabs.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -6,7 +6,12 @@ module ActionKitRest
6
6
  status_code = response[:status].to_i
7
7
  if (400...600).include? status_code
8
8
  if status_code == 400
9
- raise ActionKitRest::Response::ValidationError.new(url: response[:url].to_s, body: response[:body])
9
+ response_body = response[:body]
10
+ if JSON.parse(response_body)['errors'] == {'mailing_id' => ['Unable to associate this mailing ID with account.']}
11
+ raise ActionKitRest::Response::InvalidAkidError.new(url: response[:url].to_s, body: response_body)
12
+ else
13
+ raise ActionKitRest::Response::ValidationError.new(url: response[:url].to_s, body: response_body)
14
+ end
10
15
  elsif status_code == 404
11
16
  raise ActionKitRest::Response::NotFound.new(response[:url].to_s)
12
17
  elsif status_code == 401
@@ -13,7 +13,9 @@ module ActionKitRest
13
13
  def to_s
14
14
  "#{super()} \n url: #{url} \n body: #{body} \n errors: #{errors}"
15
15
  end
16
-
16
+ end
17
+
18
+ class InvalidAkidError < ValidationError
17
19
  end
18
20
  end
19
- end
21
+ end
@@ -2,7 +2,7 @@ module ActionKitRest
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 4
5
+ PATCH = 5
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -83,6 +83,15 @@ describe ActionKitRest::Page do
83
83
  end
84
84
  end
85
85
 
86
+ describe 'mailing ID error' do
87
+ let(:status) { 400 }
88
+ let(:body) { '{"errors": {"mailing_id": ["Unable to associate this mailing ID with account."]}}' }
89
+
90
+ it "should raise an Invalid AKID response error" do
91
+ lambda{ subject.page.get(1) }.should raise_exception(ActionKitRest::Response::InvalidAkidError)
92
+ end
93
+ end
94
+
86
95
  describe "an error" do
87
96
  let(:status) { 500 }
88
97
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_kit_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-05-17 00:00:00.000000000 Z
13
+ date: 2018-05-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: vertebrae