Sha256: 1771745c9159ac34d2aa84b5eb65becc889670c232e03333eb8089c67875cac8
Contents?: true
Size: 1.29 KB
Versions: 73
Compression:
Stored size: 1.29 KB
Contents
module SparkApi module Authentication #=Authentication Base # This base class defines the basic interface supported by all client authentication # implementations. class BaseAuth attr_accessor :session # All ihheriting classes should accept the spark_api client as a part of initialization def initialize(client) @client = client end # Perform requests to authenticate the client with the API def authenticate raise "Implement me!" end # Called prior to running authenticate (except in case of api authentication errors) def authenticated? !(session.nil? || session.expired?) end # Terminate the active session def logout raise "Implement me!" end # Perform an HTTP request (no data) def request(method, path, body, options) raise "Implement me!" end # Format a hash as request parameters # # :returns: # Stringized form of the parameters as needed for an HTTP request def build_url_parameters(parameters={}) array = parameters.map do |key,value| escaped_value = CGI.escape("#{value}") "#{key}=#{escaped_value}" end array.join "&" end end end end
Version data entries
73 entries across 73 versions & 1 rubygems