Module: SmsCandy::Authentication::Strategies

Defined in:
lib/sms_candy.rb,
lib/sms_candy/authentication/strategies.rb,
lib/sms_candy/authentication/strategies/o_auth_2.rb

Defined Under Namespace

Classes: OAuth2

Class Method Summary collapse

Class Method Details

.add(label, strategy = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/sms_candy/authentication/strategies.rb', line 9

def add(label, strategy = nil)
  strategy ||= SmsCandy::Authentication::Strategies::OAuth2.new

  unless strategy.class.method_defined?(:authenticate!)
    raise NoMethodError, "authenticate! is not declared in the #{label.inspect} strategy"
  end

  _strategies[label] = strategy
end

.clear!Object



19
20
21
# File 'lib/sms_candy/authentication/strategies.rb', line 19

def clear!
  _strategies.clear
end

.listObject



23
24
25
# File 'lib/sms_candy/authentication/strategies.rb', line 23

def list
  _strategies
end