singleton-cldr-rb 0.0.1
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 +7 -0
- data/Gemfile +18 -0
- data/README.md +11 -0
- data/Rakefile +140 -0
- data/lib/sgtn-cldr/cldr/core_ext.rb +3 -0
- data/lib/sgtn-cldr/cldr/localized_date.rb +27 -0
- data/lib/sgtn-cldr/cldr/localized_datetime.rb +33 -0
- data/lib/sgtn-cldr/cldr/localized_time.rb +27 -0
- data/lib/sgtn-cldr/core/cache.rb +83 -0
- data/lib/sgtn-cldr/core/config.rb +173 -0
- data/lib/sgtn-cldr/core/exceptions.rb +112 -0
- data/lib/sgtn-cldr/core/logging.rb +50 -0
- data/lib/sgtn-cldr/core/request.rb +17 -0
- data/lib/sgtn-cldr/sgtn-cldr.rb +70 -0
- data/lib/sgtn-cldr/util/cache-util.rb +35 -0
- data/lib/sgtn-cldr/util/validate-util.rb +44 -0
- data/lib/singleton-cldr.rb +2 -0
- data/lib/version.rb +3 -0
- data/spec/config/sgtncldr.yml +48 -0
- data/spec/log/http.log +0 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/support/sample_data.rb +5 -0
- data/spec/unit/datetime_spec.rb +43 -0
- metadata +318 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d897c4259e62a3870f5419a4bad6914633965a0b8cd6a741a9a42dac05f7d4ac
|
4
|
+
data.tar.gz: 402f7feb2f29491c9a12ce0e461f3002089ab52fbdcbf1ed943a33ba69fab143
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28050e1bbf67294d39f944ea128d7ca0c3b6c844e66a084c1bb45b93761a2d0400a799b2ac0d8708b53586181c78dd062bed85609710d7eb8ecf4650df131f7c
|
7
|
+
data.tar.gz: 36d61f9eb159631a25052f7572d0a8a5c2559f530251c410086324a1fc7bb8f9d2f70c0c4c5fdced20ad46a3f488b88edfe03fe14215d2dd46f49ed08b6a9ba4
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
if !!File::ALT_SEPARATOR
|
4
|
+
gemspec :name => 'singleton-cldr-rb.windows'
|
5
|
+
else
|
6
|
+
gemspec :name => 'singleton-cldr-rb'
|
7
|
+
end
|
8
|
+
|
9
|
+
gem 'rake', :require => false
|
10
|
+
|
11
|
+
group :test do
|
12
|
+
gem 'simplecov', :require => false
|
13
|
+
gem 'rspec'
|
14
|
+
gem 'webmock'
|
15
|
+
end
|
16
|
+
|
17
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
|
18
|
+
#gem 'releasinator', '~> 0.6'
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
# load `rake build/install/release tasks'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require_relative './lib/version'
|
4
|
+
|
5
|
+
namespace :ruby do
|
6
|
+
Bundler::GemHelper.install_tasks(:name => 'singleton-cldr')
|
7
|
+
end
|
8
|
+
|
9
|
+
require "rspec/core/rake_task"
|
10
|
+
|
11
|
+
desc "Run all specs"
|
12
|
+
RSpec::Core::RakeTask.new('spec')
|
13
|
+
|
14
|
+
desc "Run unit specs"
|
15
|
+
RSpec::Core::RakeTask.new('spec:unit') do |t|
|
16
|
+
t.pattern = 'spec/unit/*_spec.rb'
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Run integration specs"
|
20
|
+
RSpec::Core::RakeTask.new('spec:integration') do |t|
|
21
|
+
t.pattern = 'spec/integration/*_spec.rb'
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Print specdocs"
|
25
|
+
RSpec::Core::RakeTask.new(:doc) do |t|
|
26
|
+
t.rspec_opts = ["--format", "specdoc", "--dry-run"]
|
27
|
+
t.pattern = 'spec/**/*_spec.rb'
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Run all examples with RCov"
|
31
|
+
RSpec::Core::RakeTask.new('rcov') do |t|
|
32
|
+
t.pattern = 'spec/*_spec.rb'
|
33
|
+
t.rcov = true
|
34
|
+
t.rcov_opts = ['--exclude', 'examples']
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Regenerate authors file'
|
38
|
+
task :authors do
|
39
|
+
Dir.chdir(File.dirname(__FILE__)) do
|
40
|
+
File.open('AUTHORS', 'w') do |f|
|
41
|
+
f.write <<-EOM
|
42
|
+
The Ruby REST Client would not be what it is today without the help of
|
43
|
+
the following kind souls:
|
44
|
+
|
45
|
+
EOM
|
46
|
+
end
|
47
|
+
|
48
|
+
sh 'git shortlog -s | cut -f 2 >> AUTHORS'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
task :default do
|
53
|
+
sh 'rake -T'
|
54
|
+
end
|
55
|
+
|
56
|
+
def alias_task(alias_task, original)
|
57
|
+
desc "Alias for rake #{original}"
|
58
|
+
task alias_task, Rake.application[original].arg_names => original
|
59
|
+
end
|
60
|
+
alias_task(:test, :spec)
|
61
|
+
|
62
|
+
############################
|
63
|
+
|
64
|
+
WindowsPlatforms = %w{x86-mingw32 x64-mingw32 x86-mswin32}
|
65
|
+
|
66
|
+
namespace :all do
|
67
|
+
|
68
|
+
desc "Build rest-client #{VERSION} for all platforms"
|
69
|
+
task :build => ['ruby:build'] + \
|
70
|
+
WindowsPlatforms.map {|p| "windows:#{p}:build"}
|
71
|
+
|
72
|
+
desc "Create tag v#{VERSION} and for all platforms build and " \
|
73
|
+
"push rest-client #{VERSION} to Rubygems"
|
74
|
+
task :release => ['build', 'ruby:release'] + \
|
75
|
+
WindowsPlatforms.map {|p| "windows:#{p}:push"}
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
namespace :windows do
|
80
|
+
spec_path = File.join(File.dirname(__FILE__), 'rest-client.windows.gemspec')
|
81
|
+
|
82
|
+
WindowsPlatforms.each do |platform|
|
83
|
+
namespace platform do
|
84
|
+
gem_filename = "rest-client-#{VERSION}-#{platform}.gem"
|
85
|
+
base = File.dirname(__FILE__)
|
86
|
+
pkg_dir = File.join(base, 'pkg')
|
87
|
+
gem_file_path = File.join(pkg_dir, gem_filename)
|
88
|
+
|
89
|
+
desc "Build #{gem_filename} into the pkg directory"
|
90
|
+
task 'build' do
|
91
|
+
orig_platform = ENV['BUILD_PLATFORM']
|
92
|
+
begin
|
93
|
+
ENV['BUILD_PLATFORM'] = platform
|
94
|
+
|
95
|
+
sh("gem build -V #{spec_path}") do |ok, res|
|
96
|
+
if ok
|
97
|
+
FileUtils.mkdir_p(pkg_dir)
|
98
|
+
FileUtils.mv(File.join(base, gem_filename), pkg_dir)
|
99
|
+
Bundler.ui.confirm("rest-client #{VERSION} " \
|
100
|
+
"built to pkg/#{gem_filename}")
|
101
|
+
else
|
102
|
+
abort "Command `gem build` failed: #{res}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
ensure
|
107
|
+
ENV['BUILD_PLATFORM'] = orig_platform
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
desc "Push #{gem_filename} to Rubygems"
|
112
|
+
task 'push' do
|
113
|
+
sh("gem push #{gem_file_path}")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
############################
|
121
|
+
|
122
|
+
require 'rdoc/task'
|
123
|
+
|
124
|
+
Rake::RDocTask.new do |t|
|
125
|
+
t.rdoc_dir = 'rdoc'
|
126
|
+
t.title = "rest-client, fetch RESTful resources effortlessly"
|
127
|
+
t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
128
|
+
t.options << '--charset' << 'utf-8'
|
129
|
+
t.rdoc_files.include('README.md')
|
130
|
+
t.rdoc_files.include('lib/*.rb')
|
131
|
+
end
|
132
|
+
|
133
|
+
############################
|
134
|
+
|
135
|
+
require 'rubocop/rake_task'
|
136
|
+
|
137
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
138
|
+
t.options = ['--display-cop-names']
|
139
|
+
end
|
140
|
+
alias_task(:lint, :rubocop)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
5
|
+
def to_full_s(locale = TwitterCldr.locale)
|
6
|
+
self.to_datetime().to_date().to_full_s
|
7
|
+
end
|
8
|
+
LOCALIZE
|
9
|
+
|
10
|
+
Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
11
|
+
def to_long_s(locale = TwitterCldr.locale)
|
12
|
+
self.to_datetime().to_date().to_long_s
|
13
|
+
end
|
14
|
+
LOCALIZE
|
15
|
+
|
16
|
+
Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
17
|
+
def to_medium_s(locale = TwitterCldr.locale)
|
18
|
+
self.to_datetime().to_date().to_medium_s
|
19
|
+
end
|
20
|
+
LOCALIZE
|
21
|
+
|
22
|
+
|
23
|
+
Date.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
24
|
+
def to_short_s(locale = TwitterCldr.locale)
|
25
|
+
self.to_datetime().to_date().to_short_s
|
26
|
+
end
|
27
|
+
LOCALIZE
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
5
|
+
def to_full_s(locale = TwitterCldr.locale)
|
6
|
+
self.localize(locale).to_full_s
|
7
|
+
end
|
8
|
+
LOCALIZE
|
9
|
+
|
10
|
+
DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
11
|
+
def to_long_s(locale = TwitterCldr.locale)
|
12
|
+
self.localize(locale).to_long_s
|
13
|
+
end
|
14
|
+
LOCALIZE
|
15
|
+
|
16
|
+
DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
17
|
+
def to_medium_s(locale = TwitterCldr.locale)
|
18
|
+
self.localize(locale).to_medium_s
|
19
|
+
end
|
20
|
+
LOCALIZE
|
21
|
+
|
22
|
+
|
23
|
+
DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
24
|
+
def to_short_s(locale = TwitterCldr.locale)
|
25
|
+
self.localize(locale).to_short_s
|
26
|
+
end
|
27
|
+
LOCALIZE
|
28
|
+
|
29
|
+
DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
30
|
+
def to_date(locale = TwitterCldr.locale)
|
31
|
+
self.localize(locale).to_date
|
32
|
+
end
|
33
|
+
LOCALIZE
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
5
|
+
def to_full_s(locale = TwitterCldr.locale)
|
6
|
+
self.localize(locale).to_full_s
|
7
|
+
end
|
8
|
+
LOCALIZE
|
9
|
+
|
10
|
+
Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
11
|
+
def to_long_s(locale = TwitterCldr.locale)
|
12
|
+
self.localize(locale).to_long_s
|
13
|
+
end
|
14
|
+
LOCALIZE
|
15
|
+
|
16
|
+
Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
17
|
+
def to_medium_s(locale = TwitterCldr.locale)
|
18
|
+
self.localize(locale).to_medium_s
|
19
|
+
end
|
20
|
+
LOCALIZE
|
21
|
+
|
22
|
+
|
23
|
+
Time.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
|
24
|
+
def to_short_s(locale = TwitterCldr.locale)
|
25
|
+
self.localize(locale).to_short_s
|
26
|
+
end
|
27
|
+
LOCALIZE
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module SgtnCldr::Core
|
4
|
+
class Cache
|
5
|
+
Entry = Struct.new(:expiry, :value)
|
6
|
+
|
7
|
+
def self.initialize(disabled=false, opts={})
|
8
|
+
$opts = opts
|
9
|
+
SgtnCldr.logger.debug "Initialize cache......"
|
10
|
+
if disabled == false
|
11
|
+
$data = Hash.new
|
12
|
+
SgtnCldr.logger.debug "Cache is enabled!"
|
13
|
+
else
|
14
|
+
SgtnCldr.logger.debug "Cache is disabled!"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.keys
|
19
|
+
if $data == nil
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
SgtnCldr.logger.debug "Get cache keys"
|
23
|
+
$data.keys
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.get(key)
|
27
|
+
if $data == nil
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
SgtnCldr.logger.debug "Get cache for key: " + key
|
31
|
+
invalidate
|
32
|
+
$data[key][:value] if has(key)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.has(key)
|
36
|
+
if $data == nil
|
37
|
+
return nil
|
38
|
+
end
|
39
|
+
SgtnCldr.logger.debug "Has cache for key: " + key
|
40
|
+
$data.has_key? key
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.put(key, value, ttl=nil)
|
44
|
+
if $data == nil
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
ttl ||= @opts[:ttl]
|
48
|
+
# hours from new
|
49
|
+
SgtnCldr.logger.debug "Put cache for key '" + key + "' with expired time at'" + (Time.now + ttl*60).to_s
|
50
|
+
$data[key] = Entry.new(Time.now + ttl*60, value)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.delete(key)
|
54
|
+
if $data == nil
|
55
|
+
return nil
|
56
|
+
end
|
57
|
+
SgtnCldr.logger.debug "Delete cache for key: " + key
|
58
|
+
$data.delete key
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.clear
|
62
|
+
if $data == nil
|
63
|
+
return nil
|
64
|
+
end
|
65
|
+
SgtnCldr.logger.debug "Clear cache!"
|
66
|
+
$data = Hash.new
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.invalidate
|
70
|
+
if $data == nil
|
71
|
+
return nil
|
72
|
+
end
|
73
|
+
SgtnCldr.logger.debug "Invalidating expired cache......"
|
74
|
+
now = Time.now
|
75
|
+
$data.each {
|
76
|
+
|k, v|
|
77
|
+
SgtnCldr.logger.debug "Checking cache: key=#{k}, expiredtime=#{v[:expiry]}, now=#{now}, expired=#{(v[:expiry] < now)}"
|
78
|
+
}
|
79
|
+
$data.delete_if {|k, v| v[:expiry] < now}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module SgtnCldr
|
5
|
+
#include Exceptions
|
6
|
+
module Configuration
|
7
|
+
|
8
|
+
def config
|
9
|
+
@config ||= Config.config
|
10
|
+
end
|
11
|
+
|
12
|
+
def set_config(env, override_configurations = {})
|
13
|
+
@config =
|
14
|
+
case env
|
15
|
+
when Config
|
16
|
+
env
|
17
|
+
when Hash
|
18
|
+
begin
|
19
|
+
config.dup.merge!(env)
|
20
|
+
rescue Errno::ENOENT => error
|
21
|
+
Config.new(env)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
Config.config(env, override_configurations)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
alias_method :config=, :set_config
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
class Config
|
34
|
+
|
35
|
+
attr_accessor :username, :password, :signature, :app_id, :cert_path,
|
36
|
+
:token, :token_secret, :subject,
|
37
|
+
:http_timeout, :http_proxy,
|
38
|
+
:device_ipaddress, :sandbox_email_address,
|
39
|
+
:mode, :endpoint, :merchant_endpoint, :platform_endpoint, :ipn_endpoint,
|
40
|
+
:rest_endpoint, :rest_token_endpoint, :client_id, :client_secret,
|
41
|
+
:openid_endpoint, :openid_redirect_uri, :openid_client_id, :openid_client_secret,
|
42
|
+
:verbose_logging, :product_name, :version, :vip_server, :bundle_mode,
|
43
|
+
:translation_bundle, :source_bundle, :cache_expiry_period, :disable_cache
|
44
|
+
|
45
|
+
|
46
|
+
# Create Config object
|
47
|
+
# === Options(Hash)
|
48
|
+
# * <tt>username</tt> -- Username
|
49
|
+
# * <tt>password</tt> -- Password
|
50
|
+
# * <tt>signature</tt> (Optional if certificate present) -- Signature
|
51
|
+
# * <tt>app_id</tt> -- Application ID
|
52
|
+
# * <tt>cert_path</tt> (Optional if signature present) -- Certificate file path
|
53
|
+
def initialize(options)
|
54
|
+
merge!(options)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Override configurations
|
58
|
+
def merge!(options)
|
59
|
+
options.each do |key, value|
|
60
|
+
send("#{key}=", value)
|
61
|
+
end
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
65
|
+
class << self
|
66
|
+
|
67
|
+
@@config_cache = {}
|
68
|
+
|
69
|
+
# Load configurations from file
|
70
|
+
# === Arguments
|
71
|
+
# * <tt>file_name</tt> -- Configuration file path
|
72
|
+
# * <tt>default_environment</tt> (Optional) -- default environment configuration to load
|
73
|
+
# === Example
|
74
|
+
# Config.load('config/paypal.yml', 'development')
|
75
|
+
def load(file_name, default_env = default_environment)
|
76
|
+
@@config_cache = {}
|
77
|
+
@@configurations = read_configurations(file_name)
|
78
|
+
@@default_environment = default_env
|
79
|
+
config
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
# Get default environment name
|
84
|
+
def default_environment
|
85
|
+
@@default_environment ||= ENV['SGTN_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || "development"
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
# Set default environment
|
90
|
+
def default_environment=(env)
|
91
|
+
@@default_environment = env.to_s
|
92
|
+
end
|
93
|
+
|
94
|
+
def configure(options = {}, &block)
|
95
|
+
begin
|
96
|
+
self.config.merge!(options)
|
97
|
+
rescue Errno::ENOENT
|
98
|
+
self.configurations = { default_environment => options }
|
99
|
+
end
|
100
|
+
block.call(self.config) if block
|
101
|
+
self.config
|
102
|
+
end
|
103
|
+
alias_method :set_config, :configure
|
104
|
+
|
105
|
+
# Create or Load Config object based on given environment and configurations.
|
106
|
+
# === Attributes
|
107
|
+
# * <tt>env</tt> (Optional) -- Environment name
|
108
|
+
# * <tt>override_configuration</tt> (Optional) -- Override the configuration given in file.
|
109
|
+
# === Example
|
110
|
+
# Config.config
|
111
|
+
# Config.config(:development)
|
112
|
+
# Config.config(:development, { :app_id => "XYZ" })
|
113
|
+
def config(env = default_environment, override_configuration = {})
|
114
|
+
if env.is_a? Hash
|
115
|
+
override_configuration = env
|
116
|
+
env = default_environment
|
117
|
+
end
|
118
|
+
if override_configuration.nil? or override_configuration.empty?
|
119
|
+
default_config(env)
|
120
|
+
else
|
121
|
+
default_config(env).dup.merge!(override_configuration)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def default_config(env = nil)
|
126
|
+
env = (env || default_environment).to_s
|
127
|
+
if configurations[env]
|
128
|
+
@@config_cache[env] ||= new(configurations[env])
|
129
|
+
else
|
130
|
+
raise SgtnClient::Exceptions::MissingConfig.new("Configuration[#{env}] NotFound")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Get raw configurations in Hash format.
|
135
|
+
def configurations
|
136
|
+
@@configurations ||= read_configurations
|
137
|
+
end
|
138
|
+
|
139
|
+
# Set configuration
|
140
|
+
def configurations=(configs)
|
141
|
+
@@config_cache = {}
|
142
|
+
@@configurations = configs && Hash[configs.map{|k,v| [k.to_s, v] }]
|
143
|
+
end
|
144
|
+
|
145
|
+
# Set logger
|
146
|
+
def logger=(logger)
|
147
|
+
Logging.logger = logger
|
148
|
+
end
|
149
|
+
|
150
|
+
# Get logger
|
151
|
+
def logger
|
152
|
+
if @@configurations[:mode] == 'live' and Logging.logger.level == Logger::DEBUG
|
153
|
+
Logging.logger.warn "DEBUG log level not allowed in live mode for security of confidential information. Changing log level to INFO..."
|
154
|
+
Logging.logger.level = Logger::INFO
|
155
|
+
end
|
156
|
+
Logging.logger
|
157
|
+
end
|
158
|
+
|
159
|
+
private
|
160
|
+
# Read configurations from the given file name
|
161
|
+
# === Arguments
|
162
|
+
# * <tt>file_name</tt> (Optional) -- Configuration file path
|
163
|
+
def read_configurations(file_name = "config/sgtnclient.yml")
|
164
|
+
erb = ERB.new(File.read(file_name))
|
165
|
+
erb.filename = file_name
|
166
|
+
YAML.load(erb.result)
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
module SgtnCldr
|
5
|
+
module Exceptions
|
6
|
+
class ConnectionError < StandardError # :nodoc:
|
7
|
+
attr_reader :response
|
8
|
+
|
9
|
+
def initialize(response, message = nil)
|
10
|
+
@response = response
|
11
|
+
@message = message
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
begin
|
16
|
+
response_body = JSON.parse(response.body)
|
17
|
+
debug_id = response["paypal-debug-id"]
|
18
|
+
debug_id = response["correlation-id"] if debug_id.to_s == ''
|
19
|
+
debug_id = response_body["debug_id"] if debug_id.to_s == ''
|
20
|
+
rescue
|
21
|
+
end
|
22
|
+
message = "Failed."
|
23
|
+
message << " Response code = #{response.code}." if response.respond_to?(:code)
|
24
|
+
message << " Response message = #{response.message}." if response.respond_to?(:message)
|
25
|
+
message << " Response debug ID = #{debug_id}." if debug_id
|
26
|
+
message
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Raised when a Timeout::Error occurs.
|
31
|
+
class TimeoutError < ConnectionError
|
32
|
+
def initialize(message)
|
33
|
+
@message = message
|
34
|
+
end
|
35
|
+
def to_s; @message ;end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Raised when a OpenSSL::SSL::SSLError occurs.
|
39
|
+
class SSLError < ConnectionError
|
40
|
+
def initialize(message)
|
41
|
+
@message = message
|
42
|
+
end
|
43
|
+
def to_s; @message ;end
|
44
|
+
end
|
45
|
+
|
46
|
+
# 3xx Redirection
|
47
|
+
class Redirection < ConnectionError # :nodoc:
|
48
|
+
def to_s
|
49
|
+
response['Location'] ? "#{super} => #{response['Location']}" : super
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class MissingParam < ArgumentError # :nodoc:
|
54
|
+
end
|
55
|
+
|
56
|
+
class MissingConfig < StandardError # :nodoc:
|
57
|
+
end
|
58
|
+
|
59
|
+
# 4xx Client Error
|
60
|
+
class ClientError < ConnectionError # :nodoc:
|
61
|
+
end
|
62
|
+
|
63
|
+
# 400 Bad Request
|
64
|
+
class BadRequest < ClientError # :nodoc:
|
65
|
+
end
|
66
|
+
|
67
|
+
# 401 Unauthorized
|
68
|
+
class UnauthorizedAccess < ClientError # :nodoc:
|
69
|
+
end
|
70
|
+
|
71
|
+
# 403 Forbidden
|
72
|
+
class ForbiddenAccess < ClientError # :nodoc:
|
73
|
+
end
|
74
|
+
|
75
|
+
# 404 Not Found
|
76
|
+
class ResourceNotFound < ClientError # :nodoc:
|
77
|
+
end
|
78
|
+
|
79
|
+
# 409 Conflict
|
80
|
+
class ResourceConflict < ClientError # :nodoc:
|
81
|
+
end
|
82
|
+
|
83
|
+
# 410 Gone
|
84
|
+
class ResourceGone < ClientError # :nodoc:
|
85
|
+
end
|
86
|
+
|
87
|
+
# 422 Unprocessable Entity
|
88
|
+
class ResourceInvalid < ClientError # :nodoc:
|
89
|
+
end
|
90
|
+
|
91
|
+
# 5xx Server Error
|
92
|
+
class ServerError < ConnectionError # :nodoc:
|
93
|
+
end
|
94
|
+
|
95
|
+
# 405 Method Not Allowed
|
96
|
+
class MethodNotAllowed < ClientError # :nodoc:
|
97
|
+
def allowed_methods
|
98
|
+
@response['Allow'].split(',').map { |verb| verb.strip.downcase.to_sym }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# API error: returned as 200 + "error" key in response.
|
103
|
+
class UnsuccessfulApiCall < RuntimeError
|
104
|
+
attr_reader :api_error
|
105
|
+
|
106
|
+
def initialize(api_error)
|
107
|
+
super(api_error['message'])
|
108
|
+
@api_error = api_error
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module SgtnCldr
|
4
|
+
|
5
|
+
# Include Logging module to provide logger functionality.
|
6
|
+
# == Configure logger
|
7
|
+
# Logging.logger = Logger.new(STDERR)
|
8
|
+
#
|
9
|
+
# == Example
|
10
|
+
# include Logger
|
11
|
+
# logger.info "Debug message"
|
12
|
+
module Logging
|
13
|
+
|
14
|
+
# Get logger object
|
15
|
+
def logger
|
16
|
+
@logger ||= Logging.logger
|
17
|
+
end
|
18
|
+
|
19
|
+
def log_event(message, &block)
|
20
|
+
start_time = Time.now
|
21
|
+
block.call
|
22
|
+
ensure
|
23
|
+
logger.info sprintf("[%.3fs] %s", Time.now - start_time, message)
|
24
|
+
end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
|
28
|
+
# Get or Create configured logger based on the default environment configuration
|
29
|
+
def logger
|
30
|
+
@logger ||= Logger.new(STDERR)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Set logger directly and clear the loggers cache.
|
34
|
+
# === Attributes
|
35
|
+
# * <tt>logger</tt> -- Logger object
|
36
|
+
# === Example
|
37
|
+
# Logging.logger = Logger.new(STDERR)
|
38
|
+
def logger=(logger)
|
39
|
+
@logger = logger
|
40
|
+
if Config.config.mode.eql? 'live' and @logger.level == Logger::DEBUG
|
41
|
+
@logger.warn "DEBUG log level not allowed in live mode for security of confidential information. Changing log level to INFO..."
|
42
|
+
@logger.level = Logger::INFO
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module SgtnCldr::Core
|
5
|
+
class Request
|
6
|
+
def self.get(url)
|
7
|
+
res = RestClient.get(url)
|
8
|
+
begin
|
9
|
+
obj = MultiJson.load(res)
|
10
|
+
rescue MultiJson::ParseError => exception
|
11
|
+
exception.data
|
12
|
+
exception.cause
|
13
|
+
end
|
14
|
+
return obj
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module SgtnCldr
|
2
|
+
module Core
|
3
|
+
autoload :Cache, "sgtn-cldr/core/cache"
|
4
|
+
end
|
5
|
+
|
6
|
+
autoload :Translation, "sgtn-cldr/api/translation"
|
7
|
+
autoload :Source, "sgtn-cldr/api/source"
|
8
|
+
autoload :Config, "sgtn-cldr/core/config"
|
9
|
+
autoload :Logging, "sgtn-cldr/core/logging"
|
10
|
+
autoload :Exceptions, "sgtn-cldr/core/exceptions"
|
11
|
+
autoload :ValidateUtil, "sgtn-cldr/util/validate-util"
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def configure(options = {}, &block)
|
15
|
+
SgtnCldr::Config.configure(options, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
include Logging
|
19
|
+
def load(*args)
|
20
|
+
# load configuration file
|
21
|
+
begin
|
22
|
+
SgtnCldr::Config.load(args[0], args[1])
|
23
|
+
SgtnCldr::ValidateUtil.validate_config()
|
24
|
+
rescue => exception
|
25
|
+
file = File.open('./error.log', 'a')
|
26
|
+
file.sync = true
|
27
|
+
log = Logger.new(file)
|
28
|
+
log.error exception.message
|
29
|
+
end
|
30
|
+
|
31
|
+
# create log file
|
32
|
+
file = './sgtncldr_d.log'
|
33
|
+
if args[2] != nil
|
34
|
+
file = args[2]
|
35
|
+
end
|
36
|
+
file = File.open(file, 'a')
|
37
|
+
file.sync = true
|
38
|
+
SgtnCldr.logger = Logger.new(file)
|
39
|
+
|
40
|
+
# Set log level for sandbox mode
|
41
|
+
env = SgtnCldr::Config.default_environment
|
42
|
+
mode = SgtnCldr::Config.configurations[env]["mode"]
|
43
|
+
SgtnCldr.logger.info "Current mode is: " + mode
|
44
|
+
if mode == 'sandbox'
|
45
|
+
SgtnCldr.logger.level = Logger::DEBUG
|
46
|
+
else
|
47
|
+
SgtnCldr.logger.level = Logger::INFO
|
48
|
+
end
|
49
|
+
|
50
|
+
# initialize cache
|
51
|
+
disable_cache = SgtnCldr::Config.configurations[env]["disable_cache"]
|
52
|
+
if disable_cache != nil
|
53
|
+
SgtnCldr::Core::Cache.initialize(disable_cache)
|
54
|
+
else
|
55
|
+
SgtnCldr::Core::Cache.initialize()
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def logger
|
60
|
+
SgtnCldr::Config.logger
|
61
|
+
end
|
62
|
+
|
63
|
+
def logger=(log)
|
64
|
+
SgtnCldr::Config.logger = log
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
require 'sgtn-cldr/cldr/core_ext'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module SgtnCldr
|
5
|
+
|
6
|
+
module Core
|
7
|
+
autoload :Cache, "sgtn-cldr/core/cache"
|
8
|
+
end
|
9
|
+
|
10
|
+
class CacheUtil
|
11
|
+
|
12
|
+
def self.get_cache(cache_key)
|
13
|
+
items = SgtnCldr::Core::Cache.get(cache_key)
|
14
|
+
return items
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.write_cache(cache_key, items)
|
18
|
+
env = SgtnCldr::Config.default_environment
|
19
|
+
cache_expiry_period = SgtnCldr::Config.configurations[env]["cache_expiry_period"]
|
20
|
+
# expired after 24 hours
|
21
|
+
if cache_expiry_period == nil
|
22
|
+
cache_expiry_period = 24*60
|
23
|
+
end
|
24
|
+
SgtnCldr::Core::Cache.put(cache_key, items, cache_expiry_period)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.get_cachekey(component, locale)
|
28
|
+
env = SgtnCldr::Config.default_environment
|
29
|
+
product_name = SgtnCldr::Config.configurations[env]["product_name"]
|
30
|
+
version = SgtnCldr::Config.configurations[env]["version"].to_s
|
31
|
+
return product_name + "_" + version + "_" + component + "_" + locale
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
module SgtnCldr
|
3
|
+
|
4
|
+
class ValidateUtil
|
5
|
+
|
6
|
+
def self.validate_config()
|
7
|
+
SgtnCldr.logger.debug "-----------Start to validate configuration's setting itmes-----------"
|
8
|
+
env = SgtnCldr::Config.default_environment
|
9
|
+
messages = "\n"
|
10
|
+
|
11
|
+
mode = SgtnCldr::Config.configurations[env]["mode"]
|
12
|
+
if mode != 'sandbox' && mode != 'live'
|
13
|
+
messages = messages + "Configuration[mode] has to be 'sandbox' or 'live'!\n"
|
14
|
+
end
|
15
|
+
|
16
|
+
bundle_mode = SgtnCldr::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
|
+
|
21
|
+
#version = SgtnClient::Config.configurations[env]["version"]
|
22
|
+
#if version.is_a? Integer
|
23
|
+
#messages = messages + "Configuration[version] has to be standard as '#.#.#, e.g '1.0.0'!\n"
|
24
|
+
#end
|
25
|
+
|
26
|
+
cache_expiry_period = SgtnCldr::Config.configurations[env]["cache_expiry_period"]
|
27
|
+
if cache_expiry_period != nil && (cache_expiry_period.is_a? Integer) == false
|
28
|
+
messages = messages + "Configuration[cache_expiry_period] has to be a number!\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
disable_cache = SgtnCldr::Config.configurations[env]["disable_cache"]
|
32
|
+
if disable_cache != nil && disable_cache != false && disable_cache != true
|
33
|
+
messages = messages + "Configuration[disable_cache] has to be a 'true' or 'false'!\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
if messages != "\n"
|
37
|
+
raise SgtnCldr::Exceptions::MissingConfig.new(messages)
|
38
|
+
end
|
39
|
+
SgtnCldr.logger.debug "-----------End to validate configuration's setting itmes-----------"
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/lib/version.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
test: &default
|
2
|
+
|
3
|
+
# Credentials for REST APIs
|
4
|
+
client_id: tee
|
5
|
+
client_secret: 89987
|
6
|
+
|
7
|
+
# Mode can be 'live' or 'sandbox'
|
8
|
+
mode: sandbox
|
9
|
+
|
10
|
+
# Credentials for Classic APIs
|
11
|
+
app_id: APP-80W284485P519543T
|
12
|
+
username: linr
|
13
|
+
password: fdasf
|
14
|
+
signature: sfds-RWy
|
15
|
+
# # With Certificate
|
16
|
+
# cert_path: "config/cert_key.pem"
|
17
|
+
sandbox_email_address: linr@vmware.com
|
18
|
+
|
19
|
+
# #Product Name
|
20
|
+
product_name: logInsight
|
21
|
+
|
22
|
+
# # bundle version
|
23
|
+
version: 4.8.1
|
24
|
+
|
25
|
+
# # HTTP Proxy
|
26
|
+
vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
|
27
|
+
|
28
|
+
# # mode of bundle: online/offline
|
29
|
+
bundle_mode: offline
|
30
|
+
|
31
|
+
# # translation bundle Path
|
32
|
+
translation_bundle: ./spec/config/locales/l10n/bundles
|
33
|
+
|
34
|
+
# # source bundle Path
|
35
|
+
source_bundle: ./spec/config/locales/default
|
36
|
+
|
37
|
+
# # memory cache's expration(minutes), default value is 24*60
|
38
|
+
cache_expiry_period: 10
|
39
|
+
|
40
|
+
# # disable cache, it's optional setting
|
41
|
+
##disable_cache: true
|
42
|
+
|
43
|
+
development:
|
44
|
+
<<: *default
|
45
|
+
|
46
|
+
production:
|
47
|
+
<<: *default
|
48
|
+
mode: live
|
data/spec/log/http.log
ADDED
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require_relative '../lib/sgtn-cldr/sgtn-cldr.rb'
|
3
|
+
require 'twitter_cldr'
|
4
|
+
|
5
|
+
if ENV['COVERAGE']
|
6
|
+
require 'simplecov'
|
7
|
+
require 'coveralls'
|
8
|
+
Coveralls.wear!
|
9
|
+
SimpleCov.start do
|
10
|
+
add_filter "/spec/"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Bundler.require :default, :test
|
15
|
+
#SgtnClient.load("./spec/config/sgtnclient.yml", "test")
|
16
|
+
|
17
|
+
#require 'SgtnClient'
|
18
|
+
|
19
|
+
include SgtnCldr
|
20
|
+
include SgtnCldr::Logging
|
21
|
+
include SgtnCldr::Exceptions
|
22
|
+
|
23
|
+
require 'logger'
|
24
|
+
|
25
|
+
SgtnCldr.load("./spec/config/sgtncldr.yml", "test", './sgtncldr.log')
|
26
|
+
|
27
|
+
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f }
|
28
|
+
|
29
|
+
# Set logger for http
|
30
|
+
http_log = File.open(File.expand_path('../log/http.log', __FILE__), "w")
|
31
|
+
#Payment.api.http.set_debug_output(http_log)
|
32
|
+
|
33
|
+
RSpec.configure do |config|
|
34
|
+
config.filter_run_excluding :integration => true
|
35
|
+
config.filter_run_excluding :disabled => true
|
36
|
+
config.include SampleData
|
37
|
+
# config.include PayPal::SDK::REST::DataTypes
|
38
|
+
end
|
39
|
+
|
40
|
+
WebMock.allow_net_connect!
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SgtnCldr do
|
4
|
+
describe "DateTime" do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
it "DateTime" do
|
11
|
+
d = DateTime.new(2007,11,19,8,37,48,"-06:00")
|
12
|
+
expect(d.to_full_s(:es)).to eq 'lunes, 19 de noviembre de 2007, 14:37:48 (tiempo universal coordinado)'
|
13
|
+
expect(d.to_long_s(:es)).to eq '19 de noviembre de 2007, 14:37:48 UTC'
|
14
|
+
expect(d.to_medium_s(:es)).to eq '19 nov 2007 14:37:48'
|
15
|
+
expect(d.to_short_s(:es)).to eq '19/11/07 14:37'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "Date0" do
|
19
|
+
d = Date.new(2001,2,3)
|
20
|
+
expect(d.to_full_s(:es)).to eq 'Saturday, February 3, 2001'
|
21
|
+
expect(d.to_long_s(:es)).to eq 'February 3, 2001'
|
22
|
+
expect(d.to_medium_s(:es)).to eq 'Feb 3, 2001'
|
23
|
+
expect(d.to_short_s(:es)).to eq '2/3/01'
|
24
|
+
end
|
25
|
+
|
26
|
+
it "Date" do
|
27
|
+
d = DateTime.new(2007,11,19,8,37,48,"-06:00")
|
28
|
+
expect(d.to_date(:es).to_full_s).to eq 'lunes, 19 de noviembre de 2007'
|
29
|
+
expect(d.to_date(:es).to_long_s).to eq '19 de noviembre de 2007'
|
30
|
+
expect(d.to_date(:es).to_medium_s).to eq '19 nov 2007'
|
31
|
+
expect(d.to_date(:es).to_short_s).to eq '19/11/07'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "time" do
|
35
|
+
d = Time.new(2007,11,1,15,25,0, "+09:00")
|
36
|
+
expect(d.to_full_s(:es)).to eq '6:25:00 (tiempo universal coordinado)'
|
37
|
+
expect(d.to_long_s(:es)).to eq '6:25:00 UTC'
|
38
|
+
expect(d.to_medium_s(:es)).to eq '6:25:00'
|
39
|
+
expect(d.to_short_s(:es)).to eq '6:25'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,318 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: singleton-cldr-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- VMware G11n Team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
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: twitter_cldr
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '6.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '6.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-doc
|
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: rdoc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.4.2
|
118
|
+
- - "<"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '6.0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 2.4.2
|
128
|
+
- - "<"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '6.0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rubocop
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0.49'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0.49'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: http-accept
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 1.7.0
|
152
|
+
- - "<"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '2.0'
|
155
|
+
type: :runtime
|
156
|
+
prerelease: false
|
157
|
+
version_requirements: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: 1.7.0
|
162
|
+
- - "<"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '2.0'
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: http-cookie
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 1.0.2
|
172
|
+
- - "<"
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '2.0'
|
175
|
+
type: :runtime
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 1.0.2
|
182
|
+
- - "<"
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '2.0'
|
185
|
+
- !ruby/object:Gem::Dependency
|
186
|
+
name: mime-types
|
187
|
+
requirement: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '1.16'
|
192
|
+
- - "<"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '4.0'
|
195
|
+
type: :runtime
|
196
|
+
prerelease: false
|
197
|
+
version_requirements: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '1.16'
|
202
|
+
- - "<"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '4.0'
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
name: netrc
|
207
|
+
requirement: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - "~>"
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '0.8'
|
212
|
+
type: :runtime
|
213
|
+
prerelease: false
|
214
|
+
version_requirements: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - "~>"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0.8'
|
219
|
+
- !ruby/object:Gem::Dependency
|
220
|
+
name: rest-client
|
221
|
+
requirement: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - "~>"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '2.0'
|
226
|
+
type: :runtime
|
227
|
+
prerelease: false
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - "~>"
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '2.0'
|
233
|
+
- !ruby/object:Gem::Dependency
|
234
|
+
name: multi_json
|
235
|
+
requirement: !ruby/object:Gem::Requirement
|
236
|
+
requirements:
|
237
|
+
- - "~>"
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: '1.0'
|
240
|
+
type: :runtime
|
241
|
+
prerelease: false
|
242
|
+
version_requirements: !ruby/object:Gem::Requirement
|
243
|
+
requirements:
|
244
|
+
- - "~>"
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: '1.0'
|
247
|
+
- !ruby/object:Gem::Dependency
|
248
|
+
name: twitter_cldr
|
249
|
+
requirement: !ruby/object:Gem::Requirement
|
250
|
+
requirements:
|
251
|
+
- - "~>"
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '6.6'
|
254
|
+
type: :runtime
|
255
|
+
prerelease: false
|
256
|
+
version_requirements: !ruby/object:Gem::Requirement
|
257
|
+
requirements:
|
258
|
+
- - "~>"
|
259
|
+
- !ruby/object:Gem::Version
|
260
|
+
version: '6.6'
|
261
|
+
description: A Ruby lib for Singleton L2 support
|
262
|
+
email: li@vmware.com
|
263
|
+
executables: []
|
264
|
+
extensions: []
|
265
|
+
extra_rdoc_files:
|
266
|
+
- README.md
|
267
|
+
files:
|
268
|
+
- Gemfile
|
269
|
+
- README.md
|
270
|
+
- Rakefile
|
271
|
+
- lib/sgtn-cldr/cldr/core_ext.rb
|
272
|
+
- lib/sgtn-cldr/cldr/localized_date.rb
|
273
|
+
- lib/sgtn-cldr/cldr/localized_datetime.rb
|
274
|
+
- lib/sgtn-cldr/cldr/localized_time.rb
|
275
|
+
- lib/sgtn-cldr/core/cache.rb
|
276
|
+
- lib/sgtn-cldr/core/config.rb
|
277
|
+
- lib/sgtn-cldr/core/exceptions.rb
|
278
|
+
- lib/sgtn-cldr/core/logging.rb
|
279
|
+
- lib/sgtn-cldr/core/request.rb
|
280
|
+
- lib/sgtn-cldr/sgtn-cldr.rb
|
281
|
+
- lib/sgtn-cldr/util/cache-util.rb
|
282
|
+
- lib/sgtn-cldr/util/validate-util.rb
|
283
|
+
- lib/singleton-cldr.rb
|
284
|
+
- lib/version.rb
|
285
|
+
- spec/config/sgtncldr.yml
|
286
|
+
- spec/log/http.log
|
287
|
+
- spec/spec_helper.rb
|
288
|
+
- spec/support/sample_data.rb
|
289
|
+
- spec/unit/datetime_spec.rb
|
290
|
+
homepage: https://github.com/vmware/singleton
|
291
|
+
licenses:
|
292
|
+
- MIT
|
293
|
+
metadata: {}
|
294
|
+
post_install_message:
|
295
|
+
rdoc_options: []
|
296
|
+
require_paths:
|
297
|
+
- lib
|
298
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
299
|
+
requirements:
|
300
|
+
- - ">="
|
301
|
+
- !ruby/object:Gem::Version
|
302
|
+
version: 2.0.0
|
303
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
304
|
+
requirements:
|
305
|
+
- - ">="
|
306
|
+
- !ruby/object:Gem::Version
|
307
|
+
version: '0'
|
308
|
+
requirements: []
|
309
|
+
rubygems_version: 3.1.4
|
310
|
+
signing_key:
|
311
|
+
specification_version: 4
|
312
|
+
summary: Singleton cldr for L2 support
|
313
|
+
test_files:
|
314
|
+
- spec/config/sgtncldr.yml
|
315
|
+
- spec/log/http.log
|
316
|
+
- spec/spec_helper.rb
|
317
|
+
- spec/support/sample_data.rb
|
318
|
+
- spec/unit/datetime_spec.rb
|