Class: GlobalizeApp
- Inherits:
-
Object
- Object
- GlobalizeApp
- Defined in:
- lib/exvo_globalize/globalize_app.rb
Instance Attribute Summary collapse
-
#request_host ⇒ Object
readonly
Returns the value of attribute request_host.
Instance Method Summary collapse
-
#fetch_translations ⇒ Object
returns a Hash with translations: { “en” => { “intro” => “Introduction” } }.
-
#initialize(request_host) ⇒ GlobalizeApp
constructor
A new instance of GlobalizeApp.
- #updated_translations_available? ⇒ Boolean
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_host ⇒ Object (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_translations ⇒ Object
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
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 |