tweetkit 0.1.4 → 0.2.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
  SHA256:
3
- metadata.gz: 9196c1fa2738a31583fc83533e10aeb7b5789be6c7b9bc4f9fc8918e30948cbf
4
- data.tar.gz: 55a808fdddd7d3becdac722e13810f667ef508c5eddef41f0b0fabf4f36596c6
3
+ metadata.gz: 20539d0c3da14a28107d1fdf85fffcbe6c092b0ec885162ccd487baeb7e2976e
4
+ data.tar.gz: 95eab7a0384b95895fafe9371235ea9192603f66db6a722fa0842872d2014939
5
5
  SHA512:
6
- metadata.gz: a1ff85325ce11513af7a5b62b147d31825e74c8f0c763346944d53f7ee3bb72bc5320d954697ff5dd3e867c04a71340191853e9675b794bb355b408c43f99923
7
- data.tar.gz: 1ec4f68aee5eeb8cad5d5ef862528eccef7303e5e4bacfe15b698220f9fd7b5a3e22c0ecbdf26137a9348a071de364e9abd83fc56d3a0b5a0056a80cff993f76
6
+ metadata.gz: 7caa31d80a32d88968f1f0cb8945ff9dbaf960e363f2572e4a3cde7c41cf19797f74cd99a6699372bed3725e3f39e67121270a83409fb7ad467dd2b732bff99a
7
+ data.tar.gz: a8f3085fc4e221036c08fc3aba617847d693a4494520abd55c8a4262ac03e659dd944e139557856c59379bdb4a8382f7a0de131e0a461c9f50b14cc895aa32db
data/.env.example ADDED
@@ -0,0 +1,5 @@
1
+ BEARER_TOKEN=<your-bearer-token>
2
+ CONSUMER_KEY=<your-consumer-key>
3
+ CONSUMER_SECRET=<your-consumer-secret>
4
+ ACCESS_TOKEN=<your-access-token>
5
+ ACCESS_TOKEN_SECRET=<your-access-token-secret>
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ .env
10
+ !.env.example
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.3)
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,6 +10,8 @@ GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
12
  coderay (1.1.3)
13
+ diff-lcs (1.4.4)
14
+ dotenv (2.7.6)
13
15
  faraday (1.5.1)
14
16
  faraday-em_http (~> 1.0)
15
17
  faraday-em_synchrony (~> 1.0)
@@ -30,26 +32,41 @@ GEM
30
32
  faraday_middleware (1.0.0)
31
33
  faraday (~> 1.0)
32
34
  method_source (1.0.0)
33
- minitest (5.14.4)
34
35
  multipart-post (2.1.1)
35
36
  pry (0.13.1)
36
37
  coderay (~> 1.1)
37
38
  method_source (~> 1.0)
38
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)
39
53
  ruby2_keywords (0.0.4)
40
54
  simple_oauth (0.3.1)
55
+ yard (0.9.26)
41
56
 
42
57
  PLATFORMS
43
58
  ruby
44
59
 
45
60
  DEPENDENCIES
61
+ dotenv
46
62
  faraday
47
63
  faraday_middleware
48
- minitest (~> 5.0)
49
64
  pry (~> 0.13.1)
50
65
  rake (~> 12.0)
66
+ rspec
51
67
  simple_oauth (~> 0.3.0)
52
68
  tweetkit!
69
+ yard
53
70
 
54
71
  BUNDLED WITH
55
- 2.1.4
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: 'YOUR_API_KEY_HERE', consumer_token: 'YOUR_API_TOKEN_HERE')
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 = 'YOUR_API_KEY_HERE'
46
- config.consumer_token = 'YOUR_API_TOKEN_HERE'
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. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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 << "test"
5
+ t.libs << "spec"
6
6
  t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
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.
@@ -12,6 +14,8 @@ require "tweetkit"
12
14
 
13
15
  require "irb"
14
16
 
17
+ Dotenv.load(BASE_ENV_FILE_PATH)
18
+
15
19
  def reload!
16
20
  puts 'Reloading ...'
17
21
  # Main project directory.
data/lib/tweetkit/auth.rb CHANGED
@@ -1,11 +1,7 @@
1
1
  module Tweetkit
2
2
  module Auth
3
- def basic_auth?
4
- !!(@login && @password)
5
- end
6
-
7
3
  def token_auth?
8
- !!(@access_token && @access_token_secret)
4
+ !!(@consumer_key && @consumer_secret && @access_token && @access_token_secret)
9
5
  end
10
6
 
11
7
  def bearer_auth?
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