class GlobalizeApp
Attributes
request_host[R]
Public Class Methods
new(request_host)
click to toggle source
# File lib/exvo_globalize/globalize_app.rb, line 5 def initialize(request_host) @request_host = request_host end
Public Instance Methods
fetch_translations()
click to toggle source
returns a Hash with translations: { “en” => { “intro” => “Introduction” } }
# File lib/exvo_globalize/globalize_app.rb, line 15 def fetch_translations resp = HTTParty.get(translations_uri) if resp.response.is_a?(Net::HTTPOK) resp.parsed_response else {} end end
updated_translations_available?()
click to toggle source
# File lib/exvo_globalize/globalize_app.rb, line 9 def updated_translations_available? # TODO fetch_translations and sha1 compare them with database stored sha1 of previously fetched translations true end
Private Instance Methods
globalize_host()
click to toggle source
# File lib/exvo_globalize/globalize_app.rb, line 26 def globalize_host Rails.env.production? || ENV['GLOBALIZE_USE_PRODUCTION_SERVER'] == 'true' ? "app.tolq.com" : "app.tolq.co" end
translations_uri()
click to toggle source
# File lib/exvo_globalize/globalize_app.rb, line 30 def translations_uri "http://#{globalize_host}/translations.json?host=#{@request_host}" end