Class: GlobalizeApp

Inherits:
Object
  • Object
show all
Defined in:
lib/exvo_globalize/globalize_app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_host) ⇒ GlobalizeApp

Returns a new instance of GlobalizeApp.



5
6
7
# File 'lib/exvo_globalize/globalize_app.rb', line 5

def initialize(request_host)
  @request_host = request_host
end

Instance Attribute Details

#request_hostObject (readonly)

Returns the value of attribute request_host.



3
4
5
# File 'lib/exvo_globalize/globalize_app.rb', line 3

def request_host
  @request_host
end

Instance Method Details

#fetch_translationsObject

returns a Hash with translations: { “en” => { “intro” => “Introduction” } }



15
16
17
18
19
20
21
22
# 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?Boolean

Returns:

  • (Boolean)


9
10
11
12
# 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