Module: Touth

Extended by:
ActiveSupport::Autoload
Defined in:
lib/touth.rb,
lib/touth/version.rb,
lib/touth/authenticator.rb,
lib/touth/active_record_support.rb,
lib/touth/action_controller_support.rb

Defined Under Namespace

Modules: ActionControllerSupport, ActiveRecordSupport, Authenticator Classes: Configuration

Constant Summary collapse

VERSION =
'1.1.0'

Class Method Summary collapse

Class Method Details

.digest(data) ⇒ Object



36
37
38
39
# File 'lib/touth.rb', line 36

def digest(data)
  @digest_method ||= OpenSSL::Digest.new 'sha256'
  OpenSSL::HMAC.digest @digest_method, self.client_secret_key, data
end

.method_missing(method_name, *args, &block) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/touth.rb', line 41

def method_missing(method_name, *args, &block)
  if @config.respond_to? method_name
    @config.send method_name, *args, &block
  else
    super
  end
end

.respond_to?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/touth.rb', line 49

def respond_to?(method_name, include_private = false)
  @config.respond_to? method_name
end

.setup {|@config| ... } ⇒ Object

Yields:

  • (@config)


31
32
33
34
# File 'lib/touth.rb', line 31

def setup
  @config ||= Configuration.new
  yield @config if block_given?
end