Class: Iknow::Config
- Inherits:
-
Object
- Object
- Iknow::Config
- Includes:
- Singleton
- Defined in:
- lib/iknow/core/config.rb
Instance Attribute Summary collapse
-
#api_host ⇒ Object
Returns the value of attribute api_host.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_port ⇒ Object
Returns the value of attribute api_port.
-
#api_protocol ⇒ Object
Returns the value of attribute api_protocol.
-
#application_name ⇒ Object
Returns the value of attribute application_name.
-
#application_url ⇒ Object
Returns the value of attribute application_url.
-
#application_version ⇒ Object
Returns the value of attribute application_version.
-
#host ⇒ Object
Returns the value of attribute host.
-
#oauth_consumer_key ⇒ Object
Returns the value of attribute oauth_consumer_key.
-
#oauth_consumer_secret ⇒ Object
Returns the value of attribute oauth_consumer_secret.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#source ⇒ Object
Returns the value of attribute source.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#api_host ⇒ Object
Returns the value of attribute api_host.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def api_host @api_host end |
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def api_key @api_key end |
#api_port ⇒ Object
Returns the value of attribute api_port.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def api_port @api_port end |
#api_protocol ⇒ Object
Returns the value of attribute api_protocol.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def api_protocol @api_protocol end |
#application_name ⇒ Object
Returns the value of attribute application_name.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def application_name @application_name end |
#application_url ⇒ Object
Returns the value of attribute application_url.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def application_url @application_url end |
#application_version ⇒ Object
Returns the value of attribute application_version.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def application_version @application_version end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def host @host end |
#oauth_consumer_key ⇒ Object
Returns the value of attribute oauth_consumer_key.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def oauth_consumer_key @oauth_consumer_key end |
#oauth_consumer_secret ⇒ Object
Returns the value of attribute oauth_consumer_secret.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def oauth_consumer_secret @oauth_consumer_secret end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def protocol @protocol end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def source @source end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def timeout @timeout end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
5 6 7 |
# File 'lib/iknow/core/config.rb', line 5 def user_agent @user_agent end |
Class Method Details
.init {|conf| ... } ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/iknow/core/config.rb', line 9 def self.init(&block) conf = Iknow::Config.instance { :protocol => 'http', :host => 'www.iknow.co.jp', :port => 80, :api_protocol => 'http', :api_host => 'api.iknow.co.jp', :api_port => 80, :timeout => 5, :api_key => '', :oauth_consumer_key => '', :oauth_consumer_secret => '', :user_agent => 'default', :application_name => 'iKnow! Gem', :application_version => Iknow::Version.to_version, :application_url => 'http://github.com/nov/iknow' }.each do |key, value| conf.send("#{key}=", value) end yield conf if block_given? conf end |
.method_missing(method, *args) ⇒ Object
40 41 42 |
# File 'lib/iknow/core/config.rb', line 40 def self.method_missing(method, *args) self.instance.send(method, *args) end |
Instance Method Details
#iknow_api_base_url ⇒ Object
35 36 37 38 |
# File 'lib/iknow/core/config.rb', line 35 def iknow_api_base_url port = self.api_port==80 ? nil : ":#{self.api_port}" "#{self.api_protocol}://#{self.api_host}#{port}" end |
#iknow_base_url ⇒ Object
30 31 32 33 |
# File 'lib/iknow/core/config.rb', line 30 def iknow_base_url port = self.port==80 ? nil : ":#{self.port}" "#{self.protocol}://#{self.host}#{port}" end |