Class: Twimock::RequestToken

Inherits:
Database::Table show all
Defined in:
lib/twimock/request_token.rb

Constant Summary collapse

TABLE_NAME =
:request_tokens
COLUMN_NAMES =
[:id, :string, :secret, :verifier, :application_id, :user_id, :created_at]

Constants inherited from Database::Table

Database::Table::CHILDREN

Instance Method Summary collapse

Methods inherited from Database::Table

all, children, #column_names, column_names, column_type, create!, #destroy, #fetch, first, last, #method_missing, method_missing, #persisted?, #save!, table_info, #table_name, table_name, #update_attributes!, where

Constructor Details

#initialize(options = {}) ⇒ RequestToken

Returns a new instance of RequestToken.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/twimock/request_token.rb', line 9

def initialize(options={})
  opts = Hashie::Mash.new(options)
  id = opts.id.to_i
  @id             = id if id > 0
  @string         = opts.string   || Faker::Lorem.characters(32)
  @secret         = opts.secret   || Faker::Lorem.characters(32)
  @verifier       = opts.verifier || Faker::Lorem.characters(32)
  app_id = opts.application_id.to_i
  @application_id = app_id if app_id > 0
  user_id = opts.user_id.to_i
  @user_id        = user_id if user_id > 0
  @created_at     = opts.created_at
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Twimock::Database::Table