zendesk_apps_support 1.18.4 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/en.yml +3 -2
- data/lib/zendesk_apps_support/validations/manifest.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ace40b56ef156df8ee9d1d75701446de28de6f0
|
4
|
+
data.tar.gz: 9646fb502276edd309aa2e4201ce3ddaa4ad8997
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df6abfa20f351c08abe3477bb01677c67e04a8d4e8331b7d99c8af19398b7b602bd0a4ab12f6272c296882286e724a9af8d9641d6214d49a6bcb70f23d9e2716
|
7
|
+
data.tar.gz: baea6079f6fb78b82526593935424cb2c04ff104eb6432d02f3e81c3cbd30257cec00f4655280e8edd3507aa17e794ecbca8e874b491f34ca89f29cff1cf4e28
|
data/config/locales/en.yml
CHANGED
@@ -45,9 +45,10 @@ en:
|
|
45
45
|
invalid_default_locale: '%{defaultLocale} is not a valid default locale.'
|
46
46
|
missing_translation_file: 'Missing translation file for locale ''%{defaultLocale}''.
|
47
47
|
Please read: http://developer.zendesk.com/documentation/apps/i18n.html'
|
48
|
+
invalid_host: '%{host_name} is an invalid host for apps.'
|
48
49
|
invalid_location:
|
49
|
-
one: '%{invalid_locations} is an invalid location.'
|
50
|
-
other: '%{invalid_locations} are invalid locations.'
|
50
|
+
one: '%{invalid_locations} is an invalid location in %{host_name}.'
|
51
|
+
other: '%{invalid_locations} are invalid locations in %{host_name}.'
|
51
52
|
duplicate_location:
|
52
53
|
one: '%{duplicate_locations} is a duplicate location.'
|
53
54
|
other: '%{duplicate_locations} are duplicate locations.'
|
@@ -5,8 +5,11 @@ module ZendeskAppsSupport
|
|
5
5
|
module Manifest
|
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
|
-
LOCATIONS_AVAILABLE = %w( top_bar nav_bar ticket_sidebar new_ticket_sidebar user_sidebar organization_sidebar ).freeze
|
9
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 ),
|
11
|
+
'zopim' => %w( chat_sidebar )
|
12
|
+
}.freeze
|
10
13
|
|
11
14
|
class <<self
|
12
15
|
def call(package)
|
@@ -104,9 +107,14 @@ module ZendeskAppsSupport
|
|
104
107
|
end
|
105
108
|
|
106
109
|
def invalid_location_error(manifest)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
+
manifest_location = manifest['location'].is_a?(Hash) ? manifest['location'] : { 'zendesk' => [*manifest['location']] }
|
111
|
+
manifest_location.find do |host, locations|
|
112
|
+
error = if !LOCATIONS_AVAILABLE.keys.include?(host)
|
113
|
+
ValidationError.new(:invalid_host, host_name: host)
|
114
|
+
elsif (invalid_locations = locations - LOCATIONS_AVAILABLE[host]).any?
|
115
|
+
ValidationError.new(:invalid_location, invalid_locations: invalid_locations.join(', '), host_name: host, count: invalid_locations.length)
|
116
|
+
end
|
117
|
+
break error if error
|
110
118
|
end
|
111
119
|
end
|
112
120
|
|
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.
|
4
|
+
version: 1.19.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: 2015-
|
14
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|