Class: Rack::SimpleAuth::HMAC::Config

Inherits:
Hash
  • Object
show all
Defined in:
lib/rack/simple_auth/hmac/config.rb

Overview

Config objects will be instantiated out of this class when using Rack::SimpleAuth::HMAC::Middleware Also the public instance attributes / virtual attributes will be populated via the Middleware DSL

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

- (Object) method_missing(name, *args)

Throw Runtime error for unknown attribute

Parameters:

  • name (Symbol)
  • args (Array)


39
40
41
# File 'lib/rack/simple_auth/hmac/config.rb', line 39

def method_missing(name, *args)
  fail "Unknown option #{name.to_s.gsub!('=', '')}"
end

Instance Attribute Details

- (String) logpath

Returns:

  • (String)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rack/simple_auth/hmac/config.rb', line 26

class Config < Hash
  attr_writer :tolerance
  attr_writer :secret, :signature

  attr_accessor :verbose
  attr_accessor :logpath, :request_config

  ##
  # Throw Runtime error for unknown attribute
  #
  # @param [Symbol] name
  # @param [Array] args
  #
  def method_missing(name, *args)
    fail "Unknown option #{name.to_s.gsub!('=', '')}"
  end

  ##
  # Tolerance Attribute with nil guard
  #
  # @return [Fixnum] tolerance
  #
  def tolerance
    @tolerance || 1000
  end

  ##
  # Secret Attribute with nil guard
  #
  # @return [String] secret
  #
  def secret
    @secret || ''
  end

  ##
  # Signature Attribute with nil guard
  #
  # @return [String] signature
  #
  def signature
    @signature || ''
  end
end

- (Hash) request_config

Returns:

  • (Hash)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rack/simple_auth/hmac/config.rb', line 26

class Config < Hash
  attr_writer :tolerance
  attr_writer :secret, :signature

  attr_accessor :verbose
  attr_accessor :logpath, :request_config

  ##
  # Throw Runtime error for unknown attribute
  #
  # @param [Symbol] name
  # @param [Array] args
  #
  def method_missing(name, *args)
    fail "Unknown option #{name.to_s.gsub!('=', '')}"
  end

  ##
  # Tolerance Attribute with nil guard
  #
  # @return [Fixnum] tolerance
  #
  def tolerance
    @tolerance || 1000
  end

  ##
  # Secret Attribute with nil guard
  #
  # @return [String] secret
  #
  def secret
    @secret || ''
  end

  ##
  # Signature Attribute with nil guard
  #
  # @return [String] signature
  #
  def signature
    @signature || ''
  end
end

- (String) secret

Secret Attribute with nil guard

Returns:

  • (String)

    secret



57
58
59
# File 'lib/rack/simple_auth/hmac/config.rb', line 57

def secret
  @secret || ''
end

- (String) signature

Signature Attribute with nil guard

Returns:

  • (String)

    signature



66
67
68
# File 'lib/rack/simple_auth/hmac/config.rb', line 66

def signature
  @signature || ''
end

- (Fixnum) tolerance

Tolerance Attribute with nil guard

Returns:

  • (Fixnum)

    tolerance



48
49
50
# File 'lib/rack/simple_auth/hmac/config.rb', line 48

def tolerance
  @tolerance || 1000
end

- (TrueClass|NilClass) verbose

Returns:

  • (TrueClass|NilClass)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rack/simple_auth/hmac/config.rb', line 26

class Config < Hash
  attr_writer :tolerance
  attr_writer :secret, :signature

  attr_accessor :verbose
  attr_accessor :logpath, :request_config

  ##
  # Throw Runtime error for unknown attribute
  #
  # @param [Symbol] name
  # @param [Array] args
  #
  def method_missing(name, *args)
    fail "Unknown option #{name.to_s.gsub!('=', '')}"
  end

  ##
  # Tolerance Attribute with nil guard
  #
  # @return [Fixnum] tolerance
  #
  def tolerance
    @tolerance || 1000
  end

  ##
  # Secret Attribute with nil guard
  #
  # @return [String] secret
  #
  def secret
    @secret || ''
  end

  ##
  # Signature Attribute with nil guard
  #
  # @return [String] signature
  #
  def signature
    @signature || ''
  end
end