Sha256: 875c4945e84d97cfde2b5f49f56902547e060f25946f15ce0861fe2a18549009

Contents?: true

Size: 1.16 KB

Versions: 12

Compression:

Stored size: 1.16 KB

Contents

module Coprl
  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 Coprl::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

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.6 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.5 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.4 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.3 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.2 lib/coprl/presenters/dsl/components/mixins/last_response.rb
coprl-3.0.0.beta.1 lib/coprl/presenters/dsl/components/mixins/last_response.rb