Module: Touth

Defined in:
lib/touth.rb,
lib/touth/store.rb,
lib/touth/railtie.rb,
lib/touth/version.rb,
lib/touth/middleware.rb,
lib/touth/authenticator.rb,
lib/touth/active_record_support.rb,
lib/touth/action_controller_support.rb

Overview

Touth


Defined Under Namespace

Modules: ActionControllerSupport, ActiveRecordSupport, Authenticator, Store Classes: Configuration, InvalidAccessTokenError, Middleware, Railtie

Constant Summary collapse

MAJOR =
1
MINOR =
3
REVISION =
0
VERSION =
[MAJOR, MINOR, REVISION].compact.join '.'

Class Method Summary collapse

Class Method Details

.digest(data) ⇒ Object



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

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

.get_resource_name(name) ⇒ Object



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

def get_resource_name(name)
  name.to_s.gsub('::', '_').underscore
end

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



52
53
54
55
56
57
58
# File 'lib/touth.rb', line 52

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)


60
61
62
# File 'lib/touth.rb', line 60

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

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

Yields:

  • (@config)


38
39
40
41
# File 'lib/touth.rb', line 38

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