Class: TwitterOAuth2::Client
- Inherits:
-
Rack::OAuth2::Client
- Object
- Rack::OAuth2::Client
- TwitterOAuth2::Client
- Defined in:
- lib/twitter_oauth2/client.rb
Instance Attribute Summary collapse
-
#code_challenge ⇒ Object
Returns the value of attribute code_challenge.
-
#code_challenge_method ⇒ Object
Returns the value of attribute code_challenge_method.
-
#code_verifier ⇒ Object
Returns the value of attribute code_verifier.
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
- #access_token!(*args) ⇒ Object
- #authorization_uri(params = {}) ⇒ Object
-
#initialize(attributes) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(attributes) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 |
# File 'lib/twitter_oauth2/client.rb', line 5 def initialize(attributes) attributes_with_default = { host: 'api.twitter.com', authorization_endpoint: 'https://twitter.com/i/oauth2/authorize', token_endpoint: '/2/oauth2/token' }.merge(attributes) super attributes_with_default end |
Instance Attribute Details
#code_challenge ⇒ Object
Returns the value of attribute code_challenge.
3 4 5 |
# File 'lib/twitter_oauth2/client.rb', line 3 def code_challenge @code_challenge end |
#code_challenge_method ⇒ Object
Returns the value of attribute code_challenge_method.
3 4 5 |
# File 'lib/twitter_oauth2/client.rb', line 3 def code_challenge_method @code_challenge_method end |
#code_verifier ⇒ Object
Returns the value of attribute code_verifier.
3 4 5 |
# File 'lib/twitter_oauth2/client.rb', line 3 def code_verifier @code_verifier end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/twitter_oauth2/client.rb', line 3 def state @state end |
Instance Method Details
#access_token!(*args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/twitter_oauth2/client.rb', line 23 def access_token!(*args) = args. super({ # NOTE: # For some reason, Twitter requires client_id duplication both in body & header for confidentail clients. # Follow such behaviour for now. # Hopefully, I can remove this line in near future. client_id: identifier, code_verifier: args.first || self.code_verifier }.merge()) end |
#authorization_uri(params = {}) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/twitter_oauth2/client.rb', line 14 def (params = {}) super({ code_challenge: code_challenge, code_challenge_method: code_challenge_method, state: state }.merge(params)) end |