Module: TwitterTweetBot::Client::API

Included in:
TwitterTweetBot::Client
Defined in:
lib/twitter_tweet_bot/client/api.rb

Instance Method Summary collapse

Instance Method Details

#authorize(code_verifier = nil, code_challenge_method = nil, state = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/twitter_tweet_bot/client/api.rb', line 6

def authorize(code_verifier = nil, code_challenge_method = nil, state = nil)
  TwitterTweetBot::API::Authorization.authorize(
    **params_with_config(
      code_verifier: code_verifier,
      code_challenge_method: code_challenge_method,
      state: state
    )
  )
end

#fetch_token(code, code_verifier) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/twitter_tweet_bot/client/api.rb', line 16

def fetch_token(code, code_verifier)
  TwitterTweetBot::API::AccessToken.fetch(
    **params_with_config(
      code: code,
      code_verifier: code_verifier
    )
  )
end

#post_tweet(access_token, text, &block) ⇒ Object



31
32
33
34
35
# File 'lib/twitter_tweet_bot/client/api.rb', line 31

def post_tweet(access_token, text, &block)
  TwitterTweetBot::API::Tweet.post(
    **params_with_config(access_token: access_token, text: text), &block
  )
end

#refresh_token(refresh_token) ⇒ Object



25
26
27
28
29
# File 'lib/twitter_tweet_bot/client/api.rb', line 25

def refresh_token(refresh_token)
  TwitterTweetBot::API::RefreshToken.fetch(
    **params_with_config(refresh_token: refresh_token)
  )
end

#users_me(access_token, &block) ⇒ Object



37
38
39
40
41
# File 'lib/twitter_tweet_bot/client/api.rb', line 37

def users_me(access_token, &block)
  TwitterTweetBot::API::UsersMe.fetch(
    **params_with_config(access_token: access_token), &block
  )
end