daum_oauth 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest CHANGED
@@ -1,4 +1,3 @@
1
- README
2
1
  README.rdoc
3
2
  Rakefile
4
3
  lib/daum_oauth.rb
@@ -6,5 +5,4 @@ lib/daum_oauth/blog.rb
6
5
  lib/daum_oauth/cafe.rb
7
6
  lib/daum_oauth/client.rb
8
7
  lib/daum_oauth/yozm.rb
9
- text.rdoc
10
8
  Manifest
data/README.rdoc CHANGED
@@ -1,3 +1,60 @@
1
1
  = Daum OAuth
2
2
 
3
- Daum OAuth client API library for ruby.
3
+ == About
4
+
5
+ This is Daum OAuth client API library for ruby.
6
+
7
+ Motivated by moomerman's twitter_oauth gem
8
+ (http://github.com/moomerman/twitter_oauth)
9
+
10
+ OAuth specs: http://oauth.net/core/1.0/
11
+
12
+ OAuth Introduction @ Daum DNA: http://apis.daum.net/oauth/
13
+
14
+ == Installing
15
+
16
+ sudo gem install daum_oauth
17
+
18
+ Source code is available at http://github.com/thefron/daum_oauth
19
+
20
+ == Usage
21
+
22
+ client = DaumOAuth::Client.new(
23
+ :consumer_key => 'YOUR_APP_CONSUMER_KEY',
24
+ :consumer_secret => 'YOUR_APP_CONSUMER_SECRET'
25
+ )
26
+ request_token = client.request_token(:oauth_callback => 'callback_url')
27
+ #:oauth_callback must be specified
28
+
29
+ request_token.authorize_url
30
+ => https://apis.daum.net/oauth/authorize?oauth_token=TOKEN
31
+
32
+ In your application, make users redirect to the authorize_url(daum). Before redirection, store the request token and secret(usually in the session).Then users will authorize the application and be redirected to callback_url you've specified before.
33
+
34
+ Then in callback procedure,
35
+
36
+ access_token = client.authorize(
37
+ request_token.token,
38
+ request_token.secret,
39
+ :oauth_verifier => params[:oauth_verifier]
40
+ )
41
+
42
+ #For now, there's no method for checking authorization's validity.
43
+ #At least, you can try this if your application makes use of yozm.
44
+ client.yozm_authorized?
45
+ => true
46
+
47
+ client.yozm_add 'message here' # sends a yozm message
48
+
49
+ Now if you can keep access_token(usually in the database) for this user, you won't need re-authorize them next time. Just initialize a client instance with stored access_token when needed.
50
+
51
+ access_token = @user.access_token #assuming @user
52
+
53
+ client = DaumOAuth::Client.new(
54
+ :consumer_key => 'YOUR_APP_CONSUMER_KEY',
55
+ :consumer_secret => 'YOUR_APP_CONSUMER_SECRET',
56
+ :token => access_token.token,
57
+ :secret=> access_token.secret
58
+ )
59
+
60
+ You are ready to access protected resource.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('daum_oauth', '0.1.1') do |p|
5
+ Echoe.new('daum_oauth', '0.1.2') do |p|
6
6
  p.description = 'Daum OAuth API client library for ruby'
7
7
  p.url = 'http://github.com/thefron/daum_oauth'
8
8
  p.author = 'Hoseong Hwang'
data/daum_oauth.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{daum_oauth}
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Hoseong Hwang"]
9
- s.date = %q{2010-11-02}
9
+ s.date = %q{2010-11-16}
10
10
  s.description = %q{Daum OAuth API client library for ruby}
11
11
  s.email = %q{thefron@wafflestudio.com}
12
- s.extra_rdoc_files = ["README", "README.rdoc", "lib/daum_oauth.rb", "lib/daum_oauth/blog.rb", "lib/daum_oauth/cafe.rb", "lib/daum_oauth/client.rb", "lib/daum_oauth/yozm.rb"]
13
- s.files = ["README", "README.rdoc", "Rakefile", "lib/daum_oauth.rb", "lib/daum_oauth/blog.rb", "lib/daum_oauth/cafe.rb", "lib/daum_oauth/client.rb", "lib/daum_oauth/yozm.rb", "text.rdoc", "Manifest", "daum_oauth.gemspec"]
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/daum_oauth.rb", "lib/daum_oauth/blog.rb", "lib/daum_oauth/cafe.rb", "lib/daum_oauth/client.rb", "lib/daum_oauth/yozm.rb"]
13
+ s.files = ["README.rdoc", "Rakefile", "lib/daum_oauth.rb", "lib/daum_oauth/blog.rb", "lib/daum_oauth/cafe.rb", "lib/daum_oauth/client.rb", "lib/daum_oauth/yozm.rb", "Manifest", "daum_oauth.gemspec"]
14
14
  s.homepage = %q{http://github.com/thefron/daum_oauth}
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Daum_oauth", "--main", "README"]
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Daum_oauth", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{daum_oauth}
18
18
  s.rubygems_version = %q{1.3.7}
@@ -17,15 +17,40 @@ module DaumOAuth
17
17
  return get("/yozm/v1_0/user/show.json")
18
18
  elsif options[:url_name]
19
19
  return get("/yozm/v1_0/user/show.json?url_name=#{options[:url_name]}")
20
- else options[:nick_name]
20
+ elsif options[:nick_name]
21
21
  return get("/yozm/v1_0/user/show.json?nick_name=#{options[:nick_name]}")
22
+ else
23
+ return get("/yozm/v1_0/user/show.json")
22
24
  end
23
25
  end
24
26
 
25
27
  #send a message to yozm
26
- def yozm_add(message, options={})
27
- get("/yozm/v1_0/message/add.json?#{options.merge(:message => URI.encode(message)).collect{|k, v| "#{k}=#{v}"}.join('&')}")
28
- #post("/yozm/v1_0/message/add.json", {:message => message})
28
+ def yozm_add(message, options={}) #available options: url_shorten, img_url, parent_msg_id
29
+ #get("/yozm/v1_0/message/add.json?#{options.merge(:message => URI.encode(message)).collect{|k, v| "#{k}=#{v}"}.join('&')}")
30
+ post("/yozm/v1_0/message/add.json", options.merge(:message => message))
31
+ end
32
+
33
+ #check if a user joined yozm
34
+ def yozm_joined?
35
+ get("/yozm/v1_0/user/joined.json")
36
+ end
37
+
38
+ #join yozm
39
+ def yozm_join(nickname, options={}) #available options: sex(N/F/M), birthday(1984-11-14), blood_type(N/A/B/AB/O)
40
+ post("/yozm/v1_0/user/join.json", options.merge(:nickname => nickname))
41
+ end
42
+
43
+ def yozm_search(q, options={}) #available options: type(message - default, tag), page, count
44
+ get("/yozm/v1_0/timeline/search.json?#{options.merge(:q => q).collect{|k,v| "#{k}=#{v}"}.join('&')}")
45
+ end
46
+
47
+ def yozm_home_timeline(options={}) #available options: max_msg_id, since_msg_id, count
48
+ get("/yozm/v1_0/timeline/home.json?#{options.collect{|k,v| "#{k}=#{v}"}.join('&')}")
29
49
  end
50
+
51
+ def yozm_user_timeline(url_name, options={}) #available options: next(=since_msg_id?, count)
52
+ get("/yozm/v1_0/timeline/user.json?#{options.merge(:url_name => url_name).collect{|k,v| "#{k}=#{v}"}.join('&')}")
53
+ end
54
+
30
55
  end
31
56
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daum_oauth
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Hoseong Hwang
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-02 00:00:00 +09:00
18
+ date: 2010-11-16 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -26,7 +26,6 @@ executables: []
26
26
  extensions: []
27
27
 
28
28
  extra_rdoc_files:
29
- - README
30
29
  - README.rdoc
31
30
  - lib/daum_oauth.rb
32
31
  - lib/daum_oauth/blog.rb
@@ -34,7 +33,6 @@ extra_rdoc_files:
34
33
  - lib/daum_oauth/client.rb
35
34
  - lib/daum_oauth/yozm.rb
36
35
  files:
37
- - README
38
36
  - README.rdoc
39
37
  - Rakefile
40
38
  - lib/daum_oauth.rb
@@ -42,7 +40,6 @@ files:
42
40
  - lib/daum_oauth/cafe.rb
43
41
  - lib/daum_oauth/client.rb
44
42
  - lib/daum_oauth/yozm.rb
45
- - text.rdoc
46
43
  - Manifest
47
44
  - daum_oauth.gemspec
48
45
  has_rdoc: true
@@ -56,7 +53,7 @@ rdoc_options:
56
53
  - --title
57
54
  - Daum_oauth
58
55
  - --main
59
- - README
56
+ - README.rdoc
60
57
  require_paths:
61
58
  - lib
62
59
  required_ruby_version: !ruby/object:Gem::Requirement
data/README DELETED
File without changes
data/text.rdoc DELETED
File without changes