Permalink
Browse files

rebranding, add followers support and some bugfixes

  • Loading branch information...
nov
nov committed Mar 4, 2009
1 parent 1cb3d40 commit b59e610a89100fc9064cc1e0077f4aa9b6467501
View
@@ -13,7 +13,7 @@
== 0.1.0
-* add Iknow::Auth (supports basic_auth and oauth)
+* add Smartfm::Auth (supports basic_auth and oauth)
* add List#create, List#delete, List#add_item, List#delete_item
== 0.1.1
@@ -30,4 +30,9 @@
== 0.2.2
-* add attribution support for add_image & add_sound APIs
+* add attribution support for add_image & add_sound APIs
+
+== 0.3.0
+
+* iKnow! => smart.fm
+* now, iKnow! is the name of Flash study application
View
22 README
@@ -1,19 +1,19 @@
-= iknow
+= smart.fm
- by nov <developer@iknow.co.jp>
+ by nov <nov@cerego.com>
== Description
- This rubygem is a wrapper of iKnow! API.
+ This rubygem is a wrapper of smart.fm API.
You can get pure-ruby example at examples/pure_ruby.rb.
- http://github.com/nov/iknow/tree/master/examples/pure_ruby.rb
+ http://github.com/nov/smartfm/tree/master/examples/pure_ruby.rb
It shows all API calls you can use with this gem.
== Installation
- git clone http://github.com/nov/iknow.git
- cd iknow
+ git clone http://github.com/nov/smartfm.git
+ cd smartfm
rake install
=== Archive Installation
@@ -22,7 +22,7 @@
=== Gem Installation
- gem install iknow
+ gem install smartfm
== Features/Problems
@@ -31,15 +31,15 @@
Create/Add/Delete APIs are not implemented.
They will be implemented in a few weeks.
- iKnow! OAuth is still pre-alpha.
+ smart.fm OAuth is still pre-alpha.
== Synopsis
- See examples and iKnow! Developers, please.
- iKnow! Developers (http://developer.iknow.co.jp)
+ See examples and smart.fm Developers, please.
+ smart.fm Developers (http://developer.smart.fm)
== Copyright
-Author:: nov <developer@iknow.co.jp>
+Author:: nov <nov@cerego.com>
Copyright:: Copyright (c) 2008 nov
License:: MIT License
View
@@ -10,17 +10,17 @@ require 'rake/contrib/sshpublisher'
require 'fileutils'
include FileUtils
-NAME = "iknow"
+NAME = "smartfm"
AUTHOR = "nov"
-EMAIL = "developer@iknow.co.jp"
-DESCRIPTION = "A rubygem for iKnow! APIs"
+EMAIL = "developer@smart.fm"
+DESCRIPTION = "A rubygem for smart.fm APIs"
RUBYFORGE_PROJECT = NAME
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
BIN_FILES = %w( )
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib"
-require 'lib/iknow'
-VERS = Iknow::Version.to_version
+require 'lib/smartfm'
+VERS = Smartfm::Version.to_version
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
RDOC_OPTS = [
@@ -41,6 +41,12 @@ Rake::TestTask.new("test") do |t|
t.verbose = true
end
+Rake::TestTask.new("spec") do |t|
+ t.libs << "spec"
+ t.pattern = "spec/**/*_spec.rb"
+ t.verbose = true
+end
+
spec = Gem::Specification.new do |s|
s.name = NAME
s.version = VERS
@@ -65,7 +71,7 @@ spec = Gem::Specification.new do |s|
# s.required_ruby_version = '>= 1.8.6'
s.files = %w(README ChangeLog Rakefile) +
- Dir.glob("{bin,doc,test,lib,templates,extras,website,script}/**/*") +
+ Dir.glob("{bin,doc,test,spec,lib,templates,extras,website,script}/**/*") +
Dir.glob("ext/**/*.{h,c,rb}") +
Dir.glob("examples/**/*.rb") +
Dir.glob("tools/*.rb") +
View
@@ -1,9 +1,9 @@
require 'rubygems'
-require 'iknow'
+require 'smartfm'
require 'oauth/consumer'
-Iknow::Config.init do |conf|
- conf.api_host = 'api.iknow.co.jp'
+Smartfm::Config.init do |conf|
+ conf.api_host = 'api.smart.fm'
conf.api_key = '' # 'SET_YOUR_API_KEY'
conf.oauth_consumer_key = '' # 'SET_YOUR_OAUTH_CONSUMER_KEY'
conf.oauth_consumer_secret = '' # 'SET_YOUR_OAUTH_CONSUMER_SECRET'
@@ -17,20 +17,20 @@
OAUTH_ACCESS_TOKEN_SECRET = ''
# Edit here
-IKNOW_USERNAME = ''
-IKNOW_PASSWORD = ''
+SMARTFM_USERNAME = ''
+SMARTFM_PASSWORD = ''
please_get_api_key =<<EOS
-This example needs your own iKnow! API key.
-(for only Iknow::Item.extract example)
+This example needs your own smart.fm API key.
+(for only Smartfm::Item.extract example)
-You can get iKnow! API key at iKnow! Developers.
-iKnow! Developers (http://developer.iknow.co.jp/)
+You can get smart.fm API key at smart.fm Developers.
+smart.fm Developers (http://developer.smart.fm/)
Thanks!
EOS
-if Iknow::Config.api_key == ''
+if Smartfm::Config.api_key == ''
raise ArgumentError.new(please_get_api_key)
end
@@ -43,76 +43,76 @@
## User API
puts "# User API Calls"
-@user = Iknow::User.find('kirk')
+@user = Smartfm::User.find('kirk')
@user.items(:include_sentences => true)
@user.lists
@user.friends
@user.study.results
@user.study.total_summary
-@matched_users = Iknow::User.matching('matake')
+@matched_users = Smartfm::User.matching('matake')
## List API
puts "# List API Calls"
-@recent_lists = Iknow::List.recent
-@list = Iknow::List.find(31509, :include_sentences => true, :include_items => true)
+@recent_lists = Smartfm::List.recent
+@list = Smartfm::List.find(31509, :include_sentences => true, :include_items => true)
@list.items
@list.sentences
-@matched_lists = Iknow::List.matching("イタリア語であいさつ")
+@matched_lists = Smartfm::List.matching("イタリア語であいさつ")
## Item API
puts "# Item API Calls"
-@recent_items = Iknow::Item.recent(:include_sentences => true)
-@item = Iknow::Item.find(437525)
-@matched_items = Iknow::Item.matching('record', :include_sentences => true)
-@items = Iknow::Item.extract("sometimes, often, electrical")
+@recent_items = Smartfm::Item.recent(:include_sentences => true)
+@item = Smartfm::Item.find(437525)
+@matched_items = Smartfm::Item.matching('record', :include_sentences => true)
+@items = Smartfm::Item.extract("sometimes, often, electrical")
@items.first.sentences
## Sentence API
puts "# Sentence API Calls"
-@recent_sentences = Iknow::Sentence.recent
-@sentence = Iknow::Sentence.find(312271)
-@matched_sentences = Iknow::Sentence.matching('record')
+@recent_sentences = Smartfm::Sentence.recent
+@sentence = Smartfm::Sentence.find(312271)
+@matched_sentences = Smartfm::Sentence.matching('record')
########################
## WITH AUTHORIZATION ##
########################
-iknow_auth = case
+auth = case
when !OAUTH_ACCESS_TOKEN.empty?
- if Iknow::Config.oauth_consumer_key.empty? or Iknow::Config.oauth_consumer_secret.empty?
+ if Smartfm::Config.oauth_consumer_key.empty? or Smartfm::Config.oauth_consumer_secret.empty?
raise ArgumentError.new("oauth_consumer_key and oauth_consumer_secret are required")
end
- Iknow::Auth.new(:token => OAUTH_ACCESS_TOKEN, :secret => OAUTH_ACCESS_TOKEN_SECRET)
- when IKNOW_USERNAME != ''
- Iknow::Auth.new(:username => IKNOW_USERNAME, :password => IKNOW_PASSWORD)
+ Smartfm::Auth.new(:token => OAUTH_ACCESS_TOKEN, :secret => OAUTH_ACCESS_TOKEN_SECRET)
+ when SMARTFM_USERNAME != ''
+ Smartfm::Auth.new(:username => SMARTFM_USERNAME, :password => SMARTFM_PASSWORD)
else
nil
end
-unless iknow_auth
+unless auth
puts "Skip calls which require authentication"
exit
else
- puts "## WITH AUTHORIZATION :: #{iknow_auth.mode}"
+ puts "## WITH AUTHORIZATION :: #{auth.mode}"
end
## List API
puts "# List API"
-@list = Iknow::List.create(iknow_auth, :title => 'iKnow! gem test', :description => 'A list for iKnow! gem test')
-@list.add_item(iknow_auth, Iknow::Item.find(437525))
-@list.delete_item(iknow_auth, @list.items.first)
-@list.delete(iknow_auth)
+@list = Smartfm::List.create(auth, :title => 'smart.fm gem test', :description => 'A list for smart.fm gem test')
+@list.add_item(auth, Smartfm::Item.find(437525))
+@list.delete_item(auth, @list.items.first)
+@list.delete(auth)
## Item API
puts "# Item API"
-@item = Iknow::Item.create(iknow_auth, :cue => {:text => 'hello world! 2', :language => 'en', :part_of_speech => 'E'},
+@item = Smartfm::Item.create(auth, :cue => {:text => 'hello world! 2', :language => 'en', :part_of_speech => 'E'},
:response => {:text => 'ハローワールド!', :language => 'ja'})
-@item.add_image(iknow_auth, 'http://farm4.static.flickr.com/3276/3102381796_a33c1ffdf1.jpg')
-@item.add_sound(iknow_auth, 'http://matake.jp/download/hello_world.mp3')
-@item.add_tags(iknow_auth, 'sample', 'programming')
+@item.add_image(auth, 'http://farm4.static.flickr.com/3276/3102381796_a33c1ffdf1.jpg')
+@item.add_sound(auth, 'http://matake.jp/download/hello_world.mp3')
+@item.add_tags(auth, 'sample', 'programming')
## Sentence API
puts "# Sentence API"
-@sentence = Iknow::Sentence.create(iknow_auth, :text => 'Hello World!', :item => Iknow::Item.matching('hello world').first)
-@sentence.add_image(iknow_auth, 'http://farm4.static.flickr.com/3276/3102381796_a33c1ffdf1.jpg')
-@sentence.add_sound(iknow_auth, 'http://matake.jp/download/hello_world.mp3')
+@sentence = Smartfm::Sentence.create(auth, :text => 'Hello World!', :item => Smartfm::Item.matching('hello world').first)
+@sentence.add_image(auth, 'http://farm4.static.flickr.com/3276/3102381796_a33c1ffdf1.jpg')
+@sentence.add_sound(auth, 'http://matake.jp/download/hello_world.mp3')
View
@@ -1,38 +0,0 @@
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{iknow}
- s.version = "0.2.4"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["nov"]
- s.date = %q{2009-01-03}
- s.description = %q{A rubygem for iKnow! APIs}
- s.email = %q{developer@iknow.co.jp}
- s.extra_rdoc_files = ["README", "ChangeLog"]
- s.files = ["README", "ChangeLog", "Rakefile", "test/iknow_test.rb", "test/test_helper.rb", "lib/ext", "lib/ext/hash.rb", "lib/iknow", "lib/iknow/core", "lib/iknow/core/auth.rb", "lib/iknow/core/config.rb", "lib/iknow/core/version.rb", "lib/iknow/core.rb", "lib/iknow/model", "lib/iknow/model/base.rb", "lib/iknow/model/item.rb", "lib/iknow/model/list.rb", "lib/iknow/model/sentence.rb", "lib/iknow/model/user.rb", "lib/iknow/model.rb", "lib/iknow/rest_client", "lib/iknow/rest_client/base.rb", "lib/iknow/rest_client/item.rb", "lib/iknow/rest_client/list.rb", "lib/iknow/rest_client/sentence.rb", "lib/iknow/rest_client/user.rb", "lib/iknow/rest_client.rb", "lib/iknow.rb", "examples/pure_ruby.rb"]
- s.has_rdoc = true
- 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.rubyforge_project = %q{iknow}
- s.rubygems_version = %q{1.3.1}
- s.summary = %q{A rubygem for iKnow! APIs}
- s.test_files = ["test/iknow_test.rb"]
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 2
-
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<json>, [">= 0"])
- s.add_runtime_dependency(%q<oauth>, [">= 0"])
- else
- s.add_dependency(%q<json>, [">= 0"])
- s.add_dependency(%q<oauth>, [">= 0"])
- end
- else
- s.add_dependency(%q<json>, [">= 0"])
- s.add_dependency(%q<oauth>, [">= 0"])
- end
-end
View
@@ -1,16 +0,0 @@
-module Iknow
-end
-
-require 'date'
-require 'net/https'
-require 'uri'
-
-require 'rubygems'
-require 'json'
-
-require 'ext/hash'
-require 'iknow/core'
-require 'iknow/rest_client'
-require 'iknow/model'
-
-Iknow::Config.init
View
@@ -1,3 +0,0 @@
-require 'iknow/core/version'
-require 'iknow/core/config'
-require 'iknow/core/auth'
View
@@ -1,39 +0,0 @@
-require 'oauth/consumer'
-
-class Iknow::Auth
- attr_accessor :mode, :auth_token
-
- class Basic
- attr_reader :username, :password
-
- def initialize(username, password)
- @username = username
- @password = password
- end
- end
-
- def initialize(options = {})
- if options[:username] && options[:password]
- @mode = :basic_auth
- @auth_token = Basic.new(options[:username], options[:password])
- elsif options[:token] && options[:secret]
- @mode = :oauth
- @auth_token = OAuth::AccessToken.new(Iknow::Auth.consumer, options[:token], options[:secret])
- else
- raise ArgumentError.new('{:auth => "oauth_access_token", :secret => "oauth_access_token_secret"} or {:username "iknow_username", :password => "iknow_password"} is needed')
- end
- end
-
- def self.consumer
- @@consumer ||= OAuth::Consumer.new(
- Iknow::Config.oauth_consumer_key,
- Iknow::Config.oauth_consumer_secret,
- :http_method => Iknow::Config.oauth_http_method,
- :scheme => Iknow::Config.oauth_scheme,
- :site => Iknow::Config.api_base_url,
- :authorize_url => "#{Iknow::Config.base_url}/oauth/authorize"
- )
- end
-
- alias_method :account, :auth_token
-end
Oops, something went wrong.

0 comments on commit b59e610

Please sign in to comment.