-
Notifications
You must be signed in to change notification settings - Fork 1
Update to version 0.12 for supporting ruby 3.3.10 #31
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| ruby-2.4.3 | ||
| ruby-3.3.10 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM ruby:2.7.0 | ||
| FROM ruby:3.3.10 | ||
|
|
||
| WORKDIR /frederick_api_gem | ||
| ADD Gemfile /frederick_api_gem | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'cgi' | ||
|
|
||
| module FrederickAPI | ||
| module V2 | ||
| module Helpers | ||
|
|
@@ -21,12 +23,12 @@ class Requestor < JsonApiClient::Query::Requestor | |
| # Paths that may have an unbounded query param length so we should always use a POST | ||
| # instead of a GET to get around AWS Cloudfront limitations | ||
| GET_VIA_POST_PATHS = [ | ||
| %r{^.*locations\/[^\/]+\/contacts$}, | ||
| %r{^.*locations\/[^\/]+\/interactions$} | ||
| %r{^.*locations/[^/]+/contacts$}, | ||
| %r{^.*locations/[^/]+/interactions$} | ||
| ].map(&:freeze).freeze | ||
|
|
||
| def initialize(klass, path = nil) | ||
| @klass = klass | ||
| super(klass) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you help me understand this change?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought, I don't see a need to call the parent class for assigning a variable. I think it would be safer to revert. |
||
| @path = path | ||
| end | ||
|
|
||
|
|
@@ -68,8 +70,9 @@ def request(type, path, params: nil, body: nil, additional_headers: {}) | |
|
|
||
| begin | ||
| make_request.call | ||
| rescue JsonApiClient::Errors::ConnectionError, JsonApiClient::Errors::ServerError => ex | ||
| raise ex if ex.is_a?(JsonApiClient::Errors::NotFound) || ex.is_a?(JsonApiClient::Errors::Conflict) | ||
| rescue JsonApiClient::Errors::ConnectionError, JsonApiClient::Errors::ServerError => e | ||
| raise e if e.is_a?(JsonApiClient::Errors::NotFound) || e.is_a?(JsonApiClient::Errors::Conflict) | ||
|
|
||
| make_request.call | ||
| end | ||
| end | ||
|
|
@@ -79,12 +82,14 @@ def handle_background(response) | |
| return response unless | ||
| (job = response&.first).is_a?(::FrederickAPI::V2::BackgroundJob) && job.status != 'complete' | ||
| raise FrederickAPI::V2::Errors::BackgroundJobFailure, job if job.has_errors? | ||
|
|
||
| sleep job.retry_after | ||
| linked(job.links.attributes['self']) | ||
| end | ||
|
|
||
| def handle_errors(result) | ||
| return result unless result.has_errors? | ||
|
|
||
| error_klass = FrederickAPI::V2::Errors::ERROR_CODES[result.errors.first[:status]] || | ||
| FrederickAPI::V2::Errors::Error | ||
| raise error_klass, result | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.