Class: HaveAPI::Authentication::Token::ActionConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/haveapi/authentication/token/action_config.rb

Instance Method Summary collapse

Constructor Details

#initialize(block, opts = {}) ⇒ ActionConfig

Returns a new instance of ActionConfig.

Parameters:

  • block (Proc)
  • opts (Hash) (defaults to: {})

Options Hash (opts):



8
9
10
11
12
# File 'lib/haveapi/authentication/token/action_config.rb', line 8

def initialize(block, opts = {})
  @block = block
  @opts = with_defaults(opts)
  update(block)
end

Instance Method Details

#handle {|request, result| ... } ⇒ Object

Handle the action

Yield Parameters:

Yield Returns:



32
33
34
35
36
37
38
# File 'lib/haveapi/authentication/token/action_config.rb', line 32

def handle(&block)
  if block && check!(:handle)
    @handle = block
  else
    @handle
  end
end

#input(&block) ⇒ Object

Configure input parameters in the context of Params



20
21
22
23
24
25
26
# File 'lib/haveapi/authentication/token/action_config.rb', line 20

def input(&block)
  if block && check!(:input)
    @input = block
  else
    @input
  end
end

#update(block) ⇒ Object

Parameters:

  • block (Proc)


15
16
17
# File 'lib/haveapi/authentication/token/action_config.rb', line 15

def update(block)
  instance_exec(&block)
end