tml 5.7.4 → 5.7.5

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 (55) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/lib/tml.rb +1 -1
  5. data/lib/tml/api/client.rb +30 -23
  6. data/lib/tml/application.rb +1 -1
  7. data/lib/tml/base.rb +1 -1
  8. data/lib/tml/cache.rb +1 -1
  9. data/lib/tml/cache_adapters/file.rb +1 -1
  10. data/lib/tml/cache_adapters/memcache.rb +1 -1
  11. data/lib/tml/cache_adapters/redis.rb +1 -1
  12. data/lib/tml/cache_version.rb +1 -1
  13. data/lib/tml/config.rb +1 -1
  14. data/lib/tml/decorators/base.rb +1 -1
  15. data/lib/tml/decorators/default.rb +1 -1
  16. data/lib/tml/decorators/html.rb +1 -1
  17. data/lib/tml/decorators/json.rb +1 -1
  18. data/lib/tml/exception.rb +1 -1
  19. data/lib/tml/ext/array.rb +1 -1
  20. data/lib/tml/ext/date.rb +1 -1
  21. data/lib/tml/ext/fixnum.rb +1 -1
  22. data/lib/tml/ext/hash.rb +1 -1
  23. data/lib/tml/ext/string.rb +1 -1
  24. data/lib/tml/ext/time.rb +1 -1
  25. data/lib/tml/language.rb +1 -1
  26. data/lib/tml/language_case.rb +1 -1
  27. data/lib/tml/language_case_rule.rb +1 -1
  28. data/lib/tml/language_context.rb +1 -1
  29. data/lib/tml/language_context_rule.rb +1 -1
  30. data/lib/tml/logger.rb +1 -1
  31. data/lib/tml/rules_engine/evaluator.rb +1 -1
  32. data/lib/tml/rules_engine/parser.rb +1 -1
  33. data/lib/tml/session.rb +1 -1
  34. data/lib/tml/source.rb +1 -1
  35. data/lib/tml/tokenizers/data.rb +1 -1
  36. data/lib/tml/tokenizers/decoration.rb +1 -1
  37. data/lib/tml/tokenizers/dom.rb +1 -1
  38. data/lib/tml/tokenizers/x_message.rb +1 -1
  39. data/lib/tml/tokens/data.rb +1 -1
  40. data/lib/tml/tokens/decoration.rb +1 -1
  41. data/lib/tml/tokens/map.rb +1 -1
  42. data/lib/tml/tokens/method.rb +1 -1
  43. data/lib/tml/tokens/transform.rb +1 -1
  44. data/lib/tml/tokens/x_message/choice.rb +1 -1
  45. data/lib/tml/tokens/x_message/data.rb +1 -1
  46. data/lib/tml/tokens/x_message/decoration.rb +1 -1
  47. data/lib/tml/tokens/x_message/map.rb +1 -1
  48. data/lib/tml/translation.rb +1 -1
  49. data/lib/tml/translation_key.rb +1 -1
  50. data/lib/tml/translator.rb +1 -1
  51. data/lib/tml/utils.rb +1 -1
  52. data/lib/tml/version.rb +2 -2
  53. data/tasks/tml/cache.rake +33 -0
  54. metadata +4 -5
  55. data/lib/tml/postoffice.rb +0 -99
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7e8be5856d5bb390b43c15fcd102a316cfa320d8
4
- data.tar.gz: c69ee33c581b3750366f52e1f0999513431da5af
2
+ SHA256:
3
+ metadata.gz: f22472b3451faaa34531f1a366b002b3c0fcb6836a6511f249428bd696b3f913
4
+ data.tar.gz: d0b282b91dc07cc90aa1542daa363d643aecb1ecef8ee50e982c02a819a96844
5
5
  SHA512:
6
- metadata.gz: 6f9122e2ebf22d7f44e4dd0622bca7099b8cdc169f766c7a1fc00efb91d16d18d49c98dacf61796df41e4d9026fdd0b1bc9ca72c86606e0e02d7518a8692cf46
7
- data.tar.gz: 91cdda5be816a31ecc89bd05e24ad0a670155e12964cfec9a3931550cd605a31a86931ec20547f3ed2d486f8153217d15efdd173ed4bbbc7ae9e417142e6d1cf
6
+ metadata.gz: 5a7ac88acae16bf896ec80bd9b05e45843fb0975f6ba3ed8d6d7f525916930ab7efbf28cc0541413bdab9d230bff15a44357debbc32efee00cce6149b5be3050
7
+ data.tar.gz: 4a5880962f6c461cafcb7c9f88343632db6eba4c870c048763e2b8277f6f8a7af3b62e83801bb6760f22bb8ccd13cc947304b7dca9b06716ff326c4e54aa0ce4
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 Translation Exchange, Inc
1
+ Copyright (c) 2017 Translation Exchange, Inc
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -224,7 +224,7 @@ Links
224
224
  Copyright and license
