get-twitter-oauth-token 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +8 -0
- data/Rakefile +18 -0
- data/VERSION +1 -0
- data/bin/get-twitter-oauth-token +41 -0
- metadata +80 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 jugyo
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "get-twitter-oauth-token"
|
8
|
+
gem.summary = %Q{The "get-twitter-oauth-token" is a command to get OAuth token.}
|
9
|
+
gem.description = %Q{The "get-twitter-oauth-token" is a command to get OAuth token. Let's get OAuth token!}
|
10
|
+
gem.email = "jugyo.org@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/jugyo/get-twitter-oauth-token"
|
12
|
+
gem.authors = ["jugyo"]
|
13
|
+
gem.add_dependency "oauth", ">= 0"
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.1
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require 'oauth'
|
5
|
+
|
6
|
+
class String
|
7
|
+
def color num
|
8
|
+
"\e[#{num}m#{self}\e[0m"
|
9
|
+
end
|
10
|
+
|
11
|
+
def ask
|
12
|
+
print "#{self}"
|
13
|
+
gets.strip
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
begin
|
18
|
+
consumer_key = 'Consumer Key: '.color(36).ask
|
19
|
+
consumer_secret = 'Consumer Secret: '.color(36).ask
|
20
|
+
|
21
|
+
consumer = OAuth::Consumer.new(
|
22
|
+
consumer_key,
|
23
|
+
consumer_secret,
|
24
|
+
:site => 'http://api.twitter.com'
|
25
|
+
)
|
26
|
+
|
27
|
+
request_token = consumer.get_request_token
|
28
|
+
|
29
|
+
system('open', request_token.authorize_url) || puts("Access here: #{request_token.authorize_url}\nand...")
|
30
|
+
pin = 'PIN: '.color(32).ask
|
31
|
+
|
32
|
+
access_token = request_token.get_access_token(
|
33
|
+
:oauth_token => request_token.token,
|
34
|
+
:oauth_verifier => pin
|
35
|
+
)
|
36
|
+
|
37
|
+
puts "Token: ".color(35) + access_token.token
|
38
|
+
puts "Secret: ".color(35) + access_token.secret
|
39
|
+
rescue
|
40
|
+
puts "Error: #{$!}".color(31)
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: get-twitter-oauth-token
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- jugyo
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-02 00:00:00 +09:00
|
18
|
+
default_executable: get-twitter-oauth-token
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: oauth
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
description: The "get-twitter-oauth-token" is a command to get OAuth token. Let's get OAuth token!
|
33
|
+
email: jugyo.org@gmail.com
|
34
|
+
executables:
|
35
|
+
- get-twitter-oauth-token
|
36
|
+
extensions: []
|
37
|
+
|
38
|
+
extra_rdoc_files:
|
39
|
+
- LICENSE
|
40
|
+
- README.rdoc
|
41
|
+
files:
|
42
|
+
- .document
|
43
|
+
- .gitignore
|
44
|
+
- LICENSE
|
45
|
+
- README.rdoc
|
46
|
+
- Rakefile
|
47
|
+
- VERSION
|
48
|
+
- bin/get-twitter-oauth-token
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/jugyo/get-twitter-oauth-token
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- --charset=UTF-8
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.3.6
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: The "get-twitter-oauth-token" is a command to get OAuth token.
|
79
|
+
test_files: []
|
80
|
+
|