Class: Voom::Presenters::DSL::Components::Mixins::LastResponse::ActionParameter

Inherits:
Object
  • Object
show all
Includes:
Serializer
Defined in:
lib/voom/presenters/dsl/components/mixins/last_response.rb

Overview

Defines a client side dynamic parameter used by an action Example usage:

updates forte_path, params: params
updates update_portal_path(portal_id: portal.id, token: last_response.token)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Serializer

#to_hash

Constructor Details

#initialize(index = 0) ⇒ ActionParameter

Returns a new instance of ActionParameter.



16
17
18
19
20
# File 'lib/voom/presenters/dsl/components/mixins/last_response.rb', line 16

def initialize(index=0)
  @value = []
  @type = :action_parameter
  @response_index = index
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



30
31
32
33
# File 'lib/voom/presenters/dsl/components/mixins/last_response.rb', line 30

def method_missing(name, *args, &block)
  @value << name
  self
end

Instance Attribute Details

#response_indexObject (readonly)

Returns the value of attribute response_index.



14
15
16
# File 'lib/voom/presenters/dsl/components/mixins/last_response.rb', line 14

def response_index
  @response_index
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'lib/voom/presenters/dsl/components/mixins/last_response.rb', line 14

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



14
15
16
# File 'lib/voom/presenters/dsl/components/mixins/last_response.rb', line 14

def value
  @value
end

Instance Method Details

#dynamic_parameterObject



22
23
24
# File 'lib/voom/presenters/dsl/components/mixins/last_response.rb', line 22

def dynamic_parameter
  true
end

#to_hObject



35
36
37
# File 'lib/voom/presenters/dsl/components/mixins/last_response.rb', line 35

def to_h
  to_hash(false)
end