Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no transform_keys for bulk import contacts #87

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions lib/active_campaign/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ def message
if response.nil?
super
else
<<~MESSAGE
STATUS: #{response.status}
URL: #{env.url}
REQUEST HEADERS: #{env.request_headers}
RESPONSE_HEADERS: #{env.response_headers}
REQUEST_BODY: #{env.request_body}\n\n"
RESPONSE_BODY: #{response.body}\n\n"
MESSAGE
begin
<<~MESSAGE
STATUS: #{response.try(:status)}
URL: #{env.url}
REQUEST HEADERS: #{env.request_headers}
RESPONSE_HEADERS: #{env.response_headers}
REQUEST_BODY: #{env.request_body}\n\n"
RESPONSE_BODY: #{response.body}\n\n"
MESSAGE
rescue StandardError => e
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActiveCampaign::Error#message has the variable name 'e'

super
end
end
end

Expand Down
2 changes: 2 additions & 0 deletions lib/active_campaign/faraday/middleware/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def normalize_body(env)
logger.debug("Using body as is because group #{body}")
elsif body.key?(:list)
logger.debug("Using body as is because list #{body}")
elsif body.key?(:contacts) && body.key?(:callback)
logger.debug("Using body as is because contacts+callback #{body}")
else
body = transform_keys(body, :camelcase, :lower)
end
Expand Down