oauthtoken 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/bin/oatok +3 -0
- data/lib/oauth_token/command/oatok.rb +65 -0
- data/lib/oauth_token/version.rb +3 -0
- data/lib/oauth_token.rb +5 -0
- data/oauthtoken.gemspec +26 -0
- data/spec/oauth_token_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA512:
|
3
|
+
metadata.gz: 095fd3ee4e21ae7de17002d4f8f1009708ad85ffce5300b5dadffe287e6b9218732815955ac7ffd4914943218f64c61a0bbcd3e6d77f84c51f07663a66a0d9b0
|
4
|
+
data.tar.gz: 9f546e6284ea98925fdf13e872e4937cce512f00c73aa6afa550b0c6cdab38dc925682c5ab83de66bae40fe413728a22079e8c30a40e2bbca98c472de10ccd9f
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: 4b8513faa5a88a4d3ce6955358d2c1d985af6266
|
7
|
+
data.tar.gz: 7af193782f35ffdef27b579af837ca442163eba6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Kenji Hara
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Oauthtoken
|
2
|
+
|
3
|
+
'oauthtoken' is a command to get OAuth token.
|
4
|
+
|
5
|
+
## Supported Ruby versions and implementations
|
6
|
+
|
7
|
+
oauthtoken should work identically on:
|
8
|
+
|
9
|
+
* Ruby 1.9.3+
|
10
|
+
* Ruby 2.0.0+
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
gem 'oauthtoken'
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install oauthtoken
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Get Authorize URL:
|
29
|
+
|
30
|
+
$ oatok --url OAUTH_URL --key CONSUMER_KEY --secret CONSUMER_SECRET
|
31
|
+
Authorize URL: https://api.oauth.com/oauth/authorize?oauth_token=OAUTH_TOKEN
|
32
|
+
Enter PIN:
|
33
|
+
|
34
|
+
Access to authorize URL and enter the displayed PIN, then get access token and access token secret:
|
35
|
+
|
36
|
+
Access Token: ACCESS_TOKEN
|
37
|
+
Access Token Secret: ACCESS_TOKEN_SECRET
|
38
|
+
|
39
|
+
Show help:
|
40
|
+
|
41
|
+
$ oatok --help
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
1. Fork it
|
46
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/oatok
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "oauth"
|
3
|
+
require "oauth/consumer"
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
op = OptionParser.new
|
7
|
+
|
8
|
+
consumer_key = nil
|
9
|
+
consumer_secret = nil
|
10
|
+
oauth_url = nil
|
11
|
+
|
12
|
+
op.on("-k", "--key CONSUMER_KEY", "consumer key for OAuth", String) {|s|
|
13
|
+
consumer_key = s
|
14
|
+
}
|
15
|
+
|
16
|
+
op.on("-s", "--secret CONSUMER_SECRET", "consumer secret for OAuth", String) {|s|
|
17
|
+
consumer_secret = s
|
18
|
+
}
|
19
|
+
|
20
|
+
op.on("-u", "--url OAUTH_URL", "URL for OAuth", String) {|s|
|
21
|
+
oauth_url = s
|
22
|
+
}
|
23
|
+
|
24
|
+
begin
|
25
|
+
op.parse!(ARGV)
|
26
|
+
rescue \
|
27
|
+
OptionParser::InvalidOption, \
|
28
|
+
OptionParser::MissingArgument, \
|
29
|
+
OptionParser::AmbiguousOption => e
|
30
|
+
puts e
|
31
|
+
exit 1
|
32
|
+
end
|
33
|
+
|
34
|
+
if oauth_url.nil?
|
35
|
+
puts "OAuth url is not set"
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
if consumer_key.nil?
|
40
|
+
puts "consumer key is not set"
|
41
|
+
exit 1
|
42
|
+
end
|
43
|
+
|
44
|
+
if consumer_secret.nil?
|
45
|
+
puts "consumer secret is not set"
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
|
49
|
+
@consumer = OAuth::Consumer.new(
|
50
|
+
consumer_key,
|
51
|
+
consumer_secret,
|
52
|
+
:site=>oauth_url
|
53
|
+
)
|
54
|
+
|
55
|
+
@request_token = @consumer.get_request_token
|
56
|
+
authorize_url = @request_token.authorize_url
|
57
|
+
|
58
|
+
puts "Authorize URL: #{authorize_url}"
|
59
|
+
|
60
|
+
print "Enter PIN: "
|
61
|
+
|
62
|
+
@access_token = @request_token.get_access_token(:oauth_verifier => $stdin.gets.chomp)
|
63
|
+
|
64
|
+
puts "Access Token: #{@access_token.token}"
|
65
|
+
puts "Access Token Secret: #{@access_token.secret}"
|
data/lib/oauth_token.rb
ADDED
data/oauthtoken.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'oauth_token/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "oauthtoken"
|
8
|
+
spec.version = OAuthToken::VERSION
|
9
|
+
spec.authors = ["Kenji Hara"]
|
10
|
+
spec.email = ["hara2001@gmail.com"]
|
11
|
+
spec.description = %q{Command to get OAuth token}
|
12
|
+
spec.summary = %q{Command to get OAuth token}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "oauth", "~> 0.4.7"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: oauthtoken
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kenji Hara
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2013-11-07 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
type: :development
|
16
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.4.7
|
21
|
+
name: oauth
|
22
|
+
prerelease: false
|
23
|
+
requirement: *id001
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
type: :development
|
26
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: "1.3"
|
31
|
+
name: bundler
|
32
|
+
prerelease: false
|
33
|
+
requirement: *id002
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
type: :development
|
36
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- &id004
|
39
|
+
- ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: "0"
|
42
|
+
name: rake
|
43
|
+
prerelease: false
|
44
|
+
requirement: *id003
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
type: :development
|
47
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- *id004
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: *id005
|
53
|
+
description: Command to get OAuth token
|
54
|
+
email:
|
55
|
+
- hara2001@gmail.com
|
56
|
+
executables:
|
57
|
+
- oatok
|
58
|
+
extensions: []
|
59
|
+
|
60
|
+
extra_rdoc_files: []
|
61
|
+
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .rspec
|
65
|
+
- .travis.yml
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/oatok
|
71
|
+
- lib/oauth_token.rb
|
72
|
+
- lib/oauth_token/command/oatok.rb
|
73
|
+
- lib/oauth_token/version.rb
|
74
|
+
- oauthtoken.gemspec
|
75
|
+
- spec/oauth_token_spec.rb
|
76
|
+
- spec/spec_helper.rb
|
77
|
+
homepage: ""
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- *id004
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- *id004
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.0.13
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Command to get OAuth token
|
100
|
+
test_files:
|
101
|
+
- spec/oauth_token_spec.rb
|
102
|
+
- spec/spec_helper.rb
|