zendesk_apps_support 4.25.0 → 4.26.0

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
- SHA1:
3
- metadata.gz: b29599afad604e6a6adae9e02073bd95466b9e33
4
- data.tar.gz: ee73401ed11aab0e76f126532e95f535d6c07305
2
+ SHA256:
3
+ metadata.gz: f33e10ce723cfd317a40575e24282eb4141e0f62a4d9ddb9ec84607b038a13ec
4
+ data.tar.gz: 458940f7155c235deef30b6dc669459f0877fd69d609fbf6620339972dc079c5
5
5
  SHA512:
6
- metadata.gz: 2d0a284d1868be7d4af01943e2db275291d3505585df2ca322cf5e97d2776137e1c224e4220d215cc96da6312e424ebb0e266c553e6793c7b4c304d301608ca7
7
- data.tar.gz: b556b25327365c6066954be876a3966bbc9b9ec972754aa8afac61c4aba096dddd6f0776bb291cbd37d55439ed1b0025a4f3ae521883c251f3ad9d33e8550e35
6
+ metadata.gz: 8d2570a8c8044a5fb527e4041457ed7bead07338a7fa7656d3e32e6477f2436c6610d247451464acf4c05ccef976b8cc700404436b07c48a486d6c413f48a8bb
7
+ data.tar.gz: 12ed0028c9ea78f9540df163c7a6daf39678a3722d647c38c0aad555e097176d33c93aa41ffe411f96e7092f9d5f40ee6441480cc5c76e1e4de734baae0056d0
@@ -2,6 +2,9 @@
2
2
 
3
3
  module ZendeskAppsSupport
4
4
  class AppRequirement
5
+ CUSTOM_OBJECTS_KEY = 'custom_objects'
6
+ CUSTOM_OBJECTS_TYPE_KEY = 'custom_object_types'
7
+ CUSTOM_OBJECTS_RELATIONSHIP_TYPE_KEY = 'custom_object_relationship_types'
5
8
  TYPES = %w[automations channel_integrations custom_objects macros targets views ticket_fields
6
9
  triggers user_fields organization_fields].freeze
7
10
  end
@@ -212,6 +212,16 @@ module ZendeskAppsSupport
212
212
  has_file?(REQUIREMENTS_FILENAME)
213
213
  end
214
214
 
215
+ def self.has_custom_object_requirements?(requirements_hash)
216
+ return false if requirements_hash.nil?
217
+
218
+ custom_object_requirements = requirements_hash.fetch(AppRequirement::CUSTOM_OBJECTS_KEY, {})
219
+ types = custom_object_requirements.fetch(AppRequirement::CUSTOM_OBJECTS_TYPE_KEY, [])
220
+ relationships = custom_object_requirements.fetch(AppRequirement::CUSTOM_OBJECTS_RELATIONSHIP_TYPE_KEY, [])
221
+
222
+ (types | relationships).any?
223
+ end
224
+
215
225
  def app_css
216
226
  return File.read(path_to('app.scss')) if has_file?('app.scss')
217
227
  return File.read(path_to('app.css')) if has_file?('app.css')
@@ -65,7 +65,7 @@ module ZendeskAppsSupport
65
65
  end
66
66
 
67
67
  def excessive_custom_objects_requirements(requirements)
68
- custom_objects = requirements['custom_objects']
68
+ custom_objects = requirements[AppRequirement::CUSTOM_OBJECTS_KEY]
69
69
  return unless custom_objects
70
70
 
71
71
  count = custom_objects.values.flatten.size
@@ -108,19 +108,19 @@ module ZendeskAppsSupport
108
108
  end
109
109
 
110
110
  def invalid_custom_objects(requirements)
111
- custom_objects = requirements['custom_objects']
111
+ custom_objects = requirements[AppRequirement::CUSTOM_OBJECTS_KEY]
112
112
  return if custom_objects.nil?
113
113
 
114
114
  [].tap do |errors|
115
- unless custom_objects.key?('custom_object_types')
115
+ unless custom_objects.key?(AppRequirement::CUSTOM_OBJECTS_TYPE_KEY)
116
116
  errors << ValidationError.new(:missing_required_fields,
117
- field: 'custom_object_types',
118
- identifier: 'custom_objects')
117
+ field: AppRequirement::CUSTOM_OBJECTS_TYPE_KEY,
118
+ identifier: AppRequirement::CUSTOM_OBJECTS_KEY)
119
119
  end
120
120
 
121
121
  valid_schema = {
122
- 'custom_object_types' => %w[key schema],
123
- 'custom_object_relationship_types' => %w[key source target]
122
+ AppRequirement::CUSTOM_OBJECTS_TYPE_KEY => %w[key schema],
123
+ AppRequirement::CUSTOM_OBJECTS_RELATIONSHIP_TYPE_KEY => %w[key source target]
124
124
  }
125
125
 
126
126
  valid_schema.keys.each do |requirement_type|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk_apps_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.25.0
4
+ version: 4.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James A. Rosen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-11-14 00:00:00.000000000 Z
14
+ date: 2019-12-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -319,8 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
319
  - !ruby/object:Gem::Version
320
320
  version: 1.3.6
321
321
  requirements: []
322
- rubyforge_project:
323
- rubygems_version: 2.6.8
322
+ rubygems_version: 3.0.6
324
323
  signing_key:
325
324
  specification_version: 4
326
325
  summary: Support to help you develop Zendesk Apps.