Sha256: 58653725ca31efeb4fb7216a33c7e0cc69a0b6a9b6f93180e8389fbbe2052c36

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

require 'facemock/database'
require 'facemock/database/table'
require 'sqlite3'
require 'hashie'

module Facemock
  class Database
    class Application < Table
      TABLE_NAME = :applications
      COLUMN_NAMES = [:id, :secret, :created_at]

      def initialize(options={})
        opts = Hashie::Mash.new(options)
        @id         = ( opts.id.to_i > 0 ) ? opts.id.to_i : (0..9).to_a.shuffle[0..15].join.to_i
        @secret     = opts.secret  || Digest::SHA512.hexdigest(identifier.to_s)
        @created_at = opts.created_at
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facemock-0.0.5 lib/facemock/database/application.rb