iknow 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -28,6 +28,6 @@
28
28
 
29
29
  * maintenance release
30
30
 
31
- == 0.2.
31
+ == 0.2.2
32
32
 
33
33
  * add attribution support for add_image & add_sound APIs
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  = iknow
2
2
 
3
- by nov <nmatake@cerego.co.jp>
3
+ by nov <developer@iknow.co.jp>
4
4
 
5
5
  == Description
6
6
 
@@ -40,6 +40,6 @@
40
40
 
41
41
  == Copyright
42
42
 
43
- Author:: nov <nmatake@cerego.co.jp>
43
+ Author:: nov <developer@iknow.co.jp>
44
44
  Copyright:: Copyright (c) 2008 nov
45
45
  License:: MIT License
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ NAME = "iknow"
14
14
  AUTHOR = "nov"
15
15
  EMAIL = "developer@iknow.co.jp"
16
16
  DESCRIPTION = "A rubygem for iKnow! APIs"
17
- RUBYFORGE_PROJECT = "iknow"
17
+ RUBYFORGE_PROJECT = NAME
18
18
  HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
19
19
  BIN_FILES = %w( )
20
20
 
@@ -60,10 +60,9 @@ spec = Gem::Specification.new do |s|
60
60
  #s.autorequire = ""
61
61
  s.test_files = Dir["test/*_test.rb"]
62
62
 
63
- s.add_dependency('rails', '>=2.1.0')
64
63
  s.add_dependency('json')
65
- s.add_dependency('oauth', '>=0.2.7')
66
- s.required_ruby_version = '>= 1.8.6'
64
+ s.add_dependency('oauth')
65
+ # s.required_ruby_version = '>= 1.8.6'
67
66
 
68
67
  s.files = %w(README ChangeLog Rakefile) +
69
68
  Dir.glob("{bin,doc,test,lib,templates,extras,website,script}/**/*") +
data/lib/iknow.rb CHANGED
@@ -11,4 +11,6 @@ require 'json'
11
11
  require 'ext/hash'
12
12
  require 'iknow/core'
13
13
  require 'iknow/rest_client'
14
- require 'iknow/model'
14
+ require 'iknow/model'
15
+
16
+ Iknow::Config.init
@@ -2,9 +2,10 @@ require 'singleton'
2
2
 
3
3
  class Iknow::Config
4
4
  include Singleton
5
- attr_accessor :protocol, :host, :port, :api_protocol, :api_host, :api_port, :api_key, :timeout,
6
- :oauth_consumer_key, :oauth_consumer_secret, :oauth_http_method, :oauth_scheme,
7
- :user_agent, :application_name, :application_version, :application_url
5
+ ATTRIBUTES = [ :protocol, :host, :port, :api_protocol, :api_host, :api_port, :api_key, :timeout,
6
+ :oauth_consumer_key, :oauth_consumer_secret, :oauth_http_method, :oauth_scheme,
7
+ :user_agent, :application_name, :application_version, :application_url ]
8
+ attr_accessor *ATTRIBUTES
8
9
 
9
10
  def self.init(&block)
10
11
  conf = Iknow::Config.instance
@@ -39,8 +40,12 @@ class Iknow::Config
39
40
  "#{self.api_protocol}://#{self.api_host}#{port}"
40
41
  end
41
42
 
42
- def self.method_missing(method, *args)
43
- self.instance.send(method, *args)
43
+ # hack: Object.timeout is already defined..
44
+ def self.timeout
45
+ instance.timeout
44
46
  end
45
47
 
46
- end
48
+ def self.method_missing(method, *args)
49
+ Iknow::Config.instance.send(method, *args)
50
+ end
51
+ end
@@ -1,7 +1,7 @@
1
1
  module Iknow::Version
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- REVISION = 2
4
+ REVISION = 3
5
5
  class << self
6
6
  def to_version
7
7
  "#{MAJOR}.#{MINOR}.#{REVISION}"
@@ -14,7 +14,7 @@
14
14
  # "author_url": "http://www.iknow.co.jp/user/Cerego"
15
15
 
16
16
  class Iknow::List < Iknow::Base
17
- ATTRIBUTES = [:id, :title, :description, :icon, :item_count, :user_count, :iknow, :dictation, :brainspeed,
17
+ ATTRIBUTES = [:id, :title, :description, :icon, :square_icon, :item_count, :user_count, :iknow, :dictation, :brainspeed,
18
18
  :language, :translation_language, :list_type, :transcript, :embed,
19
19
  :tags, :media_entry, :author, :author_id, :author_url, :attribution_license_id,
20
20
  :items, :sentences]
@@ -64,6 +64,7 @@ class Iknow::List < Iknow::Base
64
64
  @title = params[:title]
65
65
  @description = params[:description]
66
66
  @icon = params[:icon]
67
+ @square_icon = params[:square_icon]
67
68
  @item_count = (params[:item_count].to_i rescue nil)
68
69
  @user_count = (params[:user_count].to_i rescue nil)
69
70
  @language = params[:language]
@@ -1,5 +1,5 @@
1
1
  class Iknow::Sentence < Iknow::Base
2
- ATTRIBUTES = [:sound, :image, :text, :language, :id, :transliterations, :translations, :item, :list]
2
+ ATTRIBUTES = [:sound, :image, :square_image, :text, :language, :id, :transliterations, :translations, :item, :list]
3
3
  READONLY_ATTRIBUTES = [:id]
4
4
  attr_accessor *(ATTRIBUTES - READONLY_ATTRIBUTES)
5
5
  attr_reader *READONLY_ATTRIBUTES
@@ -33,6 +33,7 @@ class Iknow::Sentence < Iknow::Base
33
33
  @list = params[:list]
34
34
  @sound = params[:sound]
35
35
  @image = params[:image]
36
+ @square_image = params[:square_image]
36
37
  @text = params[:text]
37
38
  @language = params[:language]
38
39
  @transliterations = params[:transliterations]
@@ -95,6 +95,7 @@ class Iknow::User < Iknow::Base
95
95
 
96
96
  def study(params = {})
97
97
  params[:application] ||= 'iknow'
98
+ return nil unless ['iknow', 'dictation', 'brainspeed', ].include?(params[:application])
98
99
  hash = Iknow::RestClient::User.study_results(params.merge(:username => self.username))
99
100
  self.deserialize(hash, :as => Iknow::User::Study)
100
101
  end
data/test/iknow_test.rb CHANGED
@@ -2,4 +2,7 @@ require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
3
  require "test/unit"
4
4
  class IknowTest < Test::Unit::TestCase
5
+ def test_truth
6
+ true
7
+ end
5
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iknow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov
@@ -9,19 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-22 00:00:00 +09:00
12
+ date: 2008-12-24 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rails
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 2.1.0
24
- version:
25
15
  - !ruby/object:Gem::Dependency
26
16
  name: json
27
17
  type: :runtime
@@ -40,7 +30,7 @@ dependencies:
40
30
  requirements:
41
31
  - - ">="
42
32
  - !ruby/object:Gem::Version
43
- version: 0.2.7
33
+ version: "0"
44
34
  version:
45
35
  description: A rubygem for iKnow! APIs
46
36
  email: developer@iknow.co.jp
@@ -103,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
93
  requirements:
104
94
  - - ">="
105
95
  - !ruby/object:Gem::Version
106
- version: 1.8.6
96
+ version: "0"
107
97
  version:
108
98
  required_rubygems_version: !ruby/object:Gem::Requirement
109
99
  requirements: