twurl 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +15 -1
- data/INSTALL.md +2 -2
- data/README.md +3 -2
- data/lib/twurl/cli.rb +9 -8
- data/lib/twurl/oauth_client.rb +8 -13
- data/lib/twurl/rcfile.rb +1 -1
- data/lib/twurl/version.rb +1 -1
- data/twurl.gemspec +5 -5
- metadata +9 -15
- data/.github/ISSUE_TEMPLATE.md +0 -13
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -15
- data/.gitignore +0 -40
- data/.travis.yml +0 -23
- data/Gemfile +0 -13
- data/Rakefile +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e12cf717906fbf24bcd34598212105569647dbed1f6b5ee37a195ec0db8ca15
|
4
|
+
data.tar.gz: c5d7a22975a06fccc328a99323ead35584104e77fcf3827611d9cf279ccb22bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daf4dae500fb05b24eaed8413538420bf66d5f113982663e7e3bd416df6d4a98eef31b982eac9174eaa251421aef512db60bd3675c4ae55529ef009603a070de
|
7
|
+
data.tar.gz: 7ef9671671c1d946f0671147b49c8485b21da16837a1c890b2e67b28f5b3f4ed2065e9b896ae9a3533d92bb384908c79f0fd72543adb5a06626aec0390d98f2c
|
data/CONTRIBUTING.md
CHANGED
@@ -9,7 +9,21 @@ We follow the [GitHub Flow Workflow](https://guides.github.com/introduction/flow
|
|
9
9
|
1. Fork the project
|
10
10
|
2. Check out the `master` branch
|
11
11
|
3. Create a feature branch
|
12
|
-
4. Write code and tests for your change
|
12
|
+
4. Write code and tests for your change
|
13
|
+
|
14
|
+
```sh
|
15
|
+
$ cd ./twurl
|
16
|
+
|
17
|
+
# install twurl from source
|
18
|
+
$ bundle install
|
19
|
+
|
20
|
+
# run twurl from source
|
21
|
+
$ bundle exec twurl -v
|
22
|
+
|
23
|
+
# run tests
|
24
|
+
$ bundle exec rake
|
25
|
+
```
|
26
|
+
|
13
27
|
5. From your branch, make a pull request against `twitter/twurl/master`
|
14
28
|
6. Work with repo maintainers to get your change reviewed
|
15
29
|
7. Wait for your change to be pulled into `twitter/twurl/master`
|
data/INSTALL.md
CHANGED
@@ -10,7 +10,7 @@ $ gem install twurl
|
|
10
10
|
```sh
|
11
11
|
# verify installation
|
12
12
|
$ twurl -v
|
13
|
-
0.9.
|
13
|
+
0.9.6
|
14
14
|
```
|
15
15
|
|
16
16
|
## Install from source
|
@@ -32,5 +32,5 @@ If you don't want to install Twurl globally on your system, use `--path` [option
|
|
32
32
|
```
|
33
33
|
$ bundle install --path path/to/directory
|
34
34
|
$ bundle exec twurl -v
|
35
|
-
0.9.
|
35
|
+
0.9.6
|
36
36
|
```
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/twitter/twurl/blob/master/LICENSE)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/twurl.svg)](https://badge.fury.io/rb/twurl)
|
5
|
+
[![Build Status](https://travis-ci.com/twitter/twurl.svg?branch=master)](https://travis-ci.com/twitter/twurl)
|
5
6
|
|
6
7
|
Twurl is like curl, but tailored specifically for the Twitter API.
|
7
8
|
It knows how to grant an access token to a client application for
|
@@ -97,7 +98,7 @@ This will print a pair of consumer_key and its associated bearer token. Note, to
|
|
97
98
|
You can access different hosts for other Twitter APIs using the -H flag.
|
98
99
|
|
99
100
|
```sh
|
100
|
-
twurl -H "ads-api.twitter.com" "/
|
101
|
+
twurl -H "ads-api.twitter.com" "/7/accounts"
|
101
102
|
```
|
102
103
|
|
103
104
|
## Uploading Media
|
@@ -164,7 +165,7 @@ twurl accounts
|
|
164
165
|
|
165
166
|
### Profiles and Bearer Tokens
|
166
167
|
|
167
|
-
While changing the default profile allows you to select which access token (OAuth1.0a) to use, bearer tokens don't link to any user profiles as the Application-only authentication doesn't require user context. That is, you can make an application-only request regardless of your default profile if you specify the `-c` (
|
168
|
+
While changing the default profile allows you to select which access token (OAuth1.0a) to use, bearer tokens don't link to any user profiles as the Application-only authentication doesn't require user context. That is, you can make an application-only request regardless of your default profile if you specify the `-c` (`--consumer-key`) option once you generate a bearer token with this consumer key. By default, twurl reads the current profile's consumer key and its associated bearer token from `~/.twurlrc` file.
|
168
169
|
|
169
170
|
## Contributors
|
170
171
|
|
data/lib/twurl/cli.rb
CHANGED
@@ -67,7 +67,6 @@ Supported Commands: #{SUPPORTED_COMMANDS.sort.join(', ')}
|
|
67
67
|
|
68
68
|
o.section "Authorization options:" do
|
69
69
|
username
|
70
|
-
password
|
71
70
|
consumer_key
|
72
71
|
consumer_secret
|
73
72
|
access_token
|
@@ -96,7 +95,15 @@ Supported Commands: #{SUPPORTED_COMMANDS.sort.join(', ')}
|
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
99
|
-
|
98
|
+
begin
|
99
|
+
arguments = option_parser.parse!(args)
|
100
|
+
rescue OptionParser::InvalidOption
|
101
|
+
CLI.puts "ERROR: undefined option"
|
102
|
+
exit
|
103
|
+
rescue
|
104
|
+
CLI.puts "ERROR: invalid argument"
|
105
|
+
exit
|
106
|
+
end
|
100
107
|
Twurl.options.command = extract_command!(arguments)
|
101
108
|
Twurl.options.path = extract_path!(arguments)
|
102
109
|
Twurl.options.subcommands = arguments
|
@@ -219,12 +226,6 @@ Supported Commands: #{SUPPORTED_COMMANDS.sort.join(', ')}
|
|
219
226
|
end
|
220
227
|
end
|
221
228
|
|
222
|
-
def password
|
223
|
-
on('-p', '--password [password]', 'Password of account to authorize (required)') do |password|
|
224
|
-
options.password = password ? password : CLI.prompt_for('Password')
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
229
|
def trace
|
229
230
|
on('-t', '--[no-]trace', 'Trace request/response traffic (default: --no-trace)') do |trace|
|
230
231
|
options.trace = trace
|
data/lib/twurl/oauth_client.rb
CHANGED
@@ -9,7 +9,11 @@ module Twurl
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def load_from_options(options)
|
12
|
-
if
|
12
|
+
if options.command == 'request' && has_oauth_options?(options)
|
13
|
+
load_new_client_from_oauth_options(options)
|
14
|
+
elsif options.command == 'request' && options.app_only && options.consumer_key
|
15
|
+
load_client_for_non_profile_app_only_auth(options)
|
16
|
+
elsif rcfile.has_oauth_profile_for_username_with_consumer_key?(options.username, options.consumer_key)
|
13
17
|
load_client_for_username_and_consumer_key(options.username, options.consumer_key)
|
14
18
|
elsif options.username
|
15
19
|
load_client_for_username(options.username)
|
@@ -17,10 +21,6 @@ module Twurl
|
|
17
21
|
load_client_for_app_only_auth(options, options.consumer_key)
|
18
22
|
elsif options.command == 'authorize'
|
19
23
|
load_new_client_from_options(options)
|
20
|
-
elsif options.command == 'request' && has_oauth_options?(options)
|
21
|
-
load_new_client_from_oauth_options(options)
|
22
|
-
elsif options.command == 'request' && options.app_only && options.consumer_key
|
23
|
-
load_client_for_non_profile_app_only_auth(options)
|
24
24
|
else
|
25
25
|
load_default_client(options)
|
26
26
|
end
|
@@ -52,7 +52,7 @@ module Twurl
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def load_new_client_from_options(options)
|
55
|
-
new(options.oauth_client_options
|
55
|
+
new(options.oauth_client_options)
|
56
56
|
end
|
57
57
|
|
58
58
|
def load_new_client_from_oauth_options(options)
|
@@ -106,10 +106,9 @@ module Twurl
|
|
106
106
|
|
107
107
|
OAUTH_CLIENT_OPTIONS = %w[username consumer_key consumer_secret token secret]
|
108
108
|
attr_reader *OAUTH_CLIENT_OPTIONS
|
109
|
-
attr_reader :username
|
109
|
+
attr_reader :username
|
110
110
|
def initialize(options = {})
|
111
111
|
@username = options['username']
|
112
|
-
@password = options['password']
|
113
112
|
@consumer_key = options['consumer_key']
|
114
113
|
@consumer_secret = options['consumer_secret']
|
115
114
|
@token = options['token']
|
@@ -192,7 +191,7 @@ module Twurl
|
|
192
191
|
|
193
192
|
def exchange_credentials_for_access_token
|
194
193
|
response = begin
|
195
|
-
consumer.token_request(:post, consumer.access_token_path, nil, {}
|
194
|
+
consumer.token_request(:post, consumer.access_token_path, nil, {})
|
196
195
|
rescue OAuth::Unauthorized
|
197
196
|
perform_pin_authorize_workflow
|
198
197
|
end
|
@@ -200,10 +199,6 @@ module Twurl
|
|
200
199
|
@secret = response[:oauth_token_secret]
|
201
200
|
end
|
202
201
|
|
203
|
-
def client_auth_parameters
|
204
|
-
{'x_auth_username' => username, 'x_auth_password' => password, 'x_auth_mode' => 'client_auth'}
|
205
|
-
end
|
206
|
-
|
207
202
|
def perform_pin_authorize_workflow
|
208
203
|
@request_token = consumer.get_request_token
|
209
204
|
CLI.puts("Go to #{generate_authorize_url} and paste in the supplied PIN")
|
data/lib/twurl/rcfile.rb
CHANGED
data/lib/twurl/version.rb
CHANGED
@@ -2,7 +2,7 @@ module Twurl
|
|
2
2
|
class Version
|
3
3
|
MAJOR = 0 unless defined? Twurl::Version::MAJOR
|
4
4
|
MINOR = 9 unless defined? Twurl::Version::MINOR
|
5
|
-
PATCH =
|
5
|
+
PATCH = 6 unless defined? Twurl::Version::PATCH
|
6
6
|
PRE = nil unless defined? Twurl::Version::PRE # Time.now.to_i.to_s
|
7
7
|
|
8
8
|
class << self
|
data/twurl.gemspec
CHANGED
@@ -7,16 +7,16 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.add_dependency 'oauth', '~> 0.4'
|
8
8
|
spec.authors = ["Marcel Molina", "Erik Michaels-Ober", "@TwitterDev team"]
|
9
9
|
spec.description = %q{Curl for the Twitter API}
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.
|
10
|
+
spec.bindir = 'bin'
|
11
|
+
spec.executables << 'twurl'
|
12
|
+
spec.extra_rdoc_files = Dir["*.md", "LICENSE"]
|
13
|
+
spec.files = Dir["*.md", "LICENSE", "twurl.gemspec", "bin/*", "lib/**/*"]
|
14
|
+
spec.homepage = 'http://github.com/twitter/twurl'
|
14
15
|
spec.licenses = ['MIT']
|
15
16
|
spec.name = 'twurl'
|
16
17
|
spec.rdoc_options = ['--title', 'twurl -- OAuth-enabled curl for the Twitter API', '--main', 'README.md', '--line-numbers', '--inline-source']
|
17
18
|
spec.require_paths = ['lib']
|
18
19
|
spec.required_ruby_version = '>= 2.4.0'
|
19
|
-
spec.rubyforge_project = 'twurl'
|
20
20
|
spec.summary = spec.description
|
21
21
|
spec.version = Twurl::Version
|
22
22
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twurl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcel Molina
|
8
8
|
- Erik Michaels-Ober
|
9
9
|
- "@TwitterDev team"
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: oauth
|
@@ -27,28 +27,22 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0.4'
|
29
29
|
description: Curl for the Twitter API
|
30
|
-
email:
|
30
|
+
email:
|
31
31
|
executables:
|
32
32
|
- twurl
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files:
|
35
35
|
- CODE_OF_CONDUCT.md
|
36
|
-
- CONTRIBUTING.md
|
37
36
|
- INSTALL.md
|
38
|
-
- LICENSE
|
39
37
|
- README.md
|
38
|
+
- CONTRIBUTING.md
|
39
|
+
- LICENSE
|
40
40
|
files:
|
41
|
-
- ".github/ISSUE_TEMPLATE.md"
|
42
|
-
- ".github/PULL_REQUEST_TEMPLATE.md"
|
43
|
-
- ".gitignore"
|
44
|
-
- ".travis.yml"
|
45
41
|
- CODE_OF_CONDUCT.md
|
46
42
|
- CONTRIBUTING.md
|
47
|
-
- Gemfile
|
48
43
|
- INSTALL.md
|
49
44
|
- LICENSE
|
50
45
|
- README.md
|
51
|
-
- Rakefile
|
52
46
|
- bin/twurl
|
53
47
|
- lib/twurl.rb
|
54
48
|
- lib/twurl/abstract_command_controller.rb
|
@@ -68,7 +62,7 @@ homepage: http://github.com/twitter/twurl
|
|
68
62
|
licenses:
|
69
63
|
- MIT
|
70
64
|
metadata: {}
|
71
|
-
post_install_message:
|
65
|
+
post_install_message:
|
72
66
|
rdoc_options:
|
73
67
|
- "--title"
|
74
68
|
- twurl -- OAuth-enabled curl for the Twitter API
|
@@ -89,8 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
83
|
- !ruby/object:Gem::Version
|
90
84
|
version: '0'
|
91
85
|
requirements: []
|
92
|
-
rubygems_version: 3.0.
|
93
|
-
signing_key:
|
86
|
+
rubygems_version: 3.0.6
|
87
|
+
signing_key:
|
94
88
|
specification_version: 4
|
95
89
|
summary: Curl for the Twitter API
|
96
90
|
test_files: []
|
data/.github/ISSUE_TEMPLATE.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
One line summary of the issue here.
|
2
|
-
|
3
|
-
### Expected behavior
|
4
|
-
|
5
|
-
As concisely as possible, describe the expected behavior.
|
6
|
-
|
7
|
-
### Actual behavior
|
8
|
-
|
9
|
-
As concisely as possible, describe the observed behavior.
|
10
|
-
|
11
|
-
### Steps to reproduce the behavior
|
12
|
-
|
13
|
-
Please list all relevant steps to reproduce the observed behavior.
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Problem
|
2
|
-
|
3
|
-
Explain the context and why you're making that change. What is the
|
4
|
-
problem you're trying to solve? In some cases there is not a problem
|
5
|
-
and this can be thought of being the motivation for your change.
|
6
|
-
|
7
|
-
Solution
|
8
|
-
|
9
|
-
Describe the modifications you've done.
|
10
|
-
|
11
|
-
Result
|
12
|
-
|
13
|
-
What will change as a result of your pull request? Note that sometimes
|
14
|
-
this section is unnecessary because it is self-explanatory based on
|
15
|
-
the solution.
|
data/.gitignore
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
*.sw[a-p]
|
4
|
-
*.tmproj
|
5
|
-
*.tmproject
|
6
|
-
*.un~
|
7
|
-
*~
|
8
|
-
.Spotlight-V100
|
9
|
-
.Trashes
|
10
|
-
._*
|
11
|
-
.bundle
|
12
|
-
.config
|
13
|
-
.directory
|
14
|
-
.elc
|
15
|
-
.emacs.desktop
|
16
|
-
.emacs.desktop.lock
|
17
|
-
.redcar
|
18
|
-
.yardoc
|
19
|
-
Desktop.ini
|
20
|
-
Gemfile.lock
|
21
|
-
Icon?
|
22
|
-
InstalledFiles
|
23
|
-
Session.vim
|
24
|
-
\#*\#
|
25
|
-
_yardoc
|
26
|
-
auto-save-list
|
27
|
-
coverage
|
28
|
-
doc
|
29
|
-
lib/bundler/man
|
30
|
-
pkg
|
31
|
-
pkg/*
|
32
|
-
rdoc
|
33
|
-
spec/reports
|
34
|
-
test/tmp
|
35
|
-
test/version_tmp
|
36
|
-
tmp
|
37
|
-
tmtags
|
38
|
-
tramp
|
39
|
-
.vscode
|
40
|
-
vendor
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
dist: xenial
|
2
|
-
language: ruby
|
3
|
-
|
4
|
-
before_install:
|
5
|
-
- bundle config without 'development'
|
6
|
-
|
7
|
-
branches:
|
8
|
-
only:
|
9
|
-
- master
|
10
|
-
|
11
|
-
matrix:
|
12
|
-
fast_finish: true
|
13
|
-
allow_failures:
|
14
|
-
- rvm: jruby-head
|
15
|
-
- rvm: ruby-head
|
16
|
-
- rvm: rbx-2
|
17
|
-
include:
|
18
|
-
- rvm: 2.6.5
|
19
|
-
- rvm: 2.5.7
|
20
|
-
- rvm: 2.4.9
|
21
|
-
- rvm: jruby-head
|
22
|
-
- rvm: ruby-head
|
23
|
-
- rvm: rbx-2
|
data/Gemfile
DELETED
data/Rakefile
DELETED