active-campaign-simple 0.3.1 → 0.3.3a

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: 4f14ce1acb34a9a870103f2046ea7c49f1f443f3a32d3b1b5277227fabd700ee
4
- data.tar.gz: 75887c51dd6588bc2ecfc3c474b81830960b6e520a0912958459830f71890525
3
+ metadata.gz: b1529b5e051327dced3e02225047ecf1c6c296157ccba72769fe97d095cc6e71
4
+ data.tar.gz: 34a7a8975cc59d96d29a3b05c8597e48f5caf582befe90ca482f9ce0ed1001fa
5
5
  SHA512:
6
- metadata.gz: 6a1d9339f80b99a526f2298946db806c6d4733922d44783255f1e1326ac9f54c292b7e5354a2f12b3a2251806be8995092f1d9f27c90868fa8df9d64ec125597
7
- data.tar.gz: 73740f17ae33f57b391f2f8c554217bf09bd7136029e8b6fa6584acaadd5926ac8c32b466dedc810b9d7fd8a79f281a743b7d00a56c3fc92de77c438d2f05bdf
6
+ metadata.gz: a92a600af9984c0112c689056b0ef4730df5a5b03b974a0d83678ece293dd87d7c087ae9091e78e4f3f4bd924e0e35380ba76dd3c649a3f3e8fadf8ea13c1813
7
+ data.tar.gz: 6efab749c68d3e42de5f94bc8837e3058206f480527d5183717f9f64cc942a2fe7bfdce0598658635de66ced4260b98a93803d09c74450580f18e4804acbf92d
@@ -1,3 +1,5 @@
1
+ require 'active-campaign-simple/exception_handler'
2
+
1
3
  module ActiveCampaign
2
4
  class Event
3
5
 
@@ -16,7 +18,7 @@ module ActiveCampaign
16
18
 
17
19
  resp = RestClient.post("https://trackcmp.net/event", form)
18
20
  rescue RestClient::ExceptionWithResponse => err
19
- raise APIError, err
21
+ ActiveCampaign::ExceptionHandler.new(err)
20
22
  else
21
23
  return resp.body if resp.body # Some calls respond w nothing
22
24
  end
@@ -4,15 +4,16 @@ module ActiveCampaign
4
4
  class ExceptionHandler
5
5
 
6
6
  ERRORS = {
7
- '404 Not Found' => ActiveCampaign::NotFoundError
7
+ '404 Not Found' => ActiveCampaign::NotFoundError,
8
+ '422 Unprocessable Entity' => ActiveCampaign::UnprocessableEntityError
8
9
  }
9
10
 
10
11
  def initialize(error)
11
12
  error_class = ERRORS[error.message]
12
13
  if error_class
13
- raise error_class, error
14
+ raise error_class.new(error)
14
15
  else
15
- raise ActiveCampaign::StandardError(error)
16
+ raise ActiveCampaign::APIError.new(error)
16
17
  end
17
18
  end
18
19
 
@@ -1,11 +1,14 @@
1
- class ActiveCampaignAPIError < StandardError
1
+ class ActiveCampaignAPIError < ::StandardError
2
2
  def initialize(error)
3
- ActiveCampaign.api_logger.error "ERROR: #{error}"
3
+ stack = "ERROR: #{error}\n"
4
+ stack += error.backtrace.join("\n") if error.backtrace
5
+ ActiveCampaign.api_logger.error stack
4
6
  super(error)
5
7
  end
6
8
  end
7
9
 
8
10
  module ActiveCampaign
9
11
  class NotFoundError < ActiveCampaignAPIError; end
10
- class StandardError < ActiveCampaignAPIError; end
12
+ class UnprocessableEntityError < ActiveCampaignAPIError; end
13
+ class APIError < ActiveCampaignAPIError; end
11
14
  end
@@ -1,4 +1,4 @@
1
1
  module ActiveCampaign
2
2
  # The version of the gem
3
- VERSION = '0.3.1'.freeze unless defined?(::ActiveCampaign::VERSION)
3
+ VERSION = '0.3.3a'.freeze unless defined?(::ActiveCampaign::VERSION)
4
4
  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.3.1
4
+ version: 0.3.3a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Leavitt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -63,7 +63,7 @@ homepage: https://github.com/nateleavitt/active-campaign-simple
63
63
  licenses:
64
64
  - MIT
65
65
  metadata: {}
66
- post_install_message:
66
+ post_install_message:
67
67
  rdoc_options: []
68
68
  require_paths:
69
69
  - lib
@@ -74,12 +74,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ">="
77
+ - - ">"
78
78
  - !ruby/object:Gem::Version
79
- version: 3.0.0
79
+ version: 1.3.1
80
80
  requirements: []
81
- rubygems_version: 3.2.22
82
- signing_key:
81
+ rubygems_version: 3.3.26
82
+ signing_key:
83
83
  specification_version: 4
84
84
  summary: Simple Ruby REST wrapper for the ActiveCampaign API
85
85
  test_files: []