Sha256: 536f80c5d8e3ccf421dcfa2ce7dfa7e7cd063f06f2c2e8e1469db7ab8f21672f
Contents?: true
Size: 749 Bytes
Versions: 4
Compression:
Stored size: 749 Bytes
Contents
class GlobalizeApp attr_reader :request_host def initialize(request_host) @request_host = request_host end def updated_translations_available? # TODO fetch_translations and sha1 compare them with database stored sha1 of previously fetched translations true end # returns a Hash with translations: { "en" => { "intro" => "Introduction" } } def fetch_translations resp = HTTParty.get(translations_uri) if resp.response.is_a?(Net::HTTPOK) resp.parsed_response else {} end end private def globalize_host Rails.env.production? ? "globalize.exvo.com" : "globalize.exvo.co" end def translations_uri "http://#{globalize_host}/translations.json?host=#{@request_host}" end end
Version data entries
4 entries across 4 versions & 1 rubygems