tweetkit 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +6 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +51 -0
- data/README.md +69 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/tweetkit.rb +11 -0
- data/lib/tweetkit/auth.rb +15 -0
- data/lib/tweetkit/client.rb +19 -0
- data/lib/tweetkit/client/tweets.rb +26 -0
- data/lib/tweetkit/configurable.rb +21 -0
- data/lib/tweetkit/connection.rb +96 -0
- data/lib/tweetkit/default.rb +11 -0
- data/lib/tweetkit/response.rb +106 -0
- data/lib/tweetkit/search.rb +121 -0
- data/lib/tweetkit/version.rb +3 -0
- data/tweetkit.gemspec +30 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c9fe5ece4cef00bc50ac604a61d38321fb9aeeef648f6586696d0c1b1e14391c
|
4
|
+
data.tar.gz: bafdeeda01397333a669aa4dc5eb9021b3c934995a82b1116de74e5f8a7202f9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e832b0ac7583b4604eca6db1a79615ea86d984191cdd03efcae7fa44215b5a8d1bd78b760312d7e544c595f6c24843983b54e87b4d8f58dfee6e4fa828ea6f9f
|
7
|
+
data.tar.gz: '045117388ada745f039095a51a0e59583509d984eb8bdab308366b14e27dc8908a5849d7f5da436c480ea1fd1b415e87201ee0174298d6ce2f150f4bc7925bd8'
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in tweetkit.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'faraday'
|
7
|
+
gem 'faraday_middleware'
|
8
|
+
gem "minitest", "~> 5.0"
|
9
|
+
gem "rake", "~> 12.0"
|
10
|
+
gem 'simple_oauth', "~> 0.3.0"
|
11
|
+
|
12
|
+
group :test, :development do
|
13
|
+
gem 'pry', '~> 0.13.1'
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tweetkit (0.1.0)
|
5
|
+
faraday (>= 0.9)
|
6
|
+
faraday_middleware (~> 1.0.0)
|
7
|
+
simple_oauth (~> 0.3.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
coderay (1.1.3)
|
13
|
+
faraday (1.4.2)
|
14
|
+
faraday-em_http (~> 1.0)
|
15
|
+
faraday-em_synchrony (~> 1.0)
|
16
|
+
faraday-excon (~> 1.1)
|
17
|
+
faraday-net_http (~> 1.0)
|
18
|
+
faraday-net_http_persistent (~> 1.1)
|
19
|
+
multipart-post (>= 1.2, < 3)
|
20
|
+
ruby2_keywords (>= 0.0.4)
|
21
|
+
faraday-em_http (1.0.0)
|
22
|
+
faraday-em_synchrony (1.0.0)
|
23
|
+
faraday-excon (1.1.0)
|
24
|
+
faraday-net_http (1.0.1)
|
25
|
+
faraday-net_http_persistent (1.1.0)
|
26
|
+
faraday_middleware (1.0.0)
|
27
|
+
faraday (~> 1.0)
|
28
|
+
method_source (1.0.0)
|
29
|
+
minitest (5.14.4)
|
30
|
+
multipart-post (2.1.1)
|
31
|
+
pry (0.13.1)
|
32
|
+
coderay (~> 1.1)
|
33
|
+
method_source (~> 1.0)
|
34
|
+
rake (12.3.3)
|
35
|
+
ruby2_keywords (0.0.4)
|
36
|
+
simple_oauth (0.3.1)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
faraday
|
43
|
+
faraday_middleware
|
44
|
+
minitest (~> 5.0)
|
45
|
+
pry (~> 0.13.1)
|
46
|
+
rake (~> 12.0)
|
47
|
+
simple_oauth (~> 0.3.0)
|
48
|
+
tweetkit!
|
49
|
+
|
50
|
+
BUNDLED WITH
|
51
|
+
2.1.4
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Tweetkit
|
2
|
+
|
3
|
+
`Tweetkit` is a Ruby wrapper for [Twitter's V2 API](https://developer.twitter.com/en/docs/twitter-api/early-access).
|
4
|
+
|
5
|
+
`Tweetkit` is inspired by the original [Twitter gem](https://github.com/sferik/twitter) and the [Octokit ecosystem](https://github.com/octokit/octokit.rb).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'tweetkit'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install tweetkit
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
1. Require the gem.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'tweetkit'
|
29
|
+
```
|
30
|
+
|
31
|
+
2. Initialize a `Tweetkit::Client` instance by passing in your `Bearer Token` to work with Twitter's `OAuth 2.0` authorization requirement. You should also pass in your consumer key and token to perform requests that require `OAuth 1.0` authorization.
|
32
|
+
|
33
|
+
[Read more on how to apply and access your Twitter tokens here.](https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter-api)
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# Initializing via options
|
37
|
+
client = Tweetkit::Client.new(bearer_token: 'YOUR_BEARER_TOKEN_HERE')
|
38
|
+
|
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')
|
41
|
+
|
42
|
+
# You can also initialize the client with a block
|
43
|
+
client = Tweetkit::Client.new do |config|
|
44
|
+
config.bearer_token = 'YOUR_BEARER_TOKEN_HERE'
|
45
|
+
config.consumer_key = 'YOUR_API_KEY_HERE'
|
46
|
+
config.consumer_token = 'YOUR_API_TOKEN_HERE'
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
3. Interact with the Twitter API as needed. Below is an example of fetching a tweet with id `1234567890`.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
response = client.tweet(1234567890)
|
54
|
+
```
|
55
|
+
|
56
|
+
## Documentation
|
57
|
+
|
58
|
+
Coming soon.
|
59
|
+
|
60
|
+
## Development
|
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.
|
63
|
+
|
64
|
+
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
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/julianfssen/tweetkit.
|
69
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tweetkit"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/tweetkit.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tweetkit/configurable'
|
2
|
+
require 'tweetkit/connection'
|
3
|
+
require 'tweetkit/client/tweets'
|
4
|
+
|
5
|
+
module Tweetkit
|
6
|
+
class Client
|
7
|
+
include Tweetkit::Connection
|
8
|
+
include Tweetkit::Client::Tweets
|
9
|
+
|
10
|
+
attr_accessor :access_token, :access_token_secret, :bearer_token, :consumer_key, :consumer_secret, :email, :password
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
options.each do |key, value|
|
14
|
+
instance_variable_set(:"@#{key}", value)
|
15
|
+
end
|
16
|
+
yield self if block_given?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'tweetkit/search'
|
2
|
+
|
3
|
+
module Tweetkit
|
4
|
+
class Client
|
5
|
+
module Tweets
|
6
|
+
def tweet(id, **options)
|
7
|
+
get "tweets/#{id}", options
|
8
|
+
end
|
9
|
+
|
10
|
+
def tweets(ids, **options)
|
11
|
+
if ids.is_a? Array
|
12
|
+
ids = ids.join(',')
|
13
|
+
else
|
14
|
+
ids = ids.delete(' ')
|
15
|
+
end
|
16
|
+
get 'tweets', options.merge!({ ids: ids })
|
17
|
+
end
|
18
|
+
|
19
|
+
def search(query = '', type: :tweet, **options, &block)
|
20
|
+
search = Search.new(query)
|
21
|
+
search.setup(&block) if block_given?
|
22
|
+
get 'tweets/search/recent', options.merge!({ query: search.combined_query })
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Tweetkit
|
2
|
+
module Configurable
|
3
|
+
def self.keys
|
4
|
+
@keys ||= %i[
|
5
|
+
access_token
|
6
|
+
access_token_secret
|
7
|
+
bearer_token
|
8
|
+
consumer_key
|
9
|
+
consumer_secret
|
10
|
+
password
|
11
|
+
email
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def options
|
18
|
+
Hash[Tweetkit::Configurable.keys.map { |key| [key, instance_variable_get(:"@#{key}")] }]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
require 'tweetkit/auth'
|
4
|
+
require 'tweetkit/default'
|
5
|
+
require 'tweetkit/response'
|
6
|
+
|
7
|
+
module Tweetkit
|
8
|
+
module Connection
|
9
|
+
include Tweetkit::Auth
|
10
|
+
|
11
|
+
BASE_URL = 'https://api.twitter.com/2/'
|
12
|
+
|
13
|
+
def get(endpoint, **options)
|
14
|
+
request :get, endpoint, parse_query_and_convenience_headers(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def request(method, endpoint, data, **options)
|
18
|
+
auth_type = options.delete(:auth_type)
|
19
|
+
url = URI.parse("#{BASE_URL}#{endpoint}")
|
20
|
+
|
21
|
+
if method == :get
|
22
|
+
conn = Faraday.new(params: data) do |c|
|
23
|
+
if auth_type == 'oauth1'
|
24
|
+
c.request :oauth, consumer_key: @consumer_key, consumer_secret: @consumer_secret
|
25
|
+
else
|
26
|
+
c.authorization :Bearer, @bearer_token
|
27
|
+
end
|
28
|
+
end
|
29
|
+
response = conn.get(url)
|
30
|
+
else
|
31
|
+
conn = Faraday.new do |f|
|
32
|
+
end
|
33
|
+
response = conn.post(url)
|
34
|
+
end
|
35
|
+
conn.close
|
36
|
+
Tweetkit::Response.new(response)
|
37
|
+
rescue StandardError => e
|
38
|
+
raise e
|
39
|
+
end
|
40
|
+
|
41
|
+
def auth_token(type = 'bearer')
|
42
|
+
case type
|
43
|
+
when 'bearer'
|
44
|
+
@bearer_token
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def build_fields(options)
|
49
|
+
fields = {}
|
50
|
+
_fields = options.delete(:fields)
|
51
|
+
if _fields && _fields.size > 0
|
52
|
+
_fields.each do |key, value|
|
53
|
+
if value.is_a?(Array)
|
54
|
+
_value = value.join(',')
|
55
|
+
else
|
56
|
+
_value = value.delete(' ')
|
57
|
+
end
|
58
|
+
_key = key.to_s.gsub('_', '.')
|
59
|
+
fields.merge!({ "#{_key}.fields" => _value })
|
60
|
+
end
|
61
|
+
end
|
62
|
+
options.each do |key, value|
|
63
|
+
if key.match?('_fields')
|
64
|
+
if value.is_a?(Array)
|
65
|
+
_value = value.join(',')
|
66
|
+
else
|
67
|
+
_value = value.delete(' ')
|
68
|
+
end
|
69
|
+
_key = key.to_s.gsub('_', '.')
|
70
|
+
options.delete(key)
|
71
|
+
fields.merge!({ _key => _value })
|
72
|
+
end
|
73
|
+
end
|
74
|
+
fields
|
75
|
+
end
|
76
|
+
|
77
|
+
def build_expansions(options)
|
78
|
+
expansions = {}
|
79
|
+
_expansions = options.delete(:expansions)
|
80
|
+
if _expansions && _expansions.size > 0
|
81
|
+
_expansions = _expansions.join(',')
|
82
|
+
expansions.merge!({ expansions: _expansions })
|
83
|
+
end
|
84
|
+
expansions
|
85
|
+
end
|
86
|
+
|
87
|
+
def parse_query_and_convenience_headers(options)
|
88
|
+
options = options.dup
|
89
|
+
fields = build_fields(options)
|
90
|
+
options.merge!(fields)
|
91
|
+
expansions = build_expansions(options)
|
92
|
+
options.merge!(expansions)
|
93
|
+
options
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
module Tweetkit
|
5
|
+
class Response
|
6
|
+
attr_accessor :expansions, :meta, :original_response, :tweets
|
7
|
+
|
8
|
+
def initialize(response)
|
9
|
+
@original_response = response.body
|
10
|
+
parsed_response = JSON.parse(@original_response)
|
11
|
+
@tweets = Tweetkit::Response::Tweets.new(parsed_response)
|
12
|
+
@meta = Tweetkit::Response::Meta.new(@tweets.meta)
|
13
|
+
@expansions = Tweetkit::Response::Expansions.new(@tweets.expansions)
|
14
|
+
end
|
15
|
+
|
16
|
+
class Expansions
|
17
|
+
include Enumerable
|
18
|
+
|
19
|
+
attr_accessor :expansions
|
20
|
+
|
21
|
+
def initialize(expansions)
|
22
|
+
@expansions = expansions
|
23
|
+
end
|
24
|
+
|
25
|
+
def method_missing(attribute, **args)
|
26
|
+
data = expansions[attribute.to_s]
|
27
|
+
data.empty? ? super : data
|
28
|
+
end
|
29
|
+
|
30
|
+
def respond_to_missing?(method)
|
31
|
+
expansions.respond_to? method
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Meta
|
36
|
+
include Enumerable
|
37
|
+
|
38
|
+
attr_accessor :meta
|
39
|
+
|
40
|
+
def initialize(meta)
|
41
|
+
@meta = meta
|
42
|
+
end
|
43
|
+
|
44
|
+
def method_missing(attribute, **args)
|
45
|
+
data = meta[attribute.to_s]
|
46
|
+
data.empty? ? super : data
|
47
|
+
end
|
48
|
+
|
49
|
+
def respond_to_missing?(method)
|
50
|
+
meta.respond_to? method
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class Tweets
|
55
|
+
include Enumerable
|
56
|
+
|
57
|
+
attr_accessor :tweets, :meta, :expansions
|
58
|
+
|
59
|
+
def initialize(response)
|
60
|
+
@tweets = response['data'].collect { |tweet| Tweetkit::Response::Tweet.new(tweet) }
|
61
|
+
@meta = response['meta']
|
62
|
+
@expansions = response['includes']
|
63
|
+
end
|
64
|
+
|
65
|
+
def each(*args, &block)
|
66
|
+
tweets.each(*args, &block)
|
67
|
+
end
|
68
|
+
|
69
|
+
def last
|
70
|
+
tweets.last
|
71
|
+
end
|
72
|
+
|
73
|
+
def to_s
|
74
|
+
@tweets.join(' ')
|
75
|
+
end
|
76
|
+
|
77
|
+
def method_missing(attribute, **args)
|
78
|
+
result = tweets.public_send(attribute, **args)
|
79
|
+
super unless result
|
80
|
+
rescue StandardError
|
81
|
+
super
|
82
|
+
end
|
83
|
+
|
84
|
+
def respond_to_missing?(method)
|
85
|
+
tweets.respond_to? method
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
class Tweet
|
90
|
+
attr_accessor :tweet
|
91
|
+
|
92
|
+
def initialize(tweet)
|
93
|
+
@tweet = tweet
|
94
|
+
end
|
95
|
+
|
96
|
+
def method_missing(attribute)
|
97
|
+
data = tweet[attribute.to_s]
|
98
|
+
data.empty? ? super : data
|
99
|
+
end
|
100
|
+
|
101
|
+
def respond_to_missing?(method)
|
102
|
+
tweet.respond_to? method
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tweetkit
|
4
|
+
class Search
|
5
|
+
attr_accessor :search_term
|
6
|
+
|
7
|
+
def initialize(term)
|
8
|
+
@search_term = term + ' '
|
9
|
+
end
|
10
|
+
|
11
|
+
def opts
|
12
|
+
@opts ||= {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def connectors
|
16
|
+
@connectors ||= opts[:connectors] = []
|
17
|
+
end
|
18
|
+
|
19
|
+
def update_search_term(term)
|
20
|
+
@search_term += term
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup(&block)
|
24
|
+
instance_eval(&block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def combined_query
|
28
|
+
@combined_query = "#{@search_term.strip} #{combine_connectors}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def combine_connectors
|
32
|
+
connectors.join(' ')
|
33
|
+
end
|
34
|
+
|
35
|
+
def add_connector(term, grouped: true)
|
36
|
+
grouped ? connectors.push("(#{term})") : connectors.push(term)
|
37
|
+
end
|
38
|
+
|
39
|
+
def build_connector(connector, terms, &block)
|
40
|
+
query = ''
|
41
|
+
connector =
|
42
|
+
connector
|
43
|
+
.to_s
|
44
|
+
.delete_prefix('and_')
|
45
|
+
.delete_prefix('or_')
|
46
|
+
.delete_suffix('_one_of')
|
47
|
+
.to_sym
|
48
|
+
if connector.match?('contains')
|
49
|
+
terms.each do |term|
|
50
|
+
term = term.to_s.strip
|
51
|
+
if term.split.length > 1
|
52
|
+
query += "\"#{term}\" "
|
53
|
+
else
|
54
|
+
query += "#{term} "
|
55
|
+
end
|
56
|
+
end
|
57
|
+
update_search_term(query)
|
58
|
+
elsif connector.match?('without')
|
59
|
+
terms.each do |term|
|
60
|
+
term = term.to_s.strip
|
61
|
+
if term.split.length > 1
|
62
|
+
query += "-\"#{term}\" "
|
63
|
+
else
|
64
|
+
query += "-#{term} "
|
65
|
+
end
|
66
|
+
end
|
67
|
+
add_connector(query.rstrip, grouped: false)
|
68
|
+
elsif connector.match?('is_not')
|
69
|
+
connector = connector.to_s.delete_suffix('_not').to_sym
|
70
|
+
terms.each do |term|
|
71
|
+
term = term.to_s.strip
|
72
|
+
query += "-#{connector}:#{term} "
|
73
|
+
end
|
74
|
+
add_connector(query.rstrip)
|
75
|
+
else
|
76
|
+
terms.each do |term|
|
77
|
+
term = term.to_s.strip
|
78
|
+
query += "#{connector}:#{term} "
|
79
|
+
end
|
80
|
+
add_connector(query.rstrip, grouped: false)
|
81
|
+
end
|
82
|
+
block_given? ? yield : self
|
83
|
+
end
|
84
|
+
|
85
|
+
def build_one_of_connector(connector, terms, &block)
|
86
|
+
query = []
|
87
|
+
connector =
|
88
|
+
connector
|
89
|
+
.to_s
|
90
|
+
.delete_prefix('and_')
|
91
|
+
.delete_prefix('or_')
|
92
|
+
.delete_suffix('_one_of')
|
93
|
+
.to_sym
|
94
|
+
if connector.match?('contains')
|
95
|
+
terms.each do |term|
|
96
|
+
term = term.to_s.strip
|
97
|
+
query << term
|
98
|
+
end
|
99
|
+
else
|
100
|
+
terms.each do |term|
|
101
|
+
term = term.to_s.strip
|
102
|
+
query << "#{connector}: #{term}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
add_connector(query.join(' OR '))
|
106
|
+
block_given? ? yield : self
|
107
|
+
end
|
108
|
+
|
109
|
+
def method_missing(connector, *terms, &block)
|
110
|
+
if connector.match?('one_of')
|
111
|
+
build_one_of_connector(connector, terms, &block)
|
112
|
+
else
|
113
|
+
build_connector(connector, terms, &block)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def respond_to_missing?(method)
|
118
|
+
method.match?('one_of') || super
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
data/tweetkit.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'lib/tweetkit/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "tweetkit"
|
5
|
+
spec.version = Tweetkit::VERSION
|
6
|
+
spec.authors = ["Julian Foo"]
|
7
|
+
spec.email = ["juliandevmy@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{WIP: Simple API wrapper for Twitter's V2 API}
|
10
|
+
spec.description = %q{WIP: Tweetkit is an Octokit-inspired Ruby wrapper for Twitter's V2 API}
|
11
|
+
spec.homepage = "https://github.com/julianfssen/tweetkit"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
15
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
16
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_dependency 'faraday', '>= 0.9'
|
28
|
+
spec.add_dependency 'faraday_middleware', '~> 1.0.0'
|
29
|
+
spec.add_dependency 'simple_oauth', '~> 0.3.0'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tweetkit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julian Foo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simple_oauth
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.3.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.3.0
|
55
|
+
description: 'WIP: Tweetkit is an Octokit-inspired Ruby wrapper for Twitter''s V2
|
56
|
+
API'
|
57
|
+
email:
|
58
|
+
- juliandevmy@gmail.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/tweetkit.rb
|
72
|
+
- lib/tweetkit/auth.rb
|
73
|
+
- lib/tweetkit/client.rb
|
74
|
+
- lib/tweetkit/client/tweets.rb
|
75
|
+
- lib/tweetkit/configurable.rb
|
76
|
+
- lib/tweetkit/connection.rb
|
77
|
+
- lib/tweetkit/default.rb
|
78
|
+
- lib/tweetkit/response.rb
|
79
|
+
- lib/tweetkit/search.rb
|
80
|
+
- lib/tweetkit/version.rb
|
81
|
+
- tweetkit.gemspec
|
82
|
+
homepage: https://github.com/julianfssen/tweetkit
|
83
|
+
licenses: []
|
84
|
+
metadata:
|
85
|
+
homepage_uri: https://github.com/julianfssen/tweetkit
|
86
|
+
source_code_uri: https://github.com/julianfssen/tweetkit
|
87
|
+
changelog_uri: https://github.com/julianfssen/tweetkit
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.3.0
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubygems_version: 3.1.2
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: 'WIP: Simple API wrapper for Twitter''s V2 API'
|
107
|
+
test_files: []
|