zendesk_apps_support 4.5.0 → 4.6.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: 68ec75f6edd58e546096a0264c27bb17652cdac8
4
- data.tar.gz: f7941d0e10b8ed005b59e88af3c2c6ac50dbe742
3
+ metadata.gz: 64de3713a3278aa1401945176018eb8251dabe2b
4
+ data.tar.gz: 12900df7de9e00ef76386f5f0b8597de02ca2cd1
5
5
  SHA512:
6
- metadata.gz: 006e9e8e880b349aa33a3fcff1925e3fccbe9b12ff0ee950ecba54a79ba73363652f43fddfe27720263c6d949da4b06af14d9ce7a0120fc4c43623fe571e5d20
7
- data.tar.gz: 38c4f30c83611fd1e81b13e50df3e5c25027e07348b9dd6352d926cfee0560c156dec281c90e0fd7fbe3ad4fce23c0c9bde28758899ad357ed3c658bd9ffe240
6
+ metadata.gz: 5dfa543b1937ef9a1fc90ef04e22bd0e5bee34279512557a0f6e1fbebfdead52c062b7434b259d5127710494d8f95df08cb271a50b4200f92c51f480ff9cdba3
7
+ data.tar.gz: a5743c976fb414931c707afc21fffa8137420c5448d9526daff454dabb6c2e04ef767e5c7f96f46828128ac70512b7adac86f41b13823f147beb5601f81fae0b
@@ -22,6 +22,8 @@ en:
22
22
  no_app_js_required: Do not set your app to requirements only if you need
23
23
  app.js
24
24
  manifest_not_json: manifest is not proper JSON. %{errors}
25
+ duplicate_manifest_keys: There are duplicate keys specified in the manifest.json
26
+ file. %{errors}
25
27
  missing_manifest: Could not find manifest.json
26
28
  nested_manifest: Could not find manifest.json in the root of the zip file,
27
29
  but %{found_path} was found. Try re-creating the archive from this directory.
@@ -44,6 +44,10 @@ parts:
44
44
  key: "txt.apps.admin.error.app_build.manifest_not_json"
45
45
  title: "App builder job: manifest is invalid JSON error"
46
46
  value: "manifest is not proper JSON. %{errors}"
47
+ - translation:
48
+ key: "txt.apps.admin.error.app_build.duplicate_manifest_keys"
49
+ title: "App builder job: duplicate keys in manifest"
50
+ value: "There are duplicate keys specified in the manifest.json file. %{errors}"
47
51
  - translation:
48
52
  key: "txt.apps.admin.error.app_build.missing_manifest"
49
53
  title: "App builder job: missing manifest error"
@@ -131,7 +135,7 @@ parts:
131
135
  - translation:
132
136
  key: "txt.apps.admin.error.app_build.dirty_svg"
133
137
  title: "App builder job: invalid SVG markup error"
134
- value: "%{svg} contains invalid markup and was unable to be automatically regenerated."
138
+ value: "%{svg} contains invalid markup and could not be automatically regenerated."
135
139
  - translation:
136
140
  key: "txt.apps.admin.error.app_build.oauth_keys.missing.one"
137
141
  title: "App builder job: missing oauth fields error"
@@ -209,7 +213,7 @@ parts:
209
213
  - translation:
210
214
  key: "txt.apps.admin.warning.app_build.sanitised_svg"
211
215
  title: "App builder job: warning that contents of svg have been sanitised and overwritten"
212
- value: "The markup in %{svg} has been edited for use in Zendesk, and may not display as intended."
216
+ value: "The markup in %{svg} has been edited for use in Zendesk and may not display as intended."
213
217
  - translation:
214
218
  key: "txt.apps.admin.error.app_build.invalid_version"
215
219
  title: "App builder job: invalid framework version"
@@ -141,7 +141,8 @@ module ZendeskAppsSupport
141
141
  attr_reader :locations
142
142
 
143
143
  def products_from_locations
144
- location_options.map { |lo| lo.location.product_code }
144
+ location_options.map { |lo| lo.location && lo.location.product_code }
145
+ .compact
145
146
  .uniq
146
147
  .map { |code| Product.find_by(code: code) }
147
148
  end
@@ -28,26 +28,24 @@ module ZendeskAppsSupport
28
28
  end
29
29
 
30
30
  def validate(marketplace: true)
31
- [].tap do |errors|
32
- errors << Validations::Manifest.call(self)
33
-
34
- if has_manifest?
35
- errors << Validations::Marketplace.call(self) if marketplace
36
- errors << Validations::Source.call(self)
37
- errors << Validations::Translations.call(self)
38
- errors << Validations::Requirements.call(self)
39
-
40
- if !manifest.requirements_only? && !manifest.marketing_only? && !manifest.iframe_only?
41
- errors << Validations::Templates.call(self)
42
- errors << Validations::Stylesheets.call(self)
43
- end
31
+ errors = []
32
+ errors << Validations::Manifest.call(self)
33
+ if has_valid_manifest?(errors)
34
+ errors << Validations::Marketplace.call(self) if marketplace
35
+ errors << Validations::Source.call(self)
36
+ errors << Validations::Translations.call(self)
37
+ errors << Validations::Requirements.call(self)
38
+
39
+ unless manifest.requirements_only? || manifest.marketing_only? || manifest.iframe_only?
40
+ errors << Validations::Templates.call(self)
41
+ errors << Validations::Stylesheets.call(self)
44
42
  end
43
+ end
45
44
 
46
- errors << Validations::Banner.call(self) if has_banner?
47
- errors << Validations::Svg.call(self) if has_svgs?
45
+ errors << Validations::Banner.call(self) if has_banner?
46
+ errors << Validations::Svg.call(self) if has_svgs?
48
47
 
49
- errors.flatten!.compact!
50
- end
48
+ errors.flatten.compact
51
49
  end
52
50
 
53
51
  def validate!(marketplace: true)
@@ -250,6 +248,10 @@ module ZendeskAppsSupport
250
248
 
251
249
  private
252
250
 
251
+ def has_valid_manifest?(errors)
252
+ has_manifest? && errors.flatten.empty?
253
+ end
254
+
253
255
  def runtime_translations(translations)
254
256
  result = translations.dup
255
257
  result.delete('name')
@@ -24,6 +24,8 @@ module ZendeskAppsSupport
24
24
 
25
25
  rescue JSON::ParserError => e
26
26
  return [ValidationError.new(:manifest_not_json, errors: e)]
27
+ rescue ZendeskAppsSupport::Manifest::OverrideError => e
28
+ return [ValidationError.new(:duplicate_manifest_keys, errors: e.message)]
27
29
  end
28
30
 
29
31
  private
@@ -64,7 +64,8 @@ module ZendeskAppsSupport
64
64
  end
65
65
 
66
66
  def validate_top_level_required_keys(json, package, file_path)
67
- missing_keys = get_missing_keys(package, json['app'].keys)
67
+ keys = json['app'].is_a?(Hash) ? json['app'].keys : []
68
+ missing_keys = get_missing_keys(package, keys)
68
69
  return if missing_keys.empty?
69
70
  ValidationError.new(
70
71
  'translation.missing_required_key',
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: 4.5.0
4
+ version: 4.6.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: 2017-10-09 00:00:00.000000000 Z
14
+ date: 2017-10-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -273,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  version: 1.3.6
274
274
  requirements: []
275
275
  rubyforge_project:
276
- rubygems_version: 2.6.13
276
+ rubygems_version: 2.6.8
277
277
  signing_key:
278
278
  specification_version: 4
279
279
  summary: Support to help you develop Zendesk Apps.