bolso-furado 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a9aa4787f25cd58a77f227d8f41f4862490c28b
4
- data.tar.gz: 5efb586b7df05cd96ee9ee141c5dd52f4716497d
3
+ metadata.gz: e64d3524c6609378f5bf96ed2915501fe9249ed6
4
+ data.tar.gz: 61f6ae4a3aca7dbd1ff5c52e4466185e36f651e0
5
5
  SHA512:
6
- metadata.gz: 21693dedf482f5b7b1c99ab337ffe290c45cea82b720767ba9d362a2e27b0eef455998d02f56f9acb77b5ee4b061da0e4366c75f9e34d623051f98c89bc7fe32
7
- data.tar.gz: f8176080d236412c9cdc0ff990b018bff53c27fb34ac4fafeed6ad78cd05df4e2fcdba48deb2154a0171a7df7718fd0be02af9340d98d722c06cd9a21e47f4a5
6
+ metadata.gz: 3b05fda5816a77227b55b34029a13e669222f27f1202dd10725f98085765f35b27fc22ae94d7694070b833456ae2b9db701fe0182603542af2bda15a2a198a58
7
+ data.tar.gz: 1966e9e59bea0aa7df2f03de041f7d0e5dfa8b965c49419999046f12ff3cbd8d8bc9caf1b77a39ed44e07867bc24277714647c08c2b52b5c392d673c6ecf4f05
data/README.md CHANGED
@@ -10,7 +10,7 @@ Install the gem:
10
10
 
11
11
  Create a Pocket application.
12
12
 
13
- Get consumer key and token.
13
+ Get consumer key and token (if you don't have one, use [bolso-furado-token](token-script.md) script).
14
14
 
15
15
  Run script with consumer key and token:
16
16
 
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'pocket-ruby'
5
+ require 'webrick'
6
+ require 'thread'
7
+ require_relative '../lib/version'
8
+
9
+ options = {}
10
+
11
+ OptionParser.new do |opts|
12
+ opts.banner = 'Usage options:'
13
+ opts.on('-k', '--key CONSUMER-KEY', 'Consumer key') { |key| options[:key] = key }
14
+ opts.on('-v', '--version', "Current version") { puts VERSION }
15
+ end.parse!
16
+
17
+ if options[:key].nil? || options[:key].empty?
18
+ puts "Consumer key required!"
19
+ exit
20
+ end
21
+
22
+ Pocket.configure do |config|
23
+ config.consumer_key = options[:key]
24
+ end
25
+
26
+ port = "9999"
27
+ redirect_uri = "http://127.0.0.1:#{port}/"
28
+
29
+ root = File.expand_path '/tmp'
30
+ server = WEBrick::HTTPServer.new(:Port => port, :DocumentRoot => root)
31
+ trap 'INT' do server.shutdown end
32
+ server.mount_proc '/' do |req, res|
33
+ res.body = 'Check your token on the console'
34
+ server.shutdown
35
+ end
36
+ server_thread = Thread.new { server.start }
37
+
38
+ code = Pocket.get_code(redirect_uri: redirect_uri)
39
+ new_url = Pocket.authorize_url(code: code, redirect_uri: redirect_uri)
40
+ puts 'Authorize bolso-furado-token script using the following url:', new_url
41
+
42
+ server_thread.join
43
+ server_thread.exit
44
+
45
+ token = Pocket.get_access_token(code)
46
+ puts 'Your token is', token
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.files = `git ls-files`.split("\n")
12
12
  .delete_if { |entry| entry.start_with?(".", "bin") }
13
13
  s.executables = `git ls-files -- bin/*`.split("\n")
14
- .map {|f| File.basename(f) }
14
+ .map { |f| File.basename(f) }
15
15
  s.homepage = 'http://github.com/hlmerscher/bolso-furado'
16
16
  s.license = 'MIT'
17
17
 
@@ -1 +1 @@
1
- VERSION = '1.0.1'
1
+ VERSION = '1.1.0'
@@ -0,0 +1,21 @@
1
+ # Getting your token the easy way
2
+
3
+ The bolso-furado gem comes with a script to help you get your pocket token. Just run the following script passing your consumer key:
4
+
5
+ $ bolso-furado-token -k 68583-ceb7f902cac956bc671bd299
6
+
7
+ [2017-08-25 21:41:04] INFO WEBrick 1.3.1
8
+ [2017-08-25 21:41:04] INFO ruby 2.4.0 (2016-12-24) [x86_64-linux]
9
+ [2017-08-25 21:41:04] INFO WEBrick::HTTPServer#start: pid=29060 port=9999
10
+ Authorize bolso-furado-token script using the following url:
11
+ https://getpocket.com/auth/authorize?redirect_uri=http%3A%2F%2F127.0.0.1%3A9999%2F&request_token=a505aae8-fa08-07de-f578-42cd04
12
+ [2017-08-25 21:41:11] INFO going to shutdown ...
13
+ 127.0.0.1 - - [25/Aug/2017:21:41:11 -03] "GET / HTTP/1.1" 200 31
14
+ - -> /
15
+ [2017-08-25 21:41:11] INFO WEBrick::HTTPServer#start done.
16
+ Your token is
17
+ 91142ba0-acfb-373c-735c-8e072b
18
+
19
+ A webrick server will be started to create a temporary app to be used in order to authorize the pocket app and get your token.
20
+
21
+ After that just run bolso-furado along with consumer key and your token. Check on [README](README.md).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolso-furado
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hercules Lemke Merscher
@@ -28,6 +28,7 @@ description: Tag your old articles on Pocket as "bolso-furado"
28
28
  email: hlmerscher@gmail.com
29
29
  executables:
30
30
  - bolso-furado
31
+ - bolso-furado-token
31
32
  extensions: []
32
33
  extra_rdoc_files: []
33
34
  files:
@@ -35,11 +36,13 @@ files:
35
36
  - Gemfile.lock
36
37
  - README.md
37
38
  - bin/bolso-furado
39
+ - bin/bolso-furado-token
38
40
  - bolso_furado.gemspec
39
41
  - lib/bolso_furado.rb
40
42
  - lib/cli_options.rb
41
43
  - lib/pocket_client.rb
42
44
  - lib/version.rb
45
+ - token-script.md
43
46
  homepage: http://github.com/hlmerscher/bolso-furado
44
47
  licenses:
45
48
  - MIT