get-tumblr-oauth-token 1.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/bin/get-tumblr-oauth-token +42 -0
  3. metadata +60 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2RhNTRkNTgwN2ZkZDk3ZTYzYTNmMjMzMzI0MGM5NTEwZjRjMGM1Yg==
5
+ data.tar.gz: !binary |-
6
+ MmZiNDFhMTA1NzM5ZDMwMDVjYjdlYTY3YjgzMTJjNDkyODNkY2EwNg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YTljZTRhMWRjMTQ3NzZlY2U0ZjAzMzNlNzJkMTNlYTY0ZTZjZDgwYWQ0Njg1
10
+ ZGZjZjRiODNmMDJiM2FiNjAwYTMxNzAzOTkzNDVjNDQ4NGM5NDAwNjQ3M2E4
11
+ MDkwMGRiYjVkNWYxZjFjNWNkMzBlZjI1NjYxMmU4Yzk2YmQzZWQ=
12
+ data.tar.gz: !binary |-
13
+ YWVjNTZmN2ZkOWZlZDk0MWI3ODAxZTM4OTUzNDEzYjgxOGFlNDdlMGQyODIx
14
+ YjUwNDY4NzQyYmMyM2EyZDYwNDg4YjgxYjljMDVlZGUzNTQ3MzBiYjExOTAx
15
+ ZmIzZTcyODAyYzUwYTEyNTU4Yzk1MmQ4YTEwOGY2NTMzODQ0MmE=
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'oauth'
5
+ require 'oauth/consumer'
6
+
7
+ class String
8
+ def color num
9
+ "\e[#{num}m#{self}\e[0m"
10
+ end
11
+
12
+ def ask
13
+ print "#{self}"
14
+ gets.strip
15
+ end
16
+ end
17
+
18
+ begin
19
+ consumer_key = 'Consumer Key: '.color(36).ask
20
+ consumer_secret = 'Consumer Secret: '.color(36).ask
21
+
22
+ consumer = OAuth::Consumer.new(
23
+ consumer_key,
24
+ consumer_secret,
25
+ :site => 'https://api.tumblr.com'
26
+ )
27
+
28
+ request_token = consumer.get_request_token(oauth_callback: 'http://localhost/')
29
+
30
+ system('open', request_token.authorize_url) || puts("Access here: #{request_token.authorize_url}\nand...")
31
+ pin = 'OAuth Verifier: '.color(32).ask
32
+
33
+ access_token = request_token.get_access_token(
34
+ :oauth_token => request_token.token,
35
+ :oauth_verifier => pin
36
+ )
37
+
38
+ puts 'Token: '.color(35) + access_token.token
39
+ puts 'Secret: '.color(35) + access_token.secret
40
+ rescue
41
+ puts "Error: #{$!}".color(31)
42
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: get-tumblr-oauth-token
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sho Sawada
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: The "get-tumblr-oauth-token" is a command to get OAuth token. Let's get
28
+ OAuth token!
29
+ email: shao@1555.info
30
+ executables:
31
+ - get-tumblr-oauth-token
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - bin/get-tumblr-oauth-token
36
+ homepage: https://github.com/shao1555/get-tumblr-oauth-token
37
+ licenses:
38
+ - MIT
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubyforge_project:
56
+ rubygems_version: 2.0.3
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: The "get-tumblr-oauth-token" is a command to get OAuth token.
60
+ test_files: []