zendesk_apps_support 1.21.1 → 1.22.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: 91d3d7ff3563b2673d0ac16aeb4d8f94d1696d65
4
- data.tar.gz: 3c7cd223b4acc89de257981cd90dc91a157e1c1e
3
+ metadata.gz: 4a06daa0f4459f305a6b215168a11d06d304cf8d
4
+ data.tar.gz: a35c8073b293511472db0053f8475961277cf45b
5
5
  SHA512:
6
- metadata.gz: 6abcdd6d959a301a4059b0b1886caa09ffad15fb1b6ba5cad499e0f0ef247a40ff183818dc96da71f1f938f6d0f37c8bd0e05d386fa752b6bed9e3f9b94b4c56
7
- data.tar.gz: 40489d6183b4209fd4a80993afd844a43351f658c8ef8c7cc63c6e958862c0c927533d8614e723830a2ae9d0d9fd2d93e0f13604c01db830087c8fb4fb1ac5c4
6
+ metadata.gz: bc8ec88d0bd509aeab9e4d6a66e4a85a510a28fb8bf45db7826a50c34a554ed5f63c76f1c07ae64c36a1441191ada7b98a1f87a044ae5c002d1d30e0ab80b1e8
7
+ data.tar.gz: 7aeaa373044becb9409257a27016c4af59107893975f6ed8a14200894607fc6f03747cba5c10fceaea05ba54f3800fbecec8a5c5727b6073c70b877eb72699f4
@@ -5,6 +5,7 @@ module ZendeskAppsSupport
5
5
  autoload :AppFile, 'zendesk_apps_support/app_file'
6
6
  autoload :BuildTranslation, 'zendesk_apps_support/build_translation'
7
7
  autoload :I18n, 'zendesk_apps_support/i18n'
8
+ autoload :Location, 'zendesk_apps_support/location'
8
9
  autoload :Package, 'zendesk_apps_support/package'
9
10
  autoload :Installed, 'zendesk_apps_support/installed'
10
11
  autoload :Installation, 'zendesk_apps_support/installation'
@@ -0,0 +1,29 @@
1
+ module ZendeskAppsSupport
2
+ module Location
3
+ # the numbers below match the enum values on the database, do not change them!
4
+ LOCATIONS_AVAILABLE = {
5
+ "zendesk" => {
6
+ "top_bar" => 1,
7
+ "nav_bar" => 2,
8
+ "ticket_sidebar" => 3,
9
+ "new_ticket_sidebar" => 4,
10
+ "user_sidebar" => 5,
11
+ "organization_sidebar" => 6,
12
+ "background" => 7
13
+ },
14
+ "zopim" => {
15
+ "chat_sidebar" => 8
16
+ }
17
+ }.freeze
18
+
19
+ class << self
20
+ def hosts
21
+ LOCATIONS_AVAILABLE.keys
22
+ end
23
+
24
+ def names_for(host: host)
25
+ LOCATIONS_AVAILABLE[host.to_s].keys
26
+ end
27
+ end
28
+ end
29
+ end
@@ -6,10 +6,6 @@ module ZendeskAppsSupport
6
6
  REQUIRED_MANIFEST_FIELDS = %w( author defaultLocale ).freeze
7
7
  OAUTH_REQUIRED_FIELDS = %w( client_id client_secret authorize_uri access_token_uri ).freeze
8
8
  TYPES_AVAILABLE = %w( text password checkbox url number multiline hidden ).freeze
9
- LOCATIONS_AVAILABLE = {
10
- 'zendesk' => %w( top_bar nav_bar ticket_sidebar new_ticket_sidebar user_sidebar organization_sidebar background ),
11
- 'zopim' => %w( chat_sidebar )
12
- }.freeze
13
9
 
14
10
  class <<self
15
11
  def call(package)
@@ -107,9 +103,9 @@ module ZendeskAppsSupport
107
103
  def invalid_location_error(manifest)
108
104
  manifest_location = manifest['location'].is_a?(Hash) ? manifest['location'] : { 'zendesk' => [*manifest['location']] }
109
105
  manifest_location.find do |host, locations|
110
- error = if !LOCATIONS_AVAILABLE.keys.include?(host)
106
+ error = if !Location.hosts.include?(host)
111
107
  ValidationError.new(:invalid_host, host_name: host)
112
- elsif (invalid_locations = locations - LOCATIONS_AVAILABLE[host]).any?
108
+ elsif (invalid_locations = locations - Location.names_for(host: host)).any?
113
109
  ValidationError.new(:invalid_location, invalid_locations: invalid_locations.join(', '), host_name: host, count: invalid_locations.length)
114
110
  end
115
111
  break error if error
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.21.1
4
+ version: 1.22.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-01-07 00:00:00.000000000 Z
14
+ date: 2016-01-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -163,6 +163,7 @@ files:
163
163
  - lib/zendesk_apps_support/i18n.rb
164
164
  - lib/zendesk_apps_support/installation.rb
165
165
  - lib/zendesk_apps_support/installed.rb
166
+ - lib/zendesk_apps_support/location.rb
166
167
  - lib/zendesk_apps_support/package.rb
167
168
  - lib/zendesk_apps_support/sass_functions.rb
168
169
  - lib/zendesk_apps_support/stylesheet_compiler.rb
@@ -200,3 +201,4 @@ signing_key:
200
201
  specification_version: 4
201
202
  summary: Support to help you develop Zendesk Apps.
202
203
  test_files: []
204
+ has_rdoc: