active-campaign-simple 0.3.3 → 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: db3cf95b6871dea9e9a64762a628f01498f6afec823eba660c3fc117691473ef
4
- data.tar.gz: e65de428d99e04fe758e77aed2bdc606700b09ddad3f015185fa9e3fcc541431
3
+ metadata.gz: fc27404973c86243ac6c81d646ca1dbbac9617aa8f667b42c967bc412df6d702
4
+ data.tar.gz: 32978be84621b63b9adce82db307a844f71dfdcb2dfceb3588cf9cb7e286a318
5
5
  SHA512:
6
- metadata.gz: 1cc2ece8dd2e814dc26202a973e8527117463b96ba026c9ffe16207a51a5667d986a541024f083b1c9fe6dbafa990fcacd6cfe0af2cb045e483f808106b7a8ea
7
- data.tar.gz: 1ccc820ab59101975480cf77cd84377421609dd5260a47973fa62a600a65015b50c1a99d48adced1a8cf52a17368f5d41b751ae2da7d91ef8fd3bc989fe20520
6
+ metadata.gz: f333f0d8d0ec35ab26e61ad0f427edcd6ead13355490386d477494b3b23fe1fcadaebd24cd22b265cb95eb1ab31cf8e9e9463e8ec832c2efc01dd5206c99be08
7
+ data.tar.gz: fd064d310b1619afc8897fa21b8b02dfa51cb09aa041bfd31d257f37645ced416003cb0eb59d559d6ee7ab5e3e92de1c902a55baa70fe6fc0a333b20c358cad4
@@ -11,8 +11,8 @@ module ActiveCampaign
11
11
  key: key,
12
12
  actid: actid,
13
13
  event: event,
14
- # visit: URI.encode_www_form_component{ email: email },
15
- visit: { email: email }
14
+ visit: URI.encode_www_form_component({ email: email })
15
+ # visit: { email: email }
16
16
  }
17
17
  form.merge!({ eventdata: eventdata }) if eventdata
18
18
 
@@ -2,19 +2,18 @@ require 'active-campaign-simple/exceptions'
2
2
 
3
3
  module ActiveCampaign
4
4
  class ExceptionHandler
5
-
6
5
  ERRORS = {
7
- '404 Not Found' => ActiveCampaign::NotFoundError
6
+ '404 Not Found' => ActiveCampaign::NotFoundError,
7
+ '422 Unprocessable Entity' => ActiveCampaign::UnprocessableEntityError
8
8
  }
9
9
 
10
10
  def initialize(error)
11
- error_class = ERRORS[error.message]
11
+ error_class = ERRORS.find { |status, _| error.message.start_with?(status) }&.last
12
12
  if error_class
13
- raise error_class.new(error)
13
+ raise error_class.new(error), "#{error.message}\nResponse body:\n#{error.response&.body}\n"
14
14
  else
15
- raise ActiveCampaign::APIError.new(error)
15
+ raise ActiveCampaign::APIError.new(error), "#{error.message}\nResponse body:\n#{error.response&.body}\n"
16
16
  end
17
17
  end
18
-
19
18
  end
20
- end
19
+ end
@@ -1,11 +1,14 @@
1
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
12
+ class UnprocessableEntityError < ActiveCampaignAPIError; end
10
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.3'.freeze unless defined?(::ActiveCampaign::VERSION)
3
+ VERSION = '0.3.5'.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.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Leavitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: 3.0.0
80
80
  requirements: []
81
- rubygems_version: 3.3.3
81
+ rubygems_version: 3.3.26
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Simple Ruby REST wrapper for the ActiveCampaign API