225
225
  ==================
226
226
 
227
- Copyright (c) 2016 Translation Exchange, Inc
227
+ Copyright (c) 2017 Translation Exchange, Inc
228
228
 
229
229
  Permission is hereby granted, free of charge, to any person obtaining
230
230
  a copy of this software and associated documentation files (the
data/lib/tml.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
3
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -77,9 +77,9 @@ class Tml::Api::Client < Tml::Base
77
77
  # API connection
78
78
  def connection
79
79
  @connection ||= Faraday.new(:url => host) do |faraday|
80
- faraday.request(:url_encoded) # form-encode POST params
80
+ faraday.request(:url_encoded) # form-encode POST params
81
81
  # faraday.response :logger # log requests to STDOUT
82
- faraday.adapter(Faraday.default_adapter) # make requests with Net::HTTP
82
+ faraday.adapter(Faraday.default_adapter) # make requests with Net::HTTP
83
83
  end
84
84
  end
85
85
 
@@ -113,8 +113,8 @@ class Tml::Api::Client < Tml::Base
113
113
  # cdn_connection
114
114
  def cdn_connection
115
115
  @cdn_connection ||= Faraday.new(:url => application.cdn_host) do |faraday|
116
- faraday.request(:url_encoded) # form-encode POST params
117
- faraday.adapter(Faraday.default_adapter) # make requests with Net::HTTP
116
+ faraday.request(:url_encoded) # form-encode POST params
117
+ faraday.adapter(Faraday.default_adapter) # make requests with Net::HTTP
118
118
  end
119
119
  end
120
120
 
@@ -136,7 +136,7 @@ class Tml::Api::Client < Tml::Base
136
136
  trace_api_call(cdn_path, params, opts.merge(:host => application.cdn_host)) do
137
137
  begin
138
138
  response = cdn_connection.get do |request|
139
- prepare_request(request, cdn_path, params)
139
+ prepare_request(request, cdn_path, params, opts)
140
140
  end
141
141
  rescue Exception => ex
142
142
  Tml.logger.error("Failed to execute request: #{ex.message[0..255]}")
@@ -158,7 +158,7 @@ class Tml::Api::Client < Tml::Base
158
158
 
159
159
  begin
160
160
  data = JSON.parse(data)
161
- rescue Exception => ex
161
+ rescue => ex
162
162
  return nil
163
163
  end
164
164
 
@@ -238,7 +238,7 @@ class Tml::Api::Client < Tml::Base
238
238
  return path if path.match(/^https?:\/\//)
239
239
  clean_path = trim_prepending_slash(path)
240
240
 
241
- if clean_path.index("v1") == 0 || clean_path.index("v2") == 0
241
+ if clean_path.index('v1') == 0 || clean_path.index('v2') == 0
242
242
  "/#{clean_path}"
243
243
  else
244
244
  "#{API_PATH}/#{clean_path}"
@@ -246,16 +246,20 @@ class Tml::Api::Client < Tml::Base
246
246
  end
247
247
 
248
248
  def trim_prepending_slash(str)
249
- str.index("/") == 0 ? str[1..-1] : str
249
+ str.index('/') == 0 ? str[1..-1] : str
250
250
  end
251
251
 
252
252
  # prepares request
253
- def prepare_request(request, path, params)
254
- request.options.timeout = Tml.config.api_client[:timeout]
255
- request.options.open_timeout = Tml.config.api_client[:open_timeout]
256
- request.headers['User-Agent'] = "tml-ruby v#{Tml::VERSION} (Faraday v#{Faraday::VERSION})"
257
- request.headers['Accept'] = 'application/json'
258
- request.headers['Accept-Encoding'] = 'gzip, deflate'
253
+ def prepare_request(request, path, params, opts = {})
254
+ request.options.timeout = Tml.config.api_client[:timeout]
255
+ request.options.open_timeout = Tml.config.api_client[:open_timeout]
256
+ request.headers['User-Agent'] = "tml-ruby v#{Tml::VERSION} (Faraday v#{Faraday::VERSION})"
257
+ request.headers['Accept'] = 'application/json'
258
+
259
+ unless opts[:uncompressed]
260
+ request.headers['Accept-Encoding'] = 'gzip, deflate'
261
+ end
262
+
259
263
  request.url(path, params)
260
264
  end
261
265
 
@@ -266,7 +270,8 @@ class Tml::Api::Client < Tml::Base
266
270
 
267
271
  path = prepare_api_path(path)
268
272
 
269
- @compressed = false
273
+ opts[:method] ||= :get
274
+
270
275
  trace_api_call(path, params, opts.merge(:host => host)) do
271
276
  begin
272
277
  if opts[:method] == :post
@@ -277,23 +282,25 @@ class Tml::Api::Client < Tml::Base
277
282
  response = connection.delete(path, params)
278
283
  else
279
284
  response = connection.get do |request|
280
- @compressed = true
281
- prepare_request(request, path, params)
285
+ prepare_request(request, path, params, opts)
282
286
  end
283
287
  end
284
- rescue Exception => ex
288
+ rescue => ex
285
289
  Tml.logger.error("Failed to execute request: #{ex.message[0..255]}")
286
290
  error = ex
287
291
  nil
288
292
  end
289
293
  end
290
- raise Tml::Exception.new("Error: #{error}") if error
291
294
 
292
- if response.status >= 500 and response.status < 600
295
+ if error
296
+ raise Tml::Exception.new("Error: #{error}")
297
+ end
298
+
299
+ if response.status >= 500 && response.status < 600
293
300
  raise Tml::Exception.new("Error: #{response.body}")
294
301
  end
295
302
 
296
- if @compressed and (not opts[:uncompressed])
303
+ if opts[:method] == :get && !opts[:uncompressed]
297
304
  compressed_data = response.body
298
305
  return if compressed_data.nil? or compressed_data == ''
299
306
 
@@ -307,7 +314,7 @@ class Tml::Api::Client < Tml::Base
307
314
 
308
315
  begin
309
316
  data = JSON.parse(data)
310
- rescue Exception => ex
317
+ rescue => ex
311
318
  raise Tml::Exception.new("Failed to parse response: #{ex.message[0..255]}")
312
319
  end
313
320
 
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/base.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/cache.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/config.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/exception.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/ext/array.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
3
3
  #
4
4
  # _______ _ _ _ ______ _
5
5
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/ext/date.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
3
3
  #
4
4
  # _______ _ _ _ ______ _
5
5
  # |__ __| | | | | (_) | ____| | |
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
3
3
  #
4
4
  # _______ _ _ _ ______ _
5
5
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/ext/hash.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
3
3
  #
4
4
  # _______ _ _ _ ______ _
5
5
  # |__ __| | | | | (_) | ____| | |
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
3
3
  #
4
4
  # _______ _ _ _ ______ _
5
5
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/ext/time.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
3
3
  #
4
4
  # _______ _ _ _ ______ _
5
5
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/language.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/logger.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/session.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/source.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/utils.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
data/lib/tml/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
- # Copyright (c) 2016 Translation Exchange Inc. http://translationexchange.com
3
+ # Copyright (c) 2017 Translation Exchange Inc. http://translationexchange.com
4
4
  #
5
5
  # _______ _ _ _ ______ _
6
6
  # |__ __| | | | | (_) | ____| | |
@@ -31,7 +31,7 @@
31
31
  #++
32
32
 
33
33
  module Tml
34
- VERSION = '5.7.4'
34
+ VERSION = '5.7.5'
35
35
 
36
36
  def self.full_version
37
37
  "tml-ruby v#{Tml::VERSION} (Faraday v#{Faraday::VERSION})"
data/tasks/tml/cache.rake CHANGED
@@ -1,3 +1,36 @@
1
+ # encoding: UTF-8
2
+ #--
3
+ # Copyright (c) 2017 Translation Exchange, Inc
4
+ #
5
+ # _______ _ _ _ ______ _
6
+ # |__ __| | | | | (_) | ____| | |
7
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
8
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
9
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
10
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
11
+ # __/ |
12
+ # |___/
13
+ # Permission is hereby granted, free of charge, to any person obtaining
14
+ # a copy of this software and associated documentation files (the
15
+ # "Software"), to deal in the Software without restriction, including
16
+ # without limitation the rights to use, copy, modify, merge, publish,
17
+ # distribute, sublicense, and/or sell copies of the Software, and to
18
+ # permit persons to whom the Software is furnished to do so, subject to
19
+ # the following conditions:
20
+ #
21
+ # The above copyright notice and this permission notice shall be
22
+ # included in all copies or substantial portions of the Software.
23
+ #
24
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
+ #++
32
+
33
+
1
34
  require 'tml'
2
35
 
3
36
  namespace :tml do
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.7.4
4
+ version: 5.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-15 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -76,7 +76,6 @@ files:
76
76
  - lib/tml/language_context_rule.rb
77
77
  - lib/tml/languages/en.json
78
78
  - lib/tml/logger.rb
79
- - lib/tml/postoffice.rb
80
79
  - lib/tml/rules_engine/evaluator.rb
81
80
  - lib/tml/rules_engine/parser.rb
82
81
  - lib/tml/session.rb
@@ -102,7 +101,7 @@ files:
102
101
  - tasks/tml/cache.rake
103
102
  homepage: https://github.com/translationexchange/tml-ruby
104
103
  licenses:
105
- - MIT-LICENSE
104
+ - MIT-CMU
106
105
  metadata: {}
107
106
  post_install_message:
108
107
  rdoc_options: []
@@ -120,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
119
  version: '0'
121
120
  requirements: []
122
121
  rubyforge_project:
123
- rubygems_version: 2.4.5
122
+ rubygems_version: 2.7.1
124
123
  signing_key:
125
124
  specification_version: 4
126
125
  summary: Tml Core Classes
@@ -1,99 +0,0 @@
1
- # encoding: UTF-8
2
- #--
3
- # Copyright (c) 2016 Translation Exchange, Inc
4
- #
5
- # _______ _ _ _ ______ _
6
- # |__ __| | | | | (_) | ____| | |
7
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
8
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
9
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
10
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
11
- # __/ |
12
- # |___/
13
- # Permission is hereby granted, free of charge, to any person obtaining
14
- # a copy of this software and associated documentation files (the
15
- # "Software"), to deal in the Software without restriction, including
16
- # without limitation the rights to use, copy, modify, merge, publish,
17
- # distribute, sublicense, and/or sell copies of the Software, and to
18
- # permit persons to whom the Software is furnished to do so, subject to
19
- # the following conditions:
20
- #
21
- # The above copyright notice and this permission notice shall be
22
- # included in all copies or substantial portions of the Software.
23
- #
24
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
- #++
32
-
33
- module Tml
34
-
35
- class << self
36
- attr_accessor :postoffice
37
- end
38
-
39
- def self.postoffice
40
- @postoffice ||= begin
41
- po_config = Tml.config.postoffice || {}
42
- Tml::Postoffice.new(
43
- key: po_config[:key],
44
- token: po_config[:token],
45
- host: po_config[:host]
46
- )
47
- end
48
- end
49
-
50
- class Postoffice < Tml::Base
51
-
52
- PO_HOST = 'https://postoffice.translationexchange.com'
53
- API_VERSION = 'v1'
54
-
55
- attributes :host, :key, :access_token
56
-
57
- # API host
58
- def host
59
- super || PO_HOST
60
- end
61
-
62
- # API token
63
- def token
64
- access_token
65
- end
66
-
67
- # Postoffice API client
68
- def deliver(to, template, tokens = {}, options = {})
69
- if key.blank?
70
- Tml.logger.error("Failed to deliver #{template} to #{to} - PostOffice has not been configured")
71
- return
72
- end
73
-
74
- Tml.logger.debug("Delivering #{template} to #{to}")
75
- params = {
76
- client_id: key,
77
- template: template,
78
- tokens: tokens,
79
- to: to,
80
- via: options[:via],
81
- from: options[:from],
82
- locale: options[:locale],
83
- first_name: options[:first_name],
84
- last_name: options[:last_name],
85
- name: options[:name]
86
- }
87
- params = Tml::Utils.remove_nils(params)
88
- api_client.execute_request("#{host}/api/#{API_VERSION}/deliver", params, {:method => :post})
89
- end
90
-
91
- private
92
-
93
- # Create API client
94
- def api_client
95
- @api_client ||= Tml.config.api_client[:class].new(application: self)
96
- end
97
-
98
- end
99
- end