active_campaign_wrapper 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 6670b3e913d7638fe9ec860acc02e66c85a0de42ff47fe94cb2b0d2e4c6aec1a
4
- data.tar.gz: 8ff5a1d9df989e255171381dd0fbece95e0b428d7785dd298fe593af8e0d1eea
3
+ metadata.gz: 1590dc0b398aa32233b19bcf394874316aa2d5c1a0b38b569fdfe57d333ab97e
4
+ data.tar.gz: 2946ac23c953474593a0dbde6e5aafa27e2843acb60e660139044eb7a9b3d943
5
5
  SHA512:
6
- metadata.gz: e0bf62f43cadfb38748772ea19a9646d00fe31f3a88ebda994752385349fe1080f1b427dee53e3e850ec3da9d80bd638caa8aaae9fd6bf184f73583b409f65de
7
- data.tar.gz: 2a62220f96141a83e332d041d002024ffd97d8a092edbe6ca565d9fb54ad163b9fcbb94ad7a0e854ec169e0a258f97c0f54db47176e513361392f2c4cb8a3faa
6
+ metadata.gz: 920d304e2e617f68af61d8238e67b3f23b5d6e9a44f99a930e6316b5a9781ae5184f846985db7aec4e7677b466a26b71b3a7d0d0bc675afd9ea23373873c35ae
7
+ data.tar.gz: 72e5fa0c1a16b06de14dc775f975cdfbc331f019841bbd049b9d991cc82640ff222de2d1e2b8b5395c7a55110166ee51f19eea9032ad1175a3248cda8d2f067e
@@ -17,5 +17,11 @@ module ActiveCampaignWrapper
17
17
 
18
18
  class Error < StandardError; end
19
19
 
20
- class AuthorizationError < StandardError; end
20
+ class Forbidden < StandardError; end
21
+
22
+ class UnprocessableEntity < StandardError; end
23
+
24
+ class NotFound < StandardError; end
25
+
26
+ class TooManyRequests < StandardError; end
21
27
  end
@@ -7,8 +7,11 @@ module ActiveCampaignWrapper
7
7
  module_function
8
8
 
9
9
  def normalize_response(response)
10
- raise ActiveCampaignWrapper::AuthorizationError, response.message if response.unauthorized?
11
- raise ActiveCampaignWrapper::Error, response.message unless response.success?
10
+ raise ActiveCampaignWrapper::Forbidden, response['message'] if response.forbidden?
11
+ raise ActiveCampaignWrapper::NotFound, response['message'] if response.not_found?
12
+ raise ActiveCampaignWrapper::UnprocessableEntity, response['errors']&.join(', ') || response['error'] if response.unprocessable_entity?
13
+ raise ActiveCampaignWrapper::TooManyRequests, response['message'] if response.too_many_requests?
14
+ raise ActiveCampaignWrapper::Error, response['message'] unless response.success?
12
15
 
13
16
  if response&.body.present?
14
17
  transform_keys(response, [:underscore])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveCampaignWrapper
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_campaign_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anmol Yousaf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-26 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport