singleton-client 0.7.3 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
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 +84 -115
  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 +15 -82
  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 -2
  29. data/lib/sgtn-client/util/cache-util.rb +33 -41
  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 +5 -9
  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 -32
@@ -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
- #res = RestClient.get(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
@@ -1,32 +0,0 @@
1
- require 'erb'
2
- require 'yaml'
3
-
4
- module SgtnClient
5
-
6
- class FileUtil
7
-
8
- @mutex = Mutex.new
9
-
10
- def self.read_json(bundlepath)
11
- @mutex.synchronize do
12
- data_hash = nil
13
- begin
14
- file = File.read(bundlepath)
15
- data_hash = MultiJson.load(file)
16
- rescue => exception
17
- SgtnClient.logger.error exception.message
18
- end
19
- return data_hash
20
- end
21
- end
22
-
23
- def self.read_yml(file_name)
24
- @mutex.synchronize do
25
- erb = ERB.new(File.read(file_name))
26
- erb.filename = file_name
27
- YAML.load(erb.result)
28
- end
29
- end
30
- end
31
-
32
- end