zendesk_apps_support 1.10.0 → 1.11.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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1af9b7ff78ef619e400492c4e98711a9e3a1014
|
4
|
+
data.tar.gz: 897349bef78c52a54a97759a4b1dfb66d82c235e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49de33216f17a4a87460689156ad783291c73821501e89feb2da7347677474d2828742c5488a04621e34810be8cc6e20175810545e9f4bee895f3782a234c5df
|
7
|
+
data.tar.gz: f0a266f0584d30542bcf4056069467986e3e0850f31b10ca90f25dc4ffd6211c529aff92f015e8092c94a46b95bbd111db31f7384ffa0fe00df6d144f516fb58
|
data/config/locales/en.yml
CHANGED
@@ -27,6 +27,10 @@ en:
|
|
27
27
|
invalid_location:
|
28
28
|
one: '%{invalid_locations} is an invalid location.'
|
29
29
|
other: '%{invalid_locations} are invalid locations.'
|
30
|
+
duplicate_location:
|
31
|
+
one: '%{duplicate_locations} is a duplicate location.'
|
32
|
+
other: '%{duplicate_locations} are duplicate locations.'
|
33
|
+
name_as_parameter_name: Can't call a parameter 'name'
|
30
34
|
invalid_hidden_parameter:
|
31
35
|
one: '%{invalid_params} is set to hidden and cannot be required.'
|
32
36
|
other: '%{invalid_params} are set to hidden and cannot be required.'
|
@@ -63,6 +63,18 @@ parts:
|
|
63
63
|
key: "txt.apps.admin.error.app_build.invalid_location.other"
|
64
64
|
title: "App builder job: invalid locations"
|
65
65
|
value: "%{invalid_locations} are invalid locations."
|
66
|
+
- translation:
|
67
|
+
key: "txt.apps.admin.error.app_build.duplicate_location.one"
|
68
|
+
title: "App builder job: duplicate locations"
|
69
|
+
value: "%{duplicate_locations} is a duplicate location."
|
70
|
+
- translation:
|
71
|
+
key: "txt.apps.admin.error.app_build.duplicate_location.other"
|
72
|
+
title: "App builder job: duplicate locations"
|
73
|
+
value: "%{duplicate_locations} are duplicate locations."
|
74
|
+
- translation:
|
75
|
+
key: "txt.apps.admin.error.app_build.name_as_parameter_name"
|
76
|
+
title: "App builder job: error message when developer names a parameter 'name'"
|
77
|
+
value: "Can't call a parameter 'name'"
|
66
78
|
- translation:
|
67
79
|
key: "txt.apps.admin.error.app_build.invalid_hidden_parameter.one"
|
68
80
|
title: "App builder job: hidden parameters set to required"
|
@@ -21,11 +21,13 @@ module ZendeskAppsSupport
|
|
21
21
|
errors << missing_keys_error(manifest)
|
22
22
|
errors << default_locale_error(manifest, package)
|
23
23
|
errors << invalid_location_error(manifest)
|
24
|
+
errors << duplicate_location_error(manifest)
|
24
25
|
errors << invalid_version_error(manifest, package)
|
25
26
|
errors << oauth_error(manifest)
|
26
27
|
errors << parameters_error(manifest)
|
27
28
|
errors << invalid_hidden_parameter_error(manifest)
|
28
29
|
errors << invalid_type_error(manifest)
|
30
|
+
errors << name_as_parameter_name_error(manifest)
|
29
31
|
errors.compact!
|
30
32
|
end
|
31
33
|
rescue MultiJson::DecodeError => e
|
@@ -89,6 +91,15 @@ module ZendeskAppsSupport
|
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
94
|
+
def duplicate_location_error(manifest)
|
95
|
+
locations = *manifest['location']
|
96
|
+
duplicate_locations = *locations.select { |location| locations.count(location) > 1 }.uniq
|
97
|
+
|
98
|
+
unless duplicate_locations.empty?
|
99
|
+
ValidationError.new(:duplicate_location, :duplicate_locations => duplicate_locations.join(', '), :count => duplicate_locations.length)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
92
103
|
def invalid_version_error(manifest, package)
|
93
104
|
valid_to_serve = AppVersion::TO_BE_SERVED
|
94
105
|
target_version = manifest['frameworkVersion']
|
@@ -102,6 +113,14 @@ module ZendeskAppsSupport
|
|
102
113
|
end
|
103
114
|
end
|
104
115
|
|
116
|
+
def name_as_parameter_name_error(manifest)
|
117
|
+
if manifest['parameters'].kind_of?(Array)
|
118
|
+
if manifest['parameters'].any? { |p| p['name'] == 'name' }
|
119
|
+
ValidationError.new(:name_as_parameter_name)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
105
124
|
def invalid_hidden_parameter_error(manifest)
|
106
125
|
invalid_params = []
|
107
126
|
|
@@ -65,6 +65,16 @@ describe ZendeskAppsSupport::Validations::Manifest do
|
|
65
65
|
locations_error.should_not be_nil
|
66
66
|
end
|
67
67
|
|
68
|
+
it 'should have an error when there are duplicate locations' do
|
69
|
+
manifest = { 'location' => ['ticket_sidebar', 'ticket_sidebar'] }
|
70
|
+
manifest_file = mock('AppFile', :relative_path => 'manifest.json', :read => JSON.dump(manifest))
|
71
|
+
package = mock('Package', :files => [manifest_file])
|
72
|
+
errors = ZendeskAppsSupport::Validations::Manifest.call(package)
|
73
|
+
|
74
|
+
locations_error = errors.find { |e| e.to_s =~ /duplicate/ }
|
75
|
+
locations_error.should_not be_nil
|
76
|
+
end
|
77
|
+
|
68
78
|
it 'should have an error when the version is not supported' do
|
69
79
|
manifest = { 'frameworkVersion' => '0.7' }
|
70
80
|
manifest_file = mock('AppFile', :relative_path => 'manifest.json', :read => JSON.dump(manifest))
|
@@ -129,6 +139,18 @@ describe ZendeskAppsSupport::Validations::Manifest do
|
|
129
139
|
errors.map(&:to_s).should == ['App parameters must be an array.']
|
130
140
|
end
|
131
141
|
|
142
|
+
it 'has an error when there is a parameter called "name"' do
|
143
|
+
parameter_hash = {
|
144
|
+
'parameters' => [{
|
145
|
+
'name' => 'name',
|
146
|
+
'type' => 'text'
|
147
|
+
}]
|
148
|
+
}
|
149
|
+
|
150
|
+
errors = ZendeskAppsSupport::Validations::Manifest.call(create_package(parameter_hash))
|
151
|
+
errors.map(&:to_s).should == ["Can't call a parameter 'name'"]
|
152
|
+
end
|
153
|
+
|
132
154
|
it "doesn't have an error with an array of app parameters" do
|
133
155
|
parameter_hash = {
|
134
156
|
'parameters' => [{
|
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.11.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:
|
14
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|