zendesk_apps_support 3.1.1 → 3.1.2

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: 3c3fca724e7f35785484603ca55af83855f552b4
4
- data.tar.gz: 0d43d9895907802f2b78e2254b51fd9071cfd81b
3
+ metadata.gz: 17e0397eb9e955f39c20172e468c5c802c16e6b9
4
+ data.tar.gz: 729794611cb19c2ad235ef74edcdb57b8d10cea3
5
5
  SHA512:
6
- metadata.gz: ab5d576101b539d7ae1f03a2e8ee3d19dba79ae06ac63c99e81aed69f82892b6223214ca1fe604c19c2b6f6b247616e6969ae0b4954604184412d450356ae69d
7
- data.tar.gz: f0055a8a80058d9dc1418c01ead238e9baa10f2ead12599cbaf2e0f1b69b3fe198cc43ee5d1e4814207de159f6434bb1300e21b4f82395618ddf5109587883fb
6
+ metadata.gz: 31db6f1d415c359436fda55684f6040bc5187b6700814f63398bcfa6f6f912dc329f63cb2b5628eb186b7a1abea085d11b4e7e28cc68d55381608c6b1be2e55e
7
+ data.tar.gz: 855a7bd5ae36894856819ebed680ce64d5628b54da9ec6fae5873eae20a7537fdea6851e5e22ca254e470604e75fb06e74c29d4a34a9326661198d2b1c59cb86
@@ -9,6 +9,8 @@ en:
9
9
  jshint:
10
10
  one: 'JSHint error in %{file}: %{errors}'
11
11
  other: 'JSHint errors in %{file}: %{errors}'
12
+ no_parameters_required: Parameters can't be defined for marketing-only
13
+ apps
12
14
  no_location_required: Locations can't be defined when you specify requirements
13
15
  only
14
16
  no_framework_version_required: Framework versions can't be set when you
@@ -19,6 +21,8 @@ en:
19
21
  missing_manifest: Could not find manifest.json
20
22
  symlink_in_zip: Symlinks are not allowed in the zip file
21
23
  missing_requirements: Could not find requirements.json
24
+ requirements_not_supported: App requirements are not supported for marketing-only
25
+ apps
22
26
  manifest_keys:
23
27
  missing:
24
28
  one: 'Missing required field in manifest: %{missing_keys}'
@@ -15,6 +15,10 @@ parts:
15
15
  key: "txt.apps.admin.error.app_build.jshint.other"
16
16
  title: "App builder job: JSHint error messages"
17
17
  value: "JSHint errors in %{file}: %{errors}"
18
+ - translation:
19
+ key: "txt.apps.admin.error.app_build.no_parameters_required"
20
+ title: "App builder job: prevent adding parameters while marketing only"
21
+ value: "Parameters can't be defined for marketing-only apps"
18
22
  - translation:
19
23
  key: "txt.apps.admin.error.app_build.no_location_required"
20
24
  title: "App builder job: ban location while requirements only"
@@ -44,6 +48,10 @@ parts:
44
48
  key: "txt.apps.admin.error.app_build.missing_requirements"
45
49
  title: "App builder job: missing requirements error"
46
50
  value: "Could not find requirements.json"
51
+ - translation:
52
+ key: "txt.apps.admin.error.app_build.requirements_not_supported"
53
+ title: "App builder job: requirements not supported error"
54
+ value: "App requirements are not supported for marketing-only apps"
47
55
  - translation:
48
56
  key: "txt.apps.admin.error.app_build.manifest_keys.missing.one"
49
57
  title: "App builder job: missing manifest fields error"
@@ -5,6 +5,7 @@ module ZendeskAppsSupport
5
5
 
