tml 5.6.2 → 5.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c188de8e8abadb7ed1f73b6604c1a565b8d4a5fd
4
- data.tar.gz: c7e224dc55961ba8c32e969cfbe9a95f94b1035c
3
+ metadata.gz: 0b28ce58d9d3fe39e6cef50feaa40f95d7c8085b
4
+ data.tar.gz: 45486d668ce805a7da21a2c68737e8d3cde136dc
5
5
  SHA512:
6
- metadata.gz: 7d2ab7726456b6b44a5f45184b7081ce2aa067d93e09dc837b14a7ecefd070bce71ed6790662bef5f174259335de6c0112659efdeef2afdb2b7d3b8379af5eed
7
- data.tar.gz: 95a10992d6aec843cb31241a2abb612815a3720c07beebe295a708753cb9305af3eecd8ce35422e4af24e9207acd5807fe7e4f42328a63ddfb72850b9f42b43f
6
+ metadata.gz: cd3fd07ed74dff0535f06ca7d0c0add72c8e88846d6007980eda941707b82090a2137d151a9b1ca6d2d3693a8f283a34a41bba43f5c102307e017e70efd2ef7f
7
+ data.tar.gz: b1d30eae76286ae3d64c0ab0c4f3904cf56125098239d86a1b1310bd7ce07958c692e25ad471efe4f1865c010eec7e7f817c21630749f0450d9e1a0bf36dacd0
data/README.md CHANGED
@@ -50,7 +50,10 @@ The library can be invoked from the IRB. To use TML client you must require it,
50
50
 
51
51
  ```ruby
52
52
  irb(main)> require 'tml'
53
- irb(main)> app = Tml.session.init(KEY, SECRET)
53
+ irb(main)> app = Tml.session.init({
54
+ key: APP_KEY,
55
+ token: SDK_ACCESS_TOKEN
56
+ })
54
57
  ```
55
58
 
56
59
  Now you can use the application to get any language registered with your app:
@@ -236,7 +236,17 @@ class Tml::Api::Client < Tml::Base
236
236
  # prepares API path
237
237
  def prepare_api_path(path)
238
238
  return path if path.match(/^https?:\/\//)
239
- "#{API_PATH}#{path[0] == '/' ? '' : '/'}#{path}"
239
+ clean_path = trim_prepending_slash(path)
240
+
241
+ if clean_path.index("v1") == 0 || clean_path.index("v2") == 0
242
+ "/#{clean_path}"
243
+ else
244
+ "#{API_PATH}/#{clean_path}"
245
+ end
246
+ end
247
+
248
+ def trim_prepending_slash(str)
249
+ str.index("/") == 0 ? str[1..-1] : str
240
250
  end
241
251
 
242
252
  # prepares request
@@ -242,7 +242,13 @@ class Tml::Application < Tml::Base
242
242
  source.reset_cache
243
243
  end
244
244
 
245
- api_client.post('sources/register_keys', {:source_keys => params.to_json})
245
+ if Tml.config.disable_async_keys_registration
246
+ api_client.post('sources/register_keys', {:source_keys => params.to_json})
247
+ else
248
+ Thread.new do
249
+ api_client.post('sources/register_keys', {:source_keys => params.to_json})
250
+ end
251
+ end
246
252
  rescue Tml::Exception => e
247
253
  Tml.logger.error('Failed to register missing translation keys...')
248
254
  Tml.logger.error(e)
@@ -75,7 +75,7 @@ module Tml
75
75
  # The class can be extended with a different implementation, as long as the interface is supported
76
76
  class Config
77
77
  # Configuration Attributes
78
- attr_accessor :enabled, :locale, :default_level, :format, :application, :postoffice, :context_rules, :logger, :cache, :default_tokens, :localization
78
+ attr_accessor :enabled, :locale, :default_level, :format, :application, :postoffice, :context_rules, :logger, :cache, :default_tokens, :localization, :disable_async_keys_registration
79
79
  attr_accessor :auto_init, :source_separator, :domain
80
80
 
81
81
  # Used by Rails and Sinatra extensions
@@ -125,7 +125,7 @@ module Tml
125
125
  params = Tml::Utils.normalize_tr_params(label, description, tokens, options)
126
126
  return params[:label] if params[:label].tml_translated?
127
127
 
128
- params[:options][:caller] ||= caller
128
+ params[:options][:caller] ||= caller(1, 1)
129
129
 
130
130
  if Tml.config.disabled?
131
131
  return Tml.config.default_language.translate(params[:label], params[:tokens], params[:options]).tml_translated
@@ -31,7 +31,7 @@
31
31
  #++
32
32
 
33
33
  module Tml
34
- VERSION = '5.6.2'
34
+ VERSION = '5.6.3'
35
35
 
36
36
  def self.full_version
37
37
  "tml-ruby v#{Tml::VERSION} (Faraday v#{Faraday::VERSION})"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tml
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.2
4
+ version: 5.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2017-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday