frederick_api 0.6 → 0.7

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: 9848d60ef419d88f6758574988f60f90337c64645316a0c716c12aaf497f43a9
4
- data.tar.gz: 2e6096aeca9837b93ee25a2468bc7d3e2cf2712f6c735fb7330cf13a489f3b1e
3
+ metadata.gz: f39d405adb2db91e4cb552498c7188779cba58f587c7d2a35824f0cc18ee4587
4
+ data.tar.gz: 53b2858d0355ac8bba535e75d7950c0407cbfe61317b52f38d4623e002f044e4
5
5
  SHA512:
6
- metadata.gz: 06f920d1c60e09288bb9c75ef3b9be31168b93fe24ab681c33b1e2b77fb9127172e86608da5c8f862a43965867e1e33f571a91dfb80bd768cc9b227979b084dc
7
- data.tar.gz: 738cf8ec474b270d81e79a95499325f62f70557baf09bc16220abd4d467564ead6607bf180bb22352bd309d78fdab6ce84435863341ea8c99c89985d430939b7
6
+ metadata.gz: 65a77c37baa3e8d3f170438d206a3095d21ca3b4548a6f009dd3cb450dcba43453c8f99f8704df0898a631b67dd3595002a7e7723d0c21124b1349869beba5ee
7
+ data.tar.gz: eabcd9f083df57b8b7350a405daa27cdaa8eebe82a00ea65694dbbf03bcbc0e94e0ec7bc2f5fd345106cd4ee30ddd327c31a4c24ca21317ac272b10dc2e4fa98
@@ -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
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FrederickAPI
4
+ module V2
5
+ # V2 Campaign Resource
6
+ class Campaign < Resource
7
+ belongs_to :location
8
+
9
+ self.read_only_attributes += [:location_id]
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FrederickAPI
4
+ module V2
5
+ # V2 Email Document Resource
6
+ class EmailDocument < Resource
7
+ belongs_to :location
8
+
9
+ self.read_only_attributes += [:location_id]
10
+ end
11
+ end
12
+ end
@@ -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 => ex
87
- klass.parser.parse(klass, ex.env.response)
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FrederickAPI
4
4
  # Current gem version
5
- VERSION = '0.6'
5
+ VERSION = '0.7'
6
6
  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.6'
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-09-25 00:00:00.000000000 Z
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