zendesk_apps_support 1.25.0 → 1.26.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
  SHA1:
3
- metadata.gz: f96cb6e04733bce60d310960b644e90741e51923
4
- data.tar.gz: b0f885a461209f8d8f8adabeaaa7c3f4d479a3ce
3
+ metadata.gz: 2c713031f04543814716a3d4f307ba6c233db097
4
+ data.tar.gz: 9c783a331bf3b1a79fc9ec8f9b10441e9f8f7e91
5
5
  SHA512:
6
- metadata.gz: f5bc3a6aa72b47bf16032c3b2f77a196812b6a1416cb27ce13568f234958d5441d655a5eebc85f5292dd7ee96069372b939c28c08627658ca4d473f7b06f106b
7
- data.tar.gz: d1e5ccc4dc4ac725a88e584231ee9e4f0d1168a87ff9f34e8f83eab783ec8ecda58105702c9a002b9a4869de1a795cf21924321243bb5d71c04428afb025fdc3
6
+ metadata.gz: 038638a22d0c11e6acd555864028d571bbd13a5b6e2ae6ad66fc3d6a45945d86ed69c6c625eba07f6f1cc714360618b490c000cd124b3fb99799367112e8dce4
7
+ data.tar.gz: d5b85a193850e60115092a73c4e3f3ba307a4303d86c6c189785b55c0d4acc8f5a34c7c62fcf14ce381e8bb8de89419573bb9dfcab92597dd3272d5e91d67936
@@ -34,6 +34,7 @@ en:
34
34
  invalid_requirements_types:
35
35
  one: 'requirements.json contains an invalid type: %{invalid_types}'
36
36
  other: 'requirements.json contains invalid types: %{invalid_types}'
37
+ multiple_channel_integrations: 'Specifying multiple channel integrations in requirements.json is not supported.'
37
38
  banner:
38
39
  invalid_format: Banner image must be a PNG file.
39
40
  invalid_size: Invalid banner image dimensions. Must be %{required_banner_width}x%{required_banner_height}px.
@@ -1,5 +1,5 @@
1
1
  module ZendeskAppsSupport
2
2
  class AppRequirement
3
- TYPES = %w(automations macros targets views ticket_fields triggers user_fields).freeze
3
+ TYPES = %w(automations channel_integrations macros targets views ticket_fields triggers user_fields).freeze
4
4
  end
5
5
  end
@@ -22,6 +22,8 @@ module ZendeskAppsSupport
22
22
  [].tap do |errors|
23
23
  errors << invalid_requirements_types(requirements)
24
24
  errors << excessive_requirements(requirements)
25
+ errors << invalid_channel_integrations(requirements)
26
+ errors << invalid_user_fields(requirements)
25
27
  errors << missing_required_fields(requirements)
26
28
  errors.flatten!
27
29
  errors.compact!
@@ -34,19 +36,13 @@ module ZendeskAppsSupport
34
36
 
35
37
  def missing_required_fields(requirements)
36
38
  [].tap do |errors|
37
- requirements.values.each do |requirement|
39
+ requirements.each do |requirement_type, requirement|
40
+ next if requirement_type == 'channel_integrations'
38
41
  requirement.each do |identifier, fields|
39
42
  next if fields.include? 'title'
40
43
  errors << ValidationError.new(:missing_required_fields, field: 'title', identifier: identifier)
41
44
  end
42
45
  end
43
-
44
- unless requirements['user_fields'].nil?
45
- requirements['user_fields'].each do |identifier, fields|
46
- next if fields.include? 'key'
47
- errors << ValidationError.new(:missing_required_fields, field: 'key', identifier: identifier)
48
- end
49
- end
50
46
  end
51
47
  end
52
48
 
@@ -57,6 +53,32 @@ module ZendeskAppsSupport
57
53
  end
58
54
  end
59
55
 
56
+ def invalid_user_fields(requirements)
57
+ user_fields = requirements['user_fields']
58
+ return unless user_fields
59
+ [].tap do |errors|
60
+ user_fields.each do |identifier, fields|
61
+ next if fields.include? 'key'
62
+ errors << ValidationError.new(:missing_required_fields, field: 'key', identifier: identifier)
63
+ end
64
+ end
65
+ end
66
+
67
+ def invalid_channel_integrations(requirements)
68
+ channel_integrations = requirements['channel_integrations']
69
+ return unless channel_integrations
70
+ [].tap do |errors|
71
+ if channel_integrations.size > 1
72
+ errors << ValidationError.new(:multiple_channel_integrations, count: channel_integrations.size)
73
+ end
74
+ channel_integrations.each do |identifier, fields|
75
+ unless fields.include? 'manifest_url'
76
+ errors << ValidationError.new(:missing_required_fields, field: 'manifest_url', identifier: identifier)
77
+ end
78
+ end
79
+ end
80
+ end
81
+
60
82
  def invalid_requirements_types(requirements)
61
83
  invalid_types = requirements.keys - ZendeskAppsSupport::AppRequirement::TYPES
62
84
 
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: 1.25.0
4
+ version: 1.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: 2016-04-12 00:00:00.000000000 Z
14
+ date: 2016-04-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: 1.3.6
198
198
  requirements: []
199
199
  rubyforge_project:
200
- rubygems_version: 2.5.1
200
+ rubygems_version: 2.4.1
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Support to help you develop Zendesk Apps.