class Holistics::Helpers::AuthInfo

Public Instance Methods

api_url_for(path, params = {}) click to toggle source
# File lib/holistics/helpers/auth_info.rb, line 15
def api_url_for(path, params = {})
  "#{http_request.server_url}#{path}?#{URI.encode_www_form(params)}"
end
authenticated?() click to toggle source
# File lib/holistics/helpers/auth_info.rb, line 11
def authenticated?
  File.exists?(get_gconfig_filepath)
end
get_gconfig_filepath() click to toggle source
# File lib/holistics/helpers/auth_info.rb, line 28
def get_gconfig_filepath
  File.expand_path('~/.holistics.yml', __FILE__)
end
get_token_from_gconfig() click to toggle source
# File lib/holistics/helpers/auth_info.rb, line 19
def get_token_from_gconfig
  if authenticated?
    string = YAML.load_file(get_gconfig_filepath)
    string['token']
  else
    raise StandardError.new 'Holistics config file not found'
  end
end
http_request() click to toggle source
# File lib/holistics/helpers/auth_info.rb, line 7
def http_request
  @http_helper ||= Helpers::HttpRequest.new
end