Sha256: 2fd2d88e7ada96d7f67c5f0814f170b27237009b32026380c0874e5018590b95

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

require 'faker'
require 'twimock/database/table'
require 'twimock/access_token'
require 'twimock/request_token'

module Twimock
  class Application < Database::Table
    TABLE_NAME = :applications
    COLUMN_NAMES = [:id, :api_key, :api_secret, :created_at]
    CHILDREN = [ Twimock::AccessToken, Twimock::RequestToken ]

    # WANT : DBに登録済みの値と重複しないようにする(id, api_secret)
    def initialize(options={})
      opts = Hashie::Mash.new(options)
      @id         = ( opts.id.to_i > 0 ) ? opts.id.to_i : Faker::Number.number(10).to_i
      @api_key        = opts.api_key    || Faker::Lorem.characters(25)
      @api_secret     = opts.api_secret || Faker::Lorem.characters(50)
      @created_at = opts.created_at
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twimock-0.0.2 lib/twimock/application.rb
twimock-0.0.1 lib/twimock/application.rb