tweetkit 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/.env.example +5 -0
- data/.gitignore +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile +6 -1
- data/Gemfile.lock +26 -5
- data/LICENSE +21 -0
- data/README.md +6 -4
- data/Rakefile +2 -2
- data/bin/console +19 -0
- data/lib/tweetkit/auth.rb +1 -5
- data/lib/tweetkit/client/response/annotations.rb +0 -0
- data/lib/tweetkit/client/response/attachments.rb +0 -0
- data/lib/tweetkit/client/response/expansions.rb +0 -0
- data/lib/tweetkit/client/response/fields.rb +0 -0
- data/lib/tweetkit/client/response/geo.rb +0 -0
- data/lib/tweetkit/client/response/meta.rb +0 -0
- data/lib/tweetkit/client/response/metrics.rb +0 -0
- data/lib/tweetkit/client/response/response.rb +0 -0
- data/lib/tweetkit/client/response/tweet.rb +0 -0
- data/lib/tweetkit/client/response/tweets.rb +0 -0
- data/lib/tweetkit/client/search/conjunctions.rb +494 -0
- data/lib/tweetkit/client/search/search.rb +23 -0
- data/lib/tweetkit/client/tweets.rb +13 -5
- data/lib/tweetkit/client.rb +0 -1
- data/lib/tweetkit/connection.rb +68 -49
- data/lib/tweetkit/pagination.rb +0 -0
- data/lib/tweetkit/response.rb +585 -62
- data/lib/tweetkit/version.rb +1 -1
- metadata +20 -4
- data/lib/tweetkit/search.rb +0 -121
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20539d0c3da14a28107d1fdf85fffcbe6c092b0ec885162ccd487baeb7e2976e
|
4
|
+
data.tar.gz: 95eab7a0384b95895fafe9371235ea9192603f66db6a722fa0842872d2014939
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7caa31d80a32d88968f1f0cb8945ff9dbaf960e363f2572e4a3cde7c41cf19797f74cd99a6699372bed3725e3f39e67121270a83409fb7ad467dd2b732bff99a
|
7
|
+
data.tar.gz: a8f3085fc4e221036c08fc3aba617847d693a4494520abd55c8a4262ac03e659dd944e139557856c59379bdb4a8382f7a0de131e0a461c9f50b14cc895aa32db
|
data/.env.example
ADDED
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to `tweetkit` will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [0.2.0] - 2022-01-09
|
8
|
+
### Added
|
9
|
+
- Added the ability to add OAuth tokens when setting up the client instance. Credit to @rofreg
|
10
|
+
- Added OAuth as an option to authenticate requests. Credit to @rofreg
|
11
|
+
- Added the `post_tweet` method to post tweets via OAuth. Credit to @rofreg
|
12
|
+
- Added the `delete_tweet` method to delete tweets via OAuth. Credit to @rofreg
|
13
|
+
- Added tests for the `Tweets` module.
|
14
|
+
- Added tests for the `Search` module.
|
15
|
+
- Added tests for search building and cleaning in the `Conjunctions` class.
|
16
|
+
### Changed
|
17
|
+
- Updated client responses to return a `Tweetkit::Response` object. The `Tweetkit::Response` object contains a `Tweets` object that is made up of `Tweet` objects that contain the data for each respective tweet. `Fields` and `Expansions` objects are also available depending on the fields and expansions made in the request.
|
18
|
+
- Moved search building and cleaning logic to the `Conjunctions` class.
|
19
|
+
- Fixed wrong config key names when setting up the client. Credit to @dewey
|
20
|
+
### Removed
|
21
|
+
- No changes
|
data/Gemfile
CHANGED
@@ -5,10 +5,15 @@ gemspec
|
|
5
5
|
|
6
6
|
gem 'faraday'
|
7
7
|
gem 'faraday_middleware'
|
8
|
-
gem "minitest", "~> 5.0"
|
9
8
|
gem "rake", "~> 12.0"
|
10
9
|
gem 'simple_oauth', "~> 0.3.0"
|
11
10
|
|
11
|
+
group :development do
|
12
|
+
gem 'yard'
|
13
|
+
end
|
14
|
+
|
12
15
|
group :test, :development do
|
16
|
+
gem 'dotenv'
|
13
17
|
gem 'pry', '~> 0.13.1'
|
18
|
+
gem 'rspec'
|
14
19
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tweetkit (0.1.
|
4
|
+
tweetkit (0.1.4)
|
5
5
|
faraday (>= 0.9)
|
6
6
|
faraday_middleware (~> 1.0.0)
|
7
7
|
simple_oauth (~> 0.3.0)
|
@@ -10,42 +10,63 @@ GEM
|
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
12
|
coderay (1.1.3)
|
13
|
-
|
13
|
+
diff-lcs (1.4.4)
|
14
|
+
dotenv (2.7.6)
|
15
|
+
faraday (1.5.1)
|
14
16
|
faraday-em_http (~> 1.0)
|
15
17
|
faraday-em_synchrony (~> 1.0)
|
16
18
|
faraday-excon (~> 1.1)
|
19
|
+
faraday-httpclient (~> 1.0.1)
|
17
20
|
faraday-net_http (~> 1.0)
|
18
21
|
faraday-net_http_persistent (~> 1.1)
|
22
|
+
faraday-patron (~> 1.0)
|
19
23
|
multipart-post (>= 1.2, < 3)
|
20
24
|
ruby2_keywords (>= 0.0.4)
|
21
25
|
faraday-em_http (1.0.0)
|
22
26
|
faraday-em_synchrony (1.0.0)
|
23
27
|
faraday-excon (1.1.0)
|
28
|
+
faraday-httpclient (1.0.1)
|
24
29
|
faraday-net_http (1.0.1)
|
25
30
|
faraday-net_http_persistent (1.1.0)
|
31
|
+
faraday-patron (1.0.0)
|
26
32
|
faraday_middleware (1.0.0)
|
27
33
|
faraday (~> 1.0)
|
28
34
|
method_source (1.0.0)
|
29
|
-
minitest (5.14.4)
|
30
35
|
multipart-post (2.1.1)
|
31
36
|
pry (0.13.1)
|
32
37
|
coderay (~> 1.1)
|
33
38
|
method_source (~> 1.0)
|
34
39
|
rake (12.3.3)
|
40
|
+
rspec (3.10.0)
|
41
|
+
rspec-core (~> 3.10.0)
|
42
|
+
rspec-expectations (~> 3.10.0)
|
43
|
+
rspec-mocks (~> 3.10.0)
|
44
|
+
rspec-core (3.10.1)
|
45
|
+
rspec-support (~> 3.10.0)
|
46
|
+
rspec-expectations (3.10.1)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-mocks (3.10.1)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-support (3.10.1)
|
35
53
|
ruby2_keywords (0.0.4)
|
36
54
|
simple_oauth (0.3.1)
|
55
|
+
yard (0.9.26)
|
37
56
|
|
38
57
|
PLATFORMS
|
39
58
|
ruby
|
40
59
|
|
41
60
|
DEPENDENCIES
|
61
|
+
dotenv
|
42
62
|
faraday
|
43
63
|
faraday_middleware
|
44
|
-
minitest (~> 5.0)
|
45
64
|
pry (~> 0.13.1)
|
46
65
|
rake (~> 12.0)
|
66
|
+
rspec
|
47
67
|
simple_oauth (~> 0.3.0)
|
48
68
|
tweetkit!
|
69
|
+
yard
|
49
70
|
|
50
71
|
BUNDLED WITH
|
51
|
-
2.
|
72
|
+
2.2.22
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Julian Foo Siang Sen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -37,13 +37,13 @@ Or install it yourself as:
|
|
37
37
|
client = Tweetkit::Client.new(bearer_token: 'YOUR_BEARER_TOKEN_HERE')
|
38
38
|
|
39
39
|
# Initializing via options with OAuth 1.0 credentials
|
40
|
-
client = Tweetkit::Client.new(bearer_token: 'YOUR_BEARER_TOKEN_HERE', consumer_key: '
|
40
|
+
client = Tweetkit::Client.new(bearer_token: 'YOUR_BEARER_TOKEN_HERE', consumer_key: 'YOUR_CONSUMER_KEY_HERE', consumer_secret: 'YOUR_CONSUMER_SECRET_HERE')
|
41
41
|
|
42
42
|
# You can also initialize the client with a block
|
43
43
|
client = Tweetkit::Client.new do |config|
|
44
44
|
config.bearer_token = 'YOUR_BEARER_TOKEN_HERE'
|
45
|
-
config.consumer_key = '
|
46
|
-
config.
|
45
|
+
config.consumer_key = 'YOUR_CONSUMER_KEY_HERE'
|
46
|
+
config.consumer_secret = 'YOUR_CONSUMER_SECRET_HERE'
|
47
47
|
end
|
48
48
|
```
|
49
49
|
|
@@ -59,7 +59,9 @@ Coming soon.
|
|
59
59
|
|
60
60
|
## Development
|
61
61
|
|
62
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
62
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
63
|
+
|
64
|
+
To run tests, first copy `.env.example` to `.env`, and modify it to include a valid Bearer token for the Twitter v2 API. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
63
65
|
|
64
66
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
65
67
|
|
data/Rakefile
CHANGED
@@ -2,9 +2,9 @@ require "bundler/gem_tasks"
|
|
2
2
|
require "rake/testtask"
|
3
3
|
|
4
4
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "
|
5
|
+
t.libs << "spec"
|
6
6
|
t.libs << "lib"
|
7
|
-
t.test_files = FileList["
|
7
|
+
t.test_files = FileList["spec/**/*_spec.rb"]
|
8
8
|
end
|
9
9
|
|
10
10
|
task :default => :test
|
data/bin/console
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "tweetkit"
|
5
|
+
require 'dotenv'
|
6
|
+
BASE_ENV_FILE_PATH = '.env'
|
5
7
|
|
6
8
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
9
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,4 +13,21 @@ require "tweetkit"
|
|
11
13
|
# Pry.start
|
12
14
|
|
13
15
|
require "irb"
|
16
|
+
|
17
|
+
Dotenv.load(BASE_ENV_FILE_PATH)
|
18
|
+
|
19
|
+
def reload!
|
20
|
+
puts 'Reloading ...'
|
21
|
+
# Main project directory.
|
22
|
+
root_dir = File.expand_path('..', __dir__)
|
23
|
+
# Directories within the project that should be reloaded.
|
24
|
+
reload_dirs = %w{lib}
|
25
|
+
# Loop through and reload every file in all relevant project directories.
|
26
|
+
reload_dirs.each do |dir|
|
27
|
+
Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
|
28
|
+
end
|
29
|
+
# Return true when complete.
|
30
|
+
true
|
31
|
+
end
|
32
|
+
|
14
33
|
IRB.start(__FILE__)
|
data/lib/tweetkit/auth.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|