forest_admin_datasource_zendesk 1.30.7 → 1.31.0

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: c160e42f194581948416918ff054109669fde4b6f06e29079e357ef9896e44a7
4
- data.tar.gz: 715023047017d5ef9ebf6880345493dbe9b7b36c2e13ba3398b093fa225d20d1
3
+ metadata.gz: 31bce2c7798f1d43e73d791c357ee4590f25e01b69abfdd4f4797af2831117de
4
+ data.tar.gz: e165ebddfcf738c9d7a192181a113d13f1337c9c1a98b80cdbffaffcd8eb329f
5
5
  SHA512:
6
- metadata.gz: 3be9ef7e662a6f73831e961fe5e6751bc13f8b7ada7df0ddbb94ea0a24a4b2253318b2d1b7671f7d0bb25b4d89aed39fa59b708528200852b8c5f00f039d9138
7
- data.tar.gz: ca9236d8d7408dc90a6ff346089bb9bfd25792b45959dcd83730e798c2232e4dcf5241921dc4533ea1dd3272d9e3513bc16a5c6179962ba46a2a6e1a3585e954
6
+ metadata.gz: d407857c1692efe2738f1333ea9c986ba92574ad7bdd055caa69abc1b9d2898865ff04bcaa62a47b49b9958d81d3348a6b2865ba2515200331315123dfa17ace
7
+ data.tar.gz: 73e5f971f39f8c405386f1dedeb38eed6509dc6af34cf6997faf1544bd8f6e207dbe96134c6ccfa550cbca926613546b62a440f5d83bc401e2beaa1c87d639e1
@@ -11,6 +11,23 @@ module ForestAdminDatasourceZendesk
11
11
  DATE_OPS = [Operators::EQUAL, Operators::BEFORE, Operators::AFTER,
12
12
  Operators::PRESENT, Operators::BLANK].freeze
13
13
 
14
+ attr_reader :custom_fields
15
+
16
+ # Template method: subclasses implement `define_schema` and
17
+ # `define_relations` as hooks; ordering between them, custom-field
18
+ # registration, and the search/count flags is owned here so collisions
19
+ # are always evaluated against the final native schema. A subclass can
20
+ # opt out of search/count by passing `searchable: false` / `countable:
21
+ # false` through `super`.
22
+ def initialize(datasource, name, custom_fields: [], searchable: true, countable: true, native_driver: nil)
23
+ super(datasource, name, native_driver)
24
+ define_schema
25
+ define_relations
26
+ @custom_fields = add_custom_fields(custom_fields)
27
+ enable_search if searchable
28
+ enable_count if countable
29
+ end
30
+
14
31
  def aggregate(caller, filter, aggregation, _limit = nil)
15
32
  unless aggregation.operation == 'Count' && aggregation.field.nil? && aggregation.groups.empty?
16
33
  raise ForestAdminDatasourceToolkit::Exceptions::ForestException,
@@ -97,7 +114,7 @@ module ForestAdminDatasourceZendesk
97
114
 
98
115
  # Adds custom fields, skipping any whose column name collides with a
99
116
  # field already declared on the collection (native column or relation).
100
- # Returns the list of fields actually added so callers can keep their
117
+ # Returns the subset actually added so callers can keep their
101
118
  # serializer in sync with the schema.
102
119
  def add_custom_fields(custom_fields)
103
120
  custom_fields.reject do |cf|
@@ -117,6 +134,9 @@ module ForestAdminDatasourceZendesk
117
134
 
118
135
  private
119
136
 
137
+ def define_schema = raise(NotImplementedError, "#{self.class} did not implement define_schema")
138
+ def define_relations = raise(NotImplementedError, "#{self.class} did not implement define_relations")
139
+
120
140
  def sort_field_and_direction(entry)
121
141
  return [entry.field, entry.ascending] if entry.respond_to?(:field)
122
142
 
@@ -3,8 +3,6 @@ module ForestAdminDatasourceZendesk
3
3
  class Organization < BaseCollection
4
4
  include Searchable
5
5
 
6
- attr_reader :custom_fields
7
-
8
6
  OneToManySchema = ForestAdminDatasourceToolkit::Schema::Relations::OneToManySchema
9
7
 
10
8
  ZENDESK_SORTABLE = {
@@ -14,12 +12,7 @@ module ForestAdminDatasourceZendesk
14
12
  }.freeze
15
13
 
16
14
  def initialize(datasource, custom_fields: [])
17
- super(datasource, 'ZendeskOrganization')
18
- define_schema
19
- define_relations
20
- @custom_fields = add_custom_fields(custom_fields)
21
- enable_search
22
- enable_count
15
+ super(datasource, 'ZendeskOrganization', custom_fields: custom_fields)
23
16
  end
24
17
 
25
18
  def create(_caller, data)
@@ -6,8 +6,6 @@ module ForestAdminDatasourceZendesk
6
6
  include CommentsEmbedder
7
7
  include Serializer
8
8
 
9
- attr_reader :custom_fields
10
-
11
9
  ManyToOneSchema = ForestAdminDatasourceToolkit::Schema::Relations::ManyToOneSchema
12
10
 
13
11
  ZENDESK_SORTABLE = {
@@ -29,12 +27,7 @@ module ForestAdminDatasourceZendesk
29
27
  }.freeze
30
28
 
31
29
  def initialize(datasource, custom_fields: [])
32
- super(datasource, 'ZendeskTicket')
33
- define_schema
34
- define_relations
35
- @custom_fields = add_custom_fields(custom_fields)
36
- enable_search
37
- enable_count
30
+ super(datasource, 'ZendeskTicket', custom_fields: custom_fields)
38
31
  end
39
32
 
40
33
  def list(caller, filter, projection)
@@ -3,8 +3,6 @@ module ForestAdminDatasourceZendesk
3
3
  class User < BaseCollection
4
4
  include Searchable
5
5
 
6
- attr_reader :custom_fields
7
-
8
6
  ManyToOneSchema = ForestAdminDatasourceToolkit::Schema::Relations::ManyToOneSchema
9
7
  OneToManySchema = ForestAdminDatasourceToolkit::Schema::Relations::OneToManySchema
10
8
  ENUM_ROLE = %w[end-user agent admin].freeze
@@ -18,12 +16,7 @@ module ForestAdminDatasourceZendesk
18
16
  }.freeze
19
17
 
20
18
  def initialize(datasource, custom_fields: [])
21
- super(datasource, 'ZendeskUser')
22
- define_schema
23
- define_relations
24
- @custom_fields = add_custom_fields(custom_fields)
25
- enable_search
26
- enable_count
19
+ super(datasource, 'ZendeskUser', custom_fields: custom_fields)
27
20
  end
28
21
 
29
22
  def create(_caller, data)
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceZendesk
2
- VERSION = "1.30.7"
2
+ VERSION = "1.31.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_zendesk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.30.7
4
+ version: 1.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Forest Admin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-26 00:00:00.000000000 Z
11
+ date: 2026-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport