singleton-client 0.7.4 → 0.7.7

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -28
  3. data/lib/sgtn-client/api/source.rb +10 -66
  4. data/lib/sgtn-client/api/t.rb +20 -18
  5. data/lib/sgtn-client/api/translation.rb +82 -116
  6. data/lib/sgtn-client/cldr/core_ext.rb +4 -1
  7. data/lib/sgtn-client/cldr/localized_date.rb +4 -1
  8. data/lib/sgtn-client/cldr/localized_datetime.rb +4 -1
  9. data/lib/sgtn-client/cldr/localized_str.rb +4 -1
  10. data/lib/sgtn-client/cldr/localized_time.rb +4 -1
  11. data/lib/sgtn-client/common/data.rb +30 -0
  12. data/lib/sgtn-client/common/single_operation.rb +34 -0
  13. data/lib/sgtn-client/core/cache.rb +14 -80
  14. data/lib/sgtn-client/core/config.rb +42 -3
  15. data/lib/sgtn-client/core/exceptions.rb +3 -0
  16. data/lib/sgtn-client/core/logging.rb +3 -1
  17. data/lib/sgtn-client/exceptions.rb +6 -0
  18. data/lib/sgtn-client/formatters/plurals/plural_formatter.rb +4 -1
  19. data/lib/sgtn-client/loader/cache.rb +71 -0
  20. data/lib/sgtn-client/loader/chain_loader.rb +49 -0
  21. data/lib/sgtn-client/loader/consts.rb +15 -0
  22. data/lib/sgtn-client/loader/loader_factory.rb +33 -0
  23. data/lib/sgtn-client/loader/local_translation.rb +49 -0
  24. data/lib/sgtn-client/loader/server.rb +94 -0
  25. data/lib/sgtn-client/loader/single_loader.rb +48 -0
  26. data/lib/sgtn-client/loader/source.rb +56 -0
  27. data/lib/sgtn-client/loader/source_comparer.rb +58 -0
  28. data/lib/sgtn-client/sgtn-client.rb +11 -1
  29. data/lib/sgtn-client/util/cache-util.rb +33 -44
  30. data/lib/sgtn-client/util/locale-util.rb +67 -28
  31. data/lib/sgtn-client/util/string-util.rb +12 -0
  32. data/lib/sgtn-client/util/validate-util.rb +4 -7
  33. data/lib/singleton-client.rb +15 -0
  34. data/lib/singleton-ruby.rb +5 -0
  35. data/lib/version.rb +2 -0
  36. metadata +43 -147
  37. data/lib/sgtn-client/core/request.rb +0 -21
  38. data/lib/sgtn-client/util/file-util.rb +0 -34
@@ -0,0 +1,58 @@
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
3
+
4
+ module SgtnClient
5
+ autoload :StringUtil, 'sgtn-client/util/string-util'
6
+ autoload :LocaleUtil, 'sgtn-client/util/locale-util'
7
+
8
+ module TranslationLoader
9
+ autoload :CONSTS, 'sgtn-client/loader/consts'
10
+
11
+ module SourceComparer
12
+ def load_bundle(component, locale)
13
+ SgtnClient.logger.debug "[#{__FILE__}][#{__callee__}] component=#{component}, locale=#{locale}"
14
+
15
+ # source locale and old source locale don't need comparison because they are bases of comparison
16
+ real_locale = cache_to_real_map[locale]
17
+ return super(component, real_locale) if real_locale
18
+
19
+ old_source_bundle_thread = Thread.new { load_bundle(component, CONSTS::OLD_SOURCE_LOCALE) }
20
+ source_bundle_thread = Thread.new { load_bundle(component, LocaleUtil.get_source_locale) }
21
+ translation_bundle = super(component, locale)
22
+
23
+ begin
24
+ old_source_bundle = old_source_bundle_thread.value
25
+ source_bundle = source_bundle_thread.value
26
+ rescue StandardError => e
27
+ SgtnClient.logger.error "[#{__FILE__}][#{__callee__}] failed to load soruce(or old source) bundle. component:#{component}. error: #{e}"
28
+ return translation_bundle
29
+ end
30
+
31
+ compare_source(translation_bundle, old_source_bundle, source_bundle)
32
+ end
33
+
34
+ private
35
+
36
+ def compare_source(translation_bundle, old_source_bundle, source_bundle)
37
+ if !translation_bundle.is_a?(Hash) || !source_bundle.is_a?(Hash) || !old_source_bundle.is_a?(Hash)
38
+ SgtnClient.logger.warn "can't do source comparison because some bundle data are wrong."
39
+ return translation_bundle
40
+ end
41
+
42
+ source_bundle.each do |key, value|
43
+ if old_source_bundle[key] != value || translation_bundle[key].nil?
44
+ translation_bundle[key] = StringUtil.new(value, LocaleUtil.get_source_locale)
45
+ end
46
+ end
47
+ translation_bundle
48
+ end
49
+
50
+ def cache_to_real_map
51
+ @cache_to_real_map ||= {
52
+ LocaleUtil.get_source_locale => CONSTS::REAL_SOURCE_LOCALE,
53
+ CONSTS::OLD_SOURCE_LOCALE => LocaleUtil.get_source_locale
54
+ }.freeze
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,4 +1,12 @@
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
3
+
1
4
  module SgtnClient
5
+ LOGFILE_SHIFT_AGE = 4
6
+
7
+ module Common
8
+ autoload :BundleID, "sgtn-client/common/data"
9
+ end
2
10
  module Core
3
11
  autoload :Cache, "sgtn-client/core/cache"
4
12
  end
@@ -12,6 +20,8 @@ module SgtnClient
12
20
  autoload :ValidateUtil, "sgtn-client/util/validate-util"
13
21
  autoload :LocaleUtil, "sgtn-client/util/locale-util"
14
22
  autoload :FileUtil, "sgtn-client/util/file-util"
23
+ autoload :CacheUtil, "sgtn-client/util/cache-util"
24
+ autoload :StringUtil, "sgtn-client/util/string-util"
15
25
 
16
26
  module Formatters
17
27
  autoload :PluralFormatter, "sgtn-client/formatters/plurals/plural_formatter"
@@ -44,7 +54,7 @@ module SgtnClient
44
54
  end
45
55
  file = File.open(file, 'a')
46
56
  file.sync = true
47
- SgtnClient.logger = Logger.new(file)
57
+ SgtnClient.logger = Logger.new(file, LOGFILE_SHIFT_AGE)
48
58
 
49
59
  # Set log level for sandbox mode
50
60
  env = SgtnClient::Config.default_environment
@@ -1,51 +1,40 @@
1
- require 'erb'
2
- require 'yaml'
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
3
3
 
4
4
  module SgtnClient
5
-
6
5
  module Core
7
- autoload :Cache, "sgtn-client/core/cache"
6
+ autoload :Cache, 'sgtn-client/core/cache'
8
7
  end
9
-
8
+
10
9
  class CacheUtil
10
+ def self.get_cache(cache_key)
11
+ SgtnClient::Core::Cache.get(cache_key)
12
+ end
11
13
 
12
- def self.get_cache(cache_key)
13
- expired, items = SgtnClient::Core::Cache.get(cache_key)
14
- SgtnClient.logger.debug "[CacheUtil]get cache with key #{cache_key}, expired #{expired}"
15
- return expired, items
16
- end
17
-
18
- def self.clear_cache()
19
- SgtnClient::Core::Cache.clear()
20
- SgtnClient.logger.debug "[CacheUtil]clear cache"
21
- end
22
-
23
- def self.write_cache(cache_key, items)
24
- if items.nil?
25
- return nil
26
- end
27
- env = SgtnClient::Config.default_environment
28
- cache_expiry_period = SgtnClient::Config.configurations[env]["cache_expiry_period"]
29
- # expired after 24 hours
30
- if cache_expiry_period == nil
31
- cache_expiry_period = 24*60
32
- end
33
- SgtnClient.logger.debug "[CacheUtil]write cache with key #{cache_key}, cache_expiry_period #{cache_expiry_period}, itmes #{items}"
34
- SgtnClient::Core::Cache.put(cache_key, items, cache_expiry_period)
35
- end
36
-
37
- def self.get_cachekey(component, locale)
38
- env = SgtnClient::Config.default_environment
39
- product_name = SgtnClient::Config.configurations[env]["product_name"]
40
- version = SgtnClient::Config.configurations[env]["version"].to_s
41
- default_l = SgtnClient::Config.configurations[env]["default_language"]
42
- if default_l == nil
43
- default_l = 'en'
44
- end
45
- lc = locale == default_l ? SgtnClient::Config.configurations.default: locale
46
- SgtnClient.logger.debug "[CacheUtil]get cache key: #{lc}"
47
- return product_name + "_" + version + "_" + component + "_" + lc
48
- end
49
- end
14
+ def self.clear_cache
15
+ SgtnClient::Core::Cache.clear
16
+ end
17
+
18
+ def self.write_cache(cache_key, items)
19
+ return nil if items.nil? || items.empty?
50
20
 
51
- end
21
+ env = SgtnClient::Config.default_environment
22
+ cache_expiry_period = SgtnClient::Config.configurations[env]['cache_expiry_period']
23
+ # expired after 24 hours
24
+ cache_expiry_period = 24 * 60 if cache_expiry_period.nil?
25
+ SgtnClient::Core::Cache.put(cache_key, items, cache_expiry_period)
26
+ end
27
+
28
+ def self.get_cachekey(component, locale)
29
+ env = SgtnClient::Config.default_environment
30
+ product_name = SgtnClient::Config.configurations[env]['product_name']
31
+ version = SgtnClient::Config.configurations[env]['version'].to_s
32
+ product_name + '_' + version + '_' + component + '_' + locale
33
+ end
34
+
35
+ def self.is_expired(cache_item)
36
+ cache_item[:expiry] < Time.now
37
+ end
38
+
39
+ end
40
+ end
@@ -1,31 +1,70 @@
1
- module SgtnClient
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 VMware, Inc.
4
+ # SPDX-License-Identifier: EPL-2.0
2
5
 
3
- DEFAULT_LOCALES = ['en', 'de', 'es', 'fr', 'ko', 'ja', 'zh-Hans', 'zh-Hant']
6
+ require 'set'
4
7
 
8
+ module SgtnClient
9
+ class LocaleUtil
5
10
  MAP_LOCALES = {
6
- "zh-CN" =>"zh-Hans",
7
- "zh-TW" =>"zh-Hant",
8
- "zh-Hans-CN" =>"zh-Hans",
9
- "zh-Hant-TW" =>"zh-Hant",
10
- }
11
-
12
- class LocaleUtil
13
- def self.fallback(locale)
14
- found = SgtnClient::DEFAULT_LOCALES.select {|e| e == locale}
15
- if !found.empty?
16
- return found[0]
17
- end
18
- if SgtnClient::MAP_LOCALES.key?(locale)
19
- return SgtnClient::MAP_LOCALES[locale]
20
- end
21
- parts = locale.split("-")
22
- if parts.size > 1
23
- f = SgtnClient::DEFAULT_LOCALES.select {|e| e == parts[0]}
24
- if !f.empty?
25
- return f[0]
26
- end
27
- end
28
- return locale
29
- end
30
- end
31
- end
11
+ 'zh-cn' => 'zh-hans',
12
+ 'zh-tw' => 'zh-hant',
13
+ 'zh-hans-cn' => 'zh-hans',
14
+ 'zh-hant-tw' => 'zh-hant'
15
+ }.freeze
16
+ LOCALE_SEPARATOR = '-'
17
+
18
+ def self.get_best_locale(locale)
19
+ return locale if Config.available_locales.include?(locale)
20
+
21
+ return get_fallback_locale if locale.nil?
22
+
23
+ locale = locale.to_s
24
+ return get_fallback_locale if locale.empty?
25
+
26
+ get_best_match(locale.gsub('_', LOCALE_SEPARATOR).downcase)
27
+ end
28
+
29
+ def self.is_source_locale(locale = nil)
30
+ locale == get_source_locale
31
+ end
32
+
33
+ def self.get_best_match(locale)
34
+ locale = MAP_LOCALES[locale] || locale
35
+ lowercase_locales_map[locale] or begin
36
+ index = locale.rindex(LOCALE_SEPARATOR)
37
+ return get_fallback_locale if index.nil?
38
+
39
+ get_best_match(locale[0...index])
40
+ end
41
+ end
42
+
43
+ def self.get_source_locale
44
+ 'en'
45
+ end
46
+
47
+ def self.get_default_locale
48
+ env = SgtnClient::Config.default_environment
49
+ SgtnClient::Config.configurations[env]['default_language']
50
+ end
51
+
52
+ def self.get_fallback_locale
53
+ @fallback_locale ||= get_default_locale || get_source_locale || 'en'
54
+ end
55
+
56
+ def self.lowercase_locales_map
57
+ @lowercase_locales_map ||= Config.available_locales.each_with_object({}) do |locale, memo|
58
+ memo[locale.to_s.downcase] = locale
59
+ end
60
+ end
61
+
62
+ def self.reset_available_locales(type)
63
+ @lowercase_locales_map = nil if type == :available_locales
64
+ end
65
+
66
+ SgtnClient::Config.add_observer(self, :reset_available_locales)
67
+
68
+ private_class_method :get_best_match, :lowercase_locales_map, :reset_available_locales
69
+ end
70
+ end
@@ -0,0 +1,12 @@
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
3
+
4
+ module SgtnClient
5
+ class StringUtil < String
6
+ def initialize(str, locale)
7
+ super(str)
8
+ @locale = locale
9
+ end
10
+ attr_accessor :locale
11
+ end
12
+ end
@@ -1,3 +1,5 @@
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
1
3
 
2
4
  module SgtnClient
3
5
 
@@ -12,12 +14,7 @@ module SgtnClient
12
14
  if mode != 'sandbox' && mode != 'live'
13
15
  messages = messages + "Configuration[mode] has to be 'sandbox' or 'live'!\n"
14
16
  end
15
-
16
- bundle_mode = SgtnClient::Config.configurations[env]["bundle_mode"]
17
- if bundle_mode != 'offline' && bundle_mode != 'online'
18
- messages = messages + "Configuration[bundle_mode] has to be 'offline' or 'online'!\n"
19
- end
20
-
17
+
21
18
  #version = SgtnClient::Config.configurations[env]["version"]
22
19
  #if version.is_a? Integer
23
20
  #messages = messages + "Configuration[version] has to be standard as '#.#.#, e.g '1.0.0'!\n"
@@ -40,4 +37,4 @@ module SgtnClient
40
37
 
41
38
  end
42
39
 
43
- end
40
+ end
@@ -0,0 +1,15 @@
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
3
+
4
+ require_relative 'singleton-ruby'
5
+
6
+ module Sgtn # :nodoc:
7
+ # load configuration from a file
8
+ def self.load_config(*args)
9
+ SgtnClient.load(*args)
10
+ end
11
+
12
+ extend SgtnClient::Translation::Implementation
13
+
14
+ private_class_method :getString, :getString_p, :getString_f, :getStrings
15
+ end
@@ -1,3 +1,8 @@
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
3
+
1
4
  require "sgtn-client/sgtn-client"
2
5
  require 'sgtn-client/cldr/core_ext'
3
6
  require 'twitter_cldr'
7
+
8
+ require 'sgtn-client/exceptions.rb'
data/lib/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # Copyright 2022 VMware, Inc.
2
+ # SPDX-License-Identifier: EPL-2.0
1
3
 
2
4
  VERSION_INFO = [0, 2, 1].freeze
3
5
  VERSION = VERSION_INFO.map(&:to_s).join('.').freeze
metadata CHANGED
@@ -1,85 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: singleton-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware G11n Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-15 00:00:00.000000000 Z
11
+ date: 2022-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rest-client
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
27
- - !ruby/object:Gem::Dependency
28
- name: multi_json
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.0'
41
- - !ruby/object:Gem::Dependency
42
- name: request_store
14
+ name: rdoc
43
15
  requirement: !ruby/object:Gem::Requirement
44
16
  requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.1'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
17
+ - - ">="
53
18
  - !ruby/object:Gem::Version
54
- version: '1.1'
55
- - !ruby/object:Gem::Dependency
56
- name: twitter_cldr
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
19
+ version: 2.4.2
20
+ - - "<"
60
21
  - !ruby/object:Gem::Version
61
- version: '6.6'
22
+ version: '6.0'
62
23
  type: :development
63
24
  prerelease: false
64
25
  version_requirements: !ruby/object:Gem::Requirement
65
26
  requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '6.6'
69
- - !ruby/object:Gem::Dependency
70
- name: webmock
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
27
+ - - ">="
74
28
  - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
29
+ version: 2.4.2
30
+ - - "<"
81
31
  - !ruby/object:Gem::Version
82
- version: '2.0'
32
+ version: '6.0'
83
33
  - !ruby/object:Gem::Dependency
84
34
  name: rspec
85
35
  requirement: !ruby/object:Gem::Requirement
@@ -94,54 +44,6 @@ dependencies:
94
44
  - - "~>"
95
45
  - !ruby/object:Gem::Version
96
46
  version: '3.0'
97
- - !ruby/object:Gem::Dependency
98
- name: pry
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: pry-doc
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rdoc
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: 2.4.2
132
- - - "<"
133
- - !ruby/object:Gem::Version
134
- version: '6.0'
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- version: 2.4.2
142
- - - "<"
143
- - !ruby/object:Gem::Version
144
- version: '6.0'
145
47
  - !ruby/object:Gem::Dependency
146
48
  name: rubocop
147
49
  requirement: !ruby/object:Gem::Requirement
@@ -157,93 +59,75 @@ dependencies:
157
59
  - !ruby/object:Gem::Version
158
60
  version: '0.49'
159
61
  - !ruby/object:Gem::Dependency
160
- name: http-accept
62
+ name: webmock
161
63
  requirement: !ruby/object:Gem::Requirement
162
64
  requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- version: 1.7.0
166
- - - "<"
65
+ - - "~>"
167
66
  - !ruby/object:Gem::Version
168
67
  version: '2.0'
169
- type: :runtime
68
+ type: :development
170
69
  prerelease: false
171
70
  version_requirements: !ruby/object:Gem::Requirement
172
71
  requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- version: 1.7.0
176
- - - "<"
72
+ - - "~>"
177
73
  - !ruby/object:Gem::Version
178
74
  version: '2.0'
179
75
  - !ruby/object:Gem::Dependency
180
- name: http-cookie
76
+ name: faraday
181
77
  requirement: !ruby/object:Gem::Requirement
182
78
  requirements:
183
79
  - - ">="
184
80
  - !ruby/object:Gem::Version
185
- version: 1.0.2
186
- - - "<"
187
- - !ruby/object:Gem::Version
188
- version: '2.0'
81
+ version: '0'
189
82
  type: :runtime
190
83
  prerelease: false
191
84
  version_requirements: !ruby/object:Gem::Requirement
192
85
  requirements:
193
86
  - - ">="
194
87
  - !ruby/object:Gem::Version
195
- version: 1.0.2
196
- - - "<"
197
- - !ruby/object:Gem::Version
198
- version: '2.0'
88
+ version: '0'
199
89
  - !ruby/object:Gem::Dependency
200
- name: mime-types
90
+ name: faraday_middleware
201
91
  requirement: !ruby/object:Gem::Requirement
202
92
  requirements:
203
93
  - - ">="
204
94
  - !ruby/object:Gem::Version
205
- version: '1.16'
206
- - - "<"
207
- - !ruby/object:Gem::Version
208
- version: '4.0'
95
+ version: '0'
209
96
  type: :runtime
210
97
  prerelease: false
211
98
  version_requirements: !ruby/object:Gem::Requirement
212
99
  requirements:
213
100
  - - ">="
214
101
  - !ruby/object:Gem::Version
215
- version: '1.16'
216
- - - "<"
217
- - !ruby/object:Gem::Version
218
- version: '4.0'
102
+ version: '0'
219
103
  - !ruby/object:Gem::Dependency
220
- name: netrc
104
+ name: multi_json
221
105
  requirement: !ruby/object:Gem::Requirement
222
106
  requirements:
223
107
  - - "~>"
224
108
  - !ruby/object:Gem::Version
225
- version: '0.8'
109
+ version: '1.0'
226
110
  type: :runtime
227
111
  prerelease: false
228
112
  version_requirements: !ruby/object:Gem::Requirement
229
113
  requirements:
230
114
  - - "~>"
231
115
  - !ruby/object:Gem::Version
232
- version: '0.8'
116
+ version: '1.0'
233
117
  - !ruby/object:Gem::Dependency
234
- name: multi_json
118
+ name: request_store
235
119
  requirement: !ruby/object:Gem::Requirement
236
120
  requirements:
237
- - - "~>"
121
+ - - ">="
238
122
  - !ruby/object:Gem::Version
239
- version: '1.0'
123
+ version: '0'
240
124
  type: :runtime
241
125
  prerelease: false
242
126
  version_requirements: !ruby/object:Gem::Requirement
243
127
  requirements:
244
- - - "~>"
128
+ - - ">="
245
129
  - !ruby/object:Gem::Version
246
- version: '1.0'
130
+ version: '0'
247
131
  - !ruby/object:Gem::Dependency
248
132
  name: twitter_cldr
249
133
  requirement: !ruby/object:Gem::Requirement
@@ -274,17 +158,29 @@ files:
274
158
  - lib/sgtn-client/cldr/localized_datetime.rb
275
159
  - lib/sgtn-client/cldr/localized_str.rb
276
160
  - lib/sgtn-client/cldr/localized_time.rb
161
+ - lib/sgtn-client/common/data.rb
162
+ - lib/sgtn-client/common/single_operation.rb
277
163
  - lib/sgtn-client/core/cache.rb
278
164
  - lib/sgtn-client/core/config.rb
279
165
  - lib/sgtn-client/core/exceptions.rb
280
166
  - lib/sgtn-client/core/logging.rb
281
- - lib/sgtn-client/core/request.rb
167
+ - lib/sgtn-client/exceptions.rb
282
168
  - lib/sgtn-client/formatters/plurals/plural_formatter.rb
169
+ - lib/sgtn-client/loader/cache.rb
170
+ - lib/sgtn-client/loader/chain_loader.rb
171
+ - lib/sgtn-client/loader/consts.rb
172
+ - lib/sgtn-client/loader/loader_factory.rb
173
+ - lib/sgtn-client/loader/local_translation.rb
174
+ - lib/sgtn-client/loader/server.rb
175
+ - lib/sgtn-client/loader/single_loader.rb
176
+ - lib/sgtn-client/loader/source.rb
177
+ - lib/sgtn-client/loader/source_comparer.rb
283
178
  - lib/sgtn-client/sgtn-client.rb
284
179
  - lib/sgtn-client/util/cache-util.rb
285
- - lib/sgtn-client/util/file-util.rb
286
180
  - lib/sgtn-client/util/locale-util.rb
181
+ - lib/sgtn-client/util/string-util.rb
287
182
  - lib/sgtn-client/util/validate-util.rb
183
+ - lib/singleton-client.rb
288
184
  - lib/singleton-ruby.rb
289
185
  - lib/version.rb
290
186
  homepage: https://github.com/vmware/singleton
@@ -1,21 +0,0 @@
1
- require 'rest-client'
2
- require 'multi_json'
3
-
4
- module SgtnClient::Core
5
- class Request
6
- def self.get(url)
7
- SgtnClient.logger.debug "[Request][get]url=#{url}"
8
- res = RestClient::Resource.new(
9
- url,
10
- :verify_ssl => false
11
- ).get
12
- begin
13
- obj = MultiJson.load(res)
14
- rescue MultiJson::ParseError => exception
15
- exception.data
16
- exception.cause
17
- end
18
- return obj
19
- end
20
- end
21
- end