Sha256: eafcec400305d14b83f9ae6fc490ff3956783cb5b117a3b76875d4b39ad62ef9

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

module Voom
  module Presenters
    module DSL
      module Components
        module Mixins
          module LastResponse
            # 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)
            class ActionParameter
              include Voom::Serializer

              attr_reader :type, :response_index, :value

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

              def dynamic_parameter
                true
              end

              def type
                :action_parameter
              end

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

              def to_h
                to_hash(false)
              end
            end

            def last_response(index=0)
              ActionParameter.new(index)
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voom-presenters-2.1.2 lib/voom/presenters/dsl/components/mixins/last_response.rb
voom-presenters-2.1.0 lib/voom/presenters/dsl/components/mixins/last_response.rb
voom-presenters-2.0.3 lib/voom/presenters/dsl/components/mixins/last_response.rb
voom-presenters-2.0.2 lib/voom/presenters/dsl/components/mixins/last_response.rb
voom-presenters-2.0.1 lib/voom/presenters/dsl/components/mixins/last_response.rb
voom-presenters-2.0.0 lib/voom/presenters/dsl/components/mixins/last_response.rb