Sha256: 8ab26371f52840517e8de358c3b524f6e73e84f988c174710fe8506d3374b08e

Contents?: true

Size: 938 Bytes

Versions: 1

Compression:

Stored size: 938 Bytes

Contents

require 'orm_adapter/adapters/mongoid'

module TokenAction
  # A token to authenticate an action.
  class Token
    include Mongoid::Document
    include Mongoid::Timestamps

    include TokenAction::Model

    # A shared secret.
    # @return [String] a token
    field :token, type: String

    # The class on which to perform the action.
    # @return [String] a class name
    # @note `class` clashes with `Object#class` and Mongoid reserves `klass`.
    field :kind, type: String

    # Any additional arguments for the action.
    # @return [Array] a list of arguments
    field :args, type: Array

    # The URL to redirect to after performing the action successfully.
    # @return [String] a URL or path
    field :success_url, type: String

    # The URL to redirect to after failing to perform the action.
    # @return [String] a URL or path
    field :failure_url, type: String

    index({token: 1}, unique: true)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
token_action-0.0.2 lib/token_action/orm/mongoid.rb