Module: DiandianOAuth::Client::Callbacks::ClassMethods

Defined in:
lib/diandian_oauth/client/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#callbacks(name = nil) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/diandian_oauth/client/callbacks.rb', line 25

def callbacks name=nil
  if name
    @callbacks[name] ||= []
  else
    @callbacks
  end
end

#callbacks=(callbacks) ⇒ Object



32
33
34
# File 'lib/diandian_oauth/client/callbacks.rb', line 32

def callbacks= callbacks
  @callbacks = callbacks
end

#token_refreshed(proc_or_method) ⇒ Object



35
36
37
# File 'lib/diandian_oauth/client/callbacks.rb', line 35

def token_refreshed proc_or_method
  self.callbacks(:token_refreshed) << Callback.new( proc_or_method)
end