zendesk_apps_tools 3.8.11 → 3.8.13

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
  SHA256:
3
- metadata.gz: cd15052895783f9ee1299f2057d27acc4958cecc562b4bc22be0dfe736ca6a4a
4
- data.tar.gz: e9f0ac5f351657d0d770ffbe6a6546fad3bc34573acceddd4b6816f17f60af60
3
+ metadata.gz: ab3d8023b07c85cb107c3830575ceb7df75265537a1e38b51a64d523ec1d19e0
4
+ data.tar.gz: d04f960bcb63810208ba4b9edf01e4510f1e74e63a57a9363e3df6e106477590
5
5
  SHA512:
6
- metadata.gz: 3b260851e2a5dc1b02a7631235b2a06a532fd4663d0fb27cb0d7ad20363f27dad403c0d57c11078de8a28bc634db58db356d93a05252c24afacaed6e47f28c48
7
- data.tar.gz: 9c7fa5c96ed3c1bed882aba830b0ce263bd11e65b8d8242f235bd4b9bd6de2e0e89aa9d24c2f55a8c68210d7a1b6dc1f43dee7e6705cde909add74e0972cdc6e
6
+ metadata.gz: 3694139b1dfbf857eb9e93cdfe2052d124ddda93b3e0d0dc70913aa023576f7657dc9df5192cdc797fb66916c60b92810dbe5911684d2dab7c457ec5bf16db4d
7
+ data.tar.gz: d9cf81fb74890c46f6fd8e2c151b32f59f5bf55ae81d22d504ebde4152d4d2e0e5da67bd0972dd55f7a213ef397f4ffb44b8cf582e1664c637319fe94b26614a
@@ -10,8 +10,8 @@ module ZendeskAppsTools
10
10
  include Thor::Actions
11
11
  include ZendeskAppsTools::Common
12
12
 
13
- LOCALE_BASE_ENDPOINT = 'https://support.zendesk.com/api/v2/locales'
14
- LOCALE_ENDPOINT = "#{LOCALE_BASE_ENDPOINT}/apps/admin.json"
13
+ LOCALE_BASE_ENDPOINT = 'https://static.zdassets.com/translations'
14
+ LOCALE_ENDPOINT = "#{LOCALE_BASE_ENDPOINT}/admin/manifest.json"
15
15
 
16
16
  desc 'to_yml', 'Create Zendesk translation file from en.json'
17
17
  shared_options(except: [:clean])
@@ -45,16 +45,17 @@ module ZendeskAppsTools
45
45
  setup_path(options[:path]) if options[:path]
46
46
  app_package = package_name_for_update
47
47
  locale_list
48
- .map { |locale| fetch_locale_async locale, app_package }
48
+ .map { |locale| fetch_locale_async locale }
49
49
  .each do |locale_thread|
50
50
  locale = locale_thread.value
51
51
  translations = locale['translations']
52
-
53
- locale_name = ZendeskAppsTools::LocaleIdentifier.new(locale['locale']).locale_id
54
- write_json(
55
- "translations/#{locale_name}.json",
56
- nest_translations_hash(translations, "txt.apps.#{app_package}.")
57
- )
52
+ locale_name = locale['locale']
53
+ if not locale_name.match(/-x-/)
54
+ write_json(
55
+ "translations/#{locale_name}.json",
56
+ nest_translations_hash(translations, "txt.apps.#{app_package}.")
57
+ )
58
+ end
58
59
  end
59
60
  say('Translations updated', :green)
60
61
  end
@@ -75,11 +76,11 @@ module ZendeskAppsTools
75
76
  end
76
77
 
77
78
  no_commands do
78
- def fetch_locale_async(locale, app_package)
79
+ def fetch_locale_async(locale)
79
80
  Thread.new do
80
- say("Fetching #{locale['locale']}")
81
- json = Faraday.get("#{locale['url']}?include=translations&packages=app_#{app_package}").body
82
- json_or_die(json)['locale']
81
+ say("Fetching #{locale['name']}")
82
+ json = Faraday.get("#{LOCALE_BASE_ENDPOINT}#{locale['path']}").body
83
+ json_or_die(json)
83
84
  end
84
85
  end
85
86
 
@@ -168,13 +169,12 @@ module ZendeskAppsTools
168
169
  content = read_file(options[:locales])
169
170
  locales = JSON.parse(content)
170
171
  return locales.map do |locale|
171
- { 'locale' => locale, 'url' => "#{LOCALE_BASE_ENDPOINT}/#{locale}.json" }
172
+ { 'name' => locale, 'path' => "/admin/#{locale}.json" }
172
173
  end
173
174
  end
174
175
 
175
176
  locale_response = Faraday.get(LOCALE_ENDPOINT)
176
-
177
- return json_or_die(locale_response.body)['locales'] if locale_response.status == 200
177
+ return json_or_die(locale_response.body)['json'] if locale_response.status == 200
178
178
  if locale_response.status == 401
179
179
  say_error_and_exit 'Authentication failed.'
180
180
  else
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ZendeskAppsTools
3
- VERSION = '3.8.11'
3
+ VERSION = '3.8.13'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk_apps_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.11
4
+ version: 3.8.13
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: 2022-05-19 00:00:00.000000000 Z
14
+ date: 2022-07-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor