class GP::Ruby::Client
Public Class Methods
new(bundle_id, srvc_account=ServiceAccount.new)
click to toggle source
# File lib/gp-ruby-client.rb, line 47 def initialize(bundle_id, srvc_account=ServiceAccount.new) @@bundle_id = bundle_id if @@use_service && (Time.now - @@cache_control.get_last_accessed_time >= @@cache_control.get_ttl || @@just_started) @@just_started = false @@cache_control.set_last_accessed_time(Time.now) backend = {} I18n.backend = I18n::Backend::Chain.new(I18n::Backend::KeyValue.new(backend), I18n.backend) @@service_account = srvc_account if @@service_account.nil? raise "No valid service account" end @@rest_client = RESTClient.new(@@service_account, @@bundle_id, @@locale) end end
Public Instance Methods
disable_service()
click to toggle source
# File lib/gp-ruby-client.rb, line 94 def disable_service @@use_service = false end
enable_service()
click to toggle source
# File lib/gp-ruby-client.rb, line 98 def enable_service @@use_service = true end
get_bundle_id()
click to toggle source
# File lib/gp-ruby-client.rb, line 66 def get_bundle_id @@bundle_id end
get_cache_control()
click to toggle source
# File lib/gp-ruby-client.rb, line 82 def get_cache_control @@cache_control end
get_default_locale()
click to toggle source
# File lib/gp-ruby-client.rb, line 102 def get_default_locale request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first end
get_locale()
click to toggle source
# File lib/gp-ruby-client.rb, line 74 def get_locale @@locale end
get_rest_client()
click to toggle source
# File lib/gp-ruby-client.rb, line 90 def get_rest_client @@rest_client end
get_service_account()
click to toggle source
# File lib/gp-ruby-client.rb, line 86 def get_service_account @@service_account end
set_bundle_id(bundle_id)
click to toggle source
# File lib/gp-ruby-client.rb, line 70 def set_bundle_id(bundle_id) @@bundle_id = bundle_id end
set_locale(locale)
click to toggle source
# File lib/gp-ruby-client.rb, line 78 def set_locale(locale) @@locale = locale end