active-campaign-simple 0.2.1 → 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be042a9f260af0ab936c9f9e176b775d3883ecf6961dcdddd03c00a1b9930ac3
|
4
|
+
data.tar.gz: 67b23cdbe1ce295350c4e8287b1bfd89d87bdb91a58812f46bc4abedece0fc7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96882a3456a7d0e1a2d7b9cd30b80a6539121b99eead4cca788d9effdab21b05b27c18d8789ef59e87df4e71f60a9bc20afffca790edd093335d830e301be003
|
7
|
+
data.tar.gz: 91f85433ba0183095a36ad378bc6b76d26b0ff8575ce8c453ecbc7f0de07eb6f3b1a9e45c6b0858ff4f8f1fffdaac6389ee00501ab7a8977f5a4703c654ec87a
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'active-campaign-simple/exceptions'
|
2
|
+
|
3
|
+
module ActiveCampaign
|
4
|
+
class ExceptionHandler
|
5
|
+
|
6
|
+
ERRORS = {
|
7
|
+
'404 Not Found' => ActiveCampaign::NotFoundError
|
8
|
+
}
|
9
|
+
|
10
|
+
def initialize(error)
|
11
|
+
error_class = ERRORS[error.message]
|
12
|
+
if error_class
|
13
|
+
raise error_class, error
|
14
|
+
else
|
15
|
+
raise ActiveCampaignAPIError(error)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rest-client'
|
2
|
-
require 'active-campaign-simple/
|
2
|
+
require 'active-campaign-simple/exception_handler'
|
3
3
|
require 'active-campaign-simple/event'
|
4
4
|
|
5
5
|
module ActiveCampaign
|
@@ -53,7 +53,7 @@ module ActiveCampaign
|
|
53
53
|
opts.merge!( { payload: payload.to_json }) unless payload.empty?
|
54
54
|
resp = RestClient::Request.execute(opts)
|
55
55
|
rescue RestClient::ExceptionWithResponse => err
|
56
|
-
|
56
|
+
ActiveCampaign::ExceptionHandler.new(err)
|
57
57
|
else
|
58
58
|
return JSON.parse(resp.body) if resp.body # Some calls respond w nothing
|
59
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-campaign-simple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Leavitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -51,10 +51,11 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- active-campaign-simple.gemspec
|
53
53
|
- lib/active-campaign-simple.rb
|
54
|
-
- lib/active-campaign-simple/api_error.rb
|
55
54
|
- lib/active-campaign-simple/client.rb
|
56
55
|
- lib/active-campaign-simple/config.rb
|
57
56
|
- lib/active-campaign-simple/event.rb
|
57
|
+
- lib/active-campaign-simple/exception_handler.rb
|
58
|
+
- lib/active-campaign-simple/exceptions.rb
|
58
59
|
- lib/active-campaign-simple/logger.rb
|
59
60
|
- lib/active-campaign-simple/request.rb
|
60
61
|
- lib/active-campaign-simple/version.rb
|