6
6
  RUBY_TO_JSON = {
7
7
  requirements_only: 'requirementsOnly',
8
+ marketing_only: 'marketingOnly',
8
9
  version: 'version',
9
10
  author: 'author',
10
11
  framework_version: 'frameworkVersion',
@@ -26,6 +27,7 @@ module ZendeskAppsSupport
26
27
  attr_reader :locations
27
28
 
28
29
  alias_method :requirements_only?, :requirements_only
30
+ alias_method :marketing_only?, :marketing_only
29
31
  alias_method :signed_urls?, :signed_urls
30
32
  alias_method :single_install?, :single_install
31
33
  alias_method :private?, :private
@@ -70,6 +72,7 @@ module ZendeskAppsSupport
70
72
  instance_variable_set(:"@#{ruby}", m[json])
71
73
  end
72
74
  @requirements_only ||= false
75
+ @marketing_only ||= false
73
76
  @single_install ||= false
74
77
  @private = m.fetch('private', true)
75
78
  @signed_urls ||= false
@@ -8,6 +8,7 @@ module ZendeskAppsSupport
8
8
  extend Gem::Deprecate
9
9
  include ZendeskAppsSupport::BuildTranslation
10
10
 
11
+ MANIFEST_FILENAME = 'manifest.json'
11
12
  REQUIREMENTS_FILENAME = 'requirements.json'
12
13
 
13
14
  DEFAULT_LAYOUT = Erubis::Eruby.new(File.read(File.expand_path('../assets/default_template.html.erb', __FILE__)))
@@ -29,19 +30,15 @@ module ZendeskAppsSupport
29
30
  errors << Validations::Marketplace.call(self) if marketplace
30
31
 
31
32
  errors << Validations::Manifest.call(self)
32
-
33
33
  if has_manifest?
34
34
  errors << Validations::Source.call(self)
35
35
  errors << Validations::Translations.call(self)
36
+ errors << Validations::Requirements.call(self)
36
37
 
37
- unless manifest.requirements_only?
38
+ if !manifest.requirements_only? && !manifest.marketing_only? && !manifest.iframe_only?
38
39
  errors << Validations::Templates.call(self)
39
40
  errors << Validations::Stylesheets.call(self)
40
41
  end
41
-
42
- if has_requirements?
43
- errors << Validations::Requirements.call(self)
44
- end
45
42
  end
46
43
 
47
44
  if has_banner?
@@ -145,17 +142,17 @@ module ZendeskAppsSupport
145
142
  end
146
143
 
147
144
  def manifest_json
148
- @manifest_json ||= read_json('manifest.json')
145
+ @manifest_json ||= read_json(MANIFEST_FILENAME)
149
146
  end
150
147
  deprecate :manifest_json, :manifest, 2016, 9
151
148
 
152
149
  def manifest
153
- @manifest ||= Manifest.new(read_file('manifest.json'))
150
+ @manifest ||= Manifest.new(read_file(MANIFEST_FILENAME))
154
151
  end
155
152
 
156
153
  def requirements_json
157
154
  return nil unless has_requirements?
158
- @requirements ||= read_json('requirements.json', object_class: Manifest::NoOverrideHash)
155
+ @requirements ||= read_json(REQUIREMENTS_FILENAME, object_class: Manifest::NoOverrideHash)
159
156
  end
160
157
 
161
158
  def is_no_template
@@ -193,6 +190,10 @@ module ZendeskAppsSupport
193
190
  File.exist?(path_to(path))
194
191
  end
195
192
 
193
+ def has_requirements?
194
+ has_file?(REQUIREMENTS_FILENAME)
195
+ end
196
+
196
197
  def app_css
197
198
  css_file = path_to('app.css')
198
199
  scss_file = path_to('app.scss')
@@ -266,11 +267,7 @@ module ZendeskAppsSupport
266
267
  end
267
268
 
268
269
  def has_manifest?
269
- has_file?('manifest.json')
270
- end
271
-
272
- def has_requirements?
273
- has_file?('requirements.json')
270
+ has_file?(MANIFEST_FILENAME)
274
271
  end
275
272
 
276
273
  def has_banner?
@@ -15,15 +15,20 @@ module ZendeskAppsSupport
15
15
  errors = []
16
16
  errors << missing_keys_error(manifest)
17
17
  errors << oauth_error(manifest)
18
- errors << parameters_error(manifest)
19
- errors << invalid_hidden_parameter_error(manifest)
20
- errors << invalid_type_error(manifest)
21
- errors << name_as_parameter_name_error(manifest)
22
- errors << no_template_format_error(manifest)
18
+
19
+ if manifest.marketing_only?
20
+ errors << ban_parameters(manifest)
21
+ else
22
+ errors << parameters_error(manifest)
23
+ errors << invalid_hidden_parameter_error(manifest)
24
+ errors << invalid_type_error(manifest)
25
+ errors << name_as_parameter_name_error(manifest)
26
+ errors << no_template_format_error(manifest)
27
+ end
23
28
  errors << boolean_error(manifest)
24
29
  errors << default_locale_error(manifest, package)
25
30
 
26
- if manifest.requirements_only?
31
+ if manifest.requirements_only? || manifest.marketing_only?
27
32
  errors << ban_location(manifest)
28
33
  errors << ban_framework_version(manifest)
29
34
  else
@@ -43,7 +48,7 @@ module ZendeskAppsSupport
43
48
  private
44
49
 
45
50
  def boolean_error(manifest)
46
- booleans = %i(requirements_only single_install signed_urls private)
51
+ booleans = %i(requirements_only marketing_only single_install signed_urls private)
47
52
  errors = []
48
53
  RUBY_TO_JSON.each do |ruby, json|
49
54
  if booleans.include? ruby
@@ -65,6 +70,10 @@ module ZendeskAppsSupport
65
70
  end
66
71
  end
67
72
 
73
+ def ban_parameters(manifest)
74
+ ValidationError.new(:no_parameters_required) unless manifest.parameters.empty?
75
+ end
76
+
68
77
  def ban_location(manifest)
69
78
  ValidationError.new(:no_location_required) if manifest.location?
70
79
  end
@@ -5,7 +5,13 @@ module ZendeskAppsSupport
5
5
 
6
6
  class <<self
7
7
  def call(package)
8
- return [ValidationError.new(:missing_requirements)] unless package.has_file? 'requirements.json'
8
+ if package.manifest.requirements_only? && !package.has_requirements?
9
+ return [ValidationError.new(:missing_requirements)]
10
+ elsif package.manifest.marketing_only? && package.has_requirements?
11
+ return [ValidationError.new(:requirements_not_supported)]
12
+ elsif !package.has_requirements?
13
+ return []
14
+ end
9
15
 
10
16
  begin
11
17
  requirements = package.requirements_json
@@ -42,6 +42,7 @@ module ZendeskAppsSupport
42
42
  end
43
43
 
44
44
  def package_needs_app_js?(package)
45
+ return false if package.manifest.marketing_only?
45
46
  return false if package.manifest.requirements_only?
46
47
  return false if package.manifest.iframe_only?
47
48
  true
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: 3.1.1
4
+ version: 3.1.2
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-09-02 00:00:00.000000000 Z
14
+ date: 2016-09-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: 1.3.6
202
202
  requirements: []
203
203
  rubyforge_project:
204
- rubygems_version: 2.6.4
204
+ rubygems_version: 2.5.1
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Support to help you develop Zendesk Apps.