From 346030fb9e4b65d8fe555189a8abf1ffe11fbc40 Mon Sep 17 00:00:00 2001 From: nov Date: Wed, 24 Dec 2008 18:00:33 +0900 Subject: [PATCH] add spec/**/*_spec.rb and bugfixes --- Rakefile | 2 +- iknow.gemspec | 3 +-- lib/iknow.rb | 4 +++- lib/iknow/core/config.rb | 17 +++++++++++------ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Rakefile b/Rakefile index 85ae4fe..2d9588e 100644 --- a/Rakefile +++ b/Rakefile @@ -62,7 +62,7 @@ spec = Gem::Specification.new do |s| s.add_dependency('json') s.add_dependency('oauth') - s.required_ruby_version = '>= 1.8.6' + # s.required_ruby_version = '>= 1.8.6' s.files = %w(README ChangeLog Rakefile) + Dir.glob("{bin,doc,test,lib,templates,extras,website,script}/**/*") + diff --git a/iknow.gemspec b/iknow.gemspec index 8a5070c..0ff6456 100644 --- a/iknow.gemspec +++ b/iknow.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["nov"] - s.date = %q{2008-12-23} + s.date = %q{2008-12-24} s.description = %q{A rubygem for iKnow! APIs} s.email = %q{developer@iknow.co.jp} s.extra_rdoc_files = ["README", "ChangeLog"] @@ -15,7 +15,6 @@ Gem::Specification.new do |s| s.homepage = %q{http://iknow.rubyforge.org} s.rdoc_options = ["--title", "iknow documentation", "--charset", "utf-8", "--opname", "index.html", "--line-numbers", "--main", "README", "--inline-source", "--exclude", "^(examples|extras)/"] s.require_paths = ["lib"] - s.required_ruby_version = Gem::Requirement.new(">= 1.8.6") s.rubyforge_project = %q{iknow} s.rubygems_version = %q{1.3.1} s.summary = %q{A rubygem for iKnow! APIs} diff --git a/lib/iknow.rb b/lib/iknow.rb index e93678f..deb7503 100644 --- a/lib/iknow.rb +++ b/lib/iknow.rb @@ -11,4 +11,6 @@ module Iknow require 'ext/hash' require 'iknow/core' require 'iknow/rest_client' -require 'iknow/model' \ No newline at end of file +require 'iknow/model' + +Iknow::Config.init \ No newline at end of file diff --git a/lib/iknow/core/config.rb b/lib/iknow/core/config.rb index 7e2395a..dc7a7cd 100644 --- a/lib/iknow/core/config.rb +++ b/lib/iknow/core/config.rb @@ -2,9 +2,10 @@ class Iknow::Config include Singleton - attr_accessor :protocol, :host, :port, :api_protocol, :api_host, :api_port, :api_key, :timeout, - :oauth_consumer_key, :oauth_consumer_secret, :oauth_http_method, :oauth_scheme, - :user_agent, :application_name, :application_version, :application_url + ATTRIBUTES = [ :protocol, :host, :port, :api_protocol, :api_host, :api_port, :api_key, :timeout, + :oauth_consumer_key, :oauth_consumer_secret, :oauth_http_method, :oauth_scheme, + :user_agent, :application_name, :application_version, :application_url ] + attr_accessor *ATTRIBUTES def self.init(&block) conf = Iknow::Config.instance @@ -39,8 +40,12 @@ def api_base_url "#{self.api_protocol}://#{self.api_host}#{port}" end - def self.method_missing(method, *args) - self.instance.send(method, *args) + # hack: Object.timeout is already defined.. + def self.timeout + instance.timeout end -end + def self.method_missing(method, *args) + Iknow::Config.instance.send(method, *args) + end +end \ No newline at end of file