frederick_api 0.6 → 0.7
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: f39d405adb2db91e4cb552498c7188779cba58f587c7d2a35824f0cc18ee4587
|
4
|
+
data.tar.gz: 53b2858d0355ac8bba535e75d7950c0407cbfe61317b52f38d4623e002f044e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65a77c37baa3e8d3f170438d206a3095d21ca3b4548a6f009dd3cb450dcba43453c8f99f8704df0898a631b67dd3595002a7e7723d0c21124b1349869beba5ee
|
7
|
+
data.tar.gz: eabcd9f083df57b8b7350a405daa27cdaa8eebe82a00ea65694dbbf03bcbc0e94e0ec7bc2f5fd345106cd4ee30ddd327c31a4c24ca21317ac272b10dc2e4fa98
|
data/lib/frederick_api.rb
CHANGED
@@ -32,6 +32,8 @@ require 'frederick_api/v2/contact_list'
|
|
32
32
|
require 'frederick_api/v2/contact_type'
|
33
33
|
require 'frederick_api/v2/interaction'
|
34
34
|
require 'frederick_api/v2/role'
|
35
|
+
require 'frederick_api/v2/campaign'
|
36
|
+
require 'frederick_api/v2/email_document'
|
35
37
|
|
36
38
|
# Namespace for all Frederick API client methods/classes
|
37
39
|
module FrederickAPI
|
@@ -7,6 +7,17 @@ module FrederickAPI
|
|
7
7
|
class Requestor < JsonApiClient::Query::Requestor
|
8
8
|
attr_reader :path
|
9
9
|
|
10
|
+
# For backward compatibility, preserve these JSON API client errors instead of raising
|
11
|
+
# FrederickAPI::Errors::Error
|
12
|
+
JSON_API_CLIENT_PASSTHROUGH_ERRORS = [
|
13
|
+
JsonApiClient::Errors::NotAuthorized,
|
14
|
+
JsonApiClient::Errors::AccessDenied,
|
15
|
+
JsonApiClient::Errors::NotFound,
|
16
|
+
JsonApiClient::Errors::Conflict,
|
17
|
+
JsonApiClient::Errors::ServerError,
|
18
|
+
JsonApiClient::Errors::UnexpectedStatus
|
19
|
+
].freeze
|
20
|
+
|
10
21
|
# Paths that may have an unbounded query param length so we should always use a POST
|
11
22
|
# instead of a GET to get around AWS Cloudfront limitations
|
12
23
|
GET_VIA_POST_PATHS = [
|
@@ -82,14 +93,21 @@ module FrederickAPI
|
|
82
93
|
def make_request(type, path, params:, body:, headers:)
|
83
94
|
faraday_response = connection.run(type, path, params: params, body: body, headers: headers)
|
84
95
|
return klass.parser.parse(klass, faraday_response) unless faraday_response.status == 303
|
96
|
+
|
85
97
|
linked(faraday_response.headers['location'])
|
86
|
-
rescue JsonApiClient::Errors::ClientError =>
|
87
|
-
|
98
|
+
rescue JsonApiClient::Errors::ClientError => e
|
99
|
+
handle_json_api_client_error(e)
|
88
100
|
end
|
89
101
|
|
90
102
|
def get_via_post_path?(path)
|
91
103
|
GET_VIA_POST_PATHS.any? { |r| r.match(path) }
|
92
104
|
end
|
105
|
+
|
106
|
+
def handle_json_api_client_error(error)
|
107
|
+
raise error if JSON_API_CLIENT_PASSTHROUGH_ERRORS.include?(error.class)
|
108
|
+
|
109
|
+
klass.parser.parse(klass, error.env.response)
|
110
|
+
end
|
93
111
|
end
|
94
112
|
end
|
95
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frederick_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederick Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|
@@ -38,11 +38,13 @@ files:
|
|
38
38
|
- lib/frederick_api/v2/automation.rb
|
39
39
|
- lib/frederick_api/v2/background_job.rb
|
40
40
|
- lib/frederick_api/v2/business_category.rb
|
41
|
+
- lib/frederick_api/v2/campaign.rb
|
41
42
|
- lib/frederick_api/v2/communication_content.rb
|
42
43
|
- lib/frederick_api/v2/contact.rb
|
43
44
|
- lib/frederick_api/v2/contact_list.rb
|
44
45
|
- lib/frederick_api/v2/contact_property.rb
|
45
46
|
- lib/frederick_api/v2/contact_type.rb
|
47
|
+
- lib/frederick_api/v2/email_document.rb
|
46
48
|
- lib/frederick_api/v2/errors/errors.rb
|
47
49
|
- lib/frederick_api/v2/helpers/backgroundable_parser.rb
|
48
50
|
- lib/frederick_api/v2/helpers/has_many.rb
|