File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11module Tweetkit
22 # Module for checking client authentication methods
33 module Auth
4- private
5-
64 # Determines if requests are to be authenticated with OAuth 1.0a (with consumer and access tokens)
75 #
86 # @return [Boolean]
Original file line number Diff line number Diff line change 11require "faraday"
22
3+ # TODO: Refactor error handling to be more robust
34module Tweetkit
45 class Error < StandardError
56 class ClientError < Faraday ::ClientError ; end
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ class Tweets
1515 # @!method prev_token
1616 # @see Tweetkit::Response::Tweets::Meta#prev_token
1717 # @return [String]
18+ # @!method previous_token
19+ # @see Tweetkit::Response::Tweets::Meta#previous_token
20+ # @return [String]
1821 def_delegators :meta , :next_token , :prev_token , :previous_token
1922
2023 def initialize ( response , **options )
Original file line number Diff line number Diff line change 1+ require "test_helper"
2+
3+ class Tweetkit ::AuthTest < Minitest ::Test
4+ def test_token_auth?
5+ client = Tweetkit ::Client . new (
6+ access_token : ENV [ "ACCESS_TOKEN" ] ,
7+ access_token_secret : ENV [ "ACCESS_TOKEN_SECRET" ] ,
8+ consumer_key : ENV [ "CONSUMER_KEY" ] ,
9+ consumer_secret : ENV [ "CONSUMER_SECRET" ]
10+ )
11+
12+ assert client . token_auth?
13+ refute client . bearer_auth?
14+ end
15+
16+ def test_bearer_auth?
17+ client = Tweetkit ::Client . new (
18+ bearer_token : ENV [ "BEARER_TOKEN" ] ,
19+ )
20+
21+ refute client . token_auth?
22+ assert client . bearer_auth?
23+ end
24+ end
Original file line number Diff line number Diff line change 1+ require "test_helper"
2+
3+ # TODO
4+ class Tweetkit ::ErrorTest < Minitest ::Test
5+ end
Original file line number Diff line number Diff line change 11require "test_helper"
22
33class Tweetkit ::Response ::TweetTest < Minitest ::Test
4- attr_accessor :client
5-
64 TWEET_ID = 1212092628029698048
75 GEO_TWEET_ID = 1136048014974423040
86 POLL_TWEET_ID = 1199786642791452673
Original file line number Diff line number Diff line change 1+ require "test_helper"
2+
3+ class Tweetkit ::Response ::TweetsTest < Minitest ::Test
4+ TWEET_ID = 1212092628029698048
5+ GEO_TWEET_ID = 1136048014974423040
6+ POLL_TWEET_ID = 1199786642791452673
7+
8+ def setup
9+ @client = Tweetkit ::Client . new ( bearer_token : ENV [ "BEARER_TOKEN" ] )
10+ @tweets = @client . tweets ( [ TWEET_ID , GEO_TWEET_ID , POLL_TWEET_ID ] , all_public_fields_and_expansions : true )
11+ end
12+
13+ # def test_tweets
14+ # assert_equal Tweetkit::Response::Tweets, @tweets.class
15+ # end
16+
17+ def test_meta
18+ @tweets = @client . search ( "twitter" )
19+ assert_equal Tweetkit ::Response ::Tweets ::Meta , @tweets . meta . class
20+ end
21+
22+ # def test_last
23+ # assert_equal Tweetkit::Response::Tweet, @tweets.last.class
24+ # end
25+
26+ # def test_array_accessor
27+ # assert_equal Tweetkit::Response::Tweet, @tweets[0].class
28+ # end
29+ end
You can’t perform that action at this time.
0 commit comments