Class: WeixinRailsMiddleware::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/weixin_rails_middleware/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
# File 'lib/weixin_rails_middleware/configuration.rb', line 7

def initialize
  @engine_path  = DEFAULT_ENGINE_PATH
  @token_column = DEFAULT_TOKEN_COLUMN_NAME
end

Instance Attribute Details

#engine_pathObject

use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,



5
6
7
# File 'lib/weixin_rails_middleware/configuration.rb', line 5

def engine_path
  @engine_path
end

#token_columnObject

use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,



5
6
7
# File 'lib/weixin_rails_middleware/configuration.rb', line 5

def token_column
  @token_column
end

#token_modelObject

use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,



5
6
7
# File 'lib/weixin_rails_middleware/configuration.rb', line 5

def token_model
  @token_model
end

#token_stringObject

use ‘token_model’: if the token is saved in SomeModel, then find token by it use ‘token_string’: if the token is a String, just use it,



5
6
7
# File 'lib/weixin_rails_middleware/configuration.rb', line 5

def token_string
  @token_string
end

Instance Method Details

#token_model_classObject



12
13
14
15
16
17
18
19
# File 'lib/weixin_rails_middleware/configuration.rb', line 12

def token_model_class
  raise "You need to config `token_model` in config/initializers/weixin_rails_middleware.rb" if token_model.blank?
  token_model_c = token_model.constantize
  unless token_model_c.table_exists?
    raise "You don't have #{token_model_c.table_name} table"
  end
  token_model_c
end