Class: X::OAuthAuthenticator
- Inherits:
-
Authenticator
- Object
- Authenticator
- X::OAuthAuthenticator
- Defined in:
- lib/x/oauth_authenticator.rb
Constant Summary collapse
- OAUTH_VERSION =
"1.0".freeze
- OAUTH_SIGNATURE_METHOD =
"HMAC-SHA1".freeze
- OAUTH_SIGNATURE_ALGORITHM =
"sha1".freeze
Constants inherited from Authenticator
Authenticator::AUTHENTICATION_HEADER
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#access_token_secret ⇒ Object
Returns the value of attribute access_token_secret.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_key_secret ⇒ Object
Returns the value of attribute api_key_secret.
Instance Method Summary collapse
- #header(request) ⇒ Object
-
#initialize(api_key:, api_key_secret:, access_token:, access_token_secret:) ⇒ OAuthAuthenticator
constructor
rubocop:disable Lint/MissingSuper.
Constructor Details
#initialize(api_key:, api_key_secret:, access_token:, access_token_secret:) ⇒ OAuthAuthenticator
rubocop:disable Lint/MissingSuper
17 18 19 20 21 22 |
# File 'lib/x/oauth_authenticator.rb', line 17 def initialize(api_key:, api_key_secret:, access_token:, access_token_secret:) # rubocop:disable Lint/MissingSuper @api_key = api_key @api_key_secret = api_key_secret @access_token = access_token @access_token_secret = access_token_secret end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
15 16 17 |
# File 'lib/x/oauth_authenticator.rb', line 15 def access_token @access_token end |
#access_token_secret ⇒ Object
Returns the value of attribute access_token_secret.
15 16 17 |
# File 'lib/x/oauth_authenticator.rb', line 15 def access_token_secret @access_token_secret end |
#api_key ⇒ Object
Returns the value of attribute api_key.
15 16 17 |
# File 'lib/x/oauth_authenticator.rb', line 15 def api_key @api_key end |
#api_key_secret ⇒ Object
Returns the value of attribute api_key_secret.
15 16 17 |
# File 'lib/x/oauth_authenticator.rb', line 15 def api_key_secret @api_key_secret end |
Instance Method Details
#header(request) ⇒ Object
24 25 26 27 |
# File 'lib/x/oauth_authenticator.rb', line 24 def header(request) method, url, query_params = parse_request(request) {AUTHENTICATION_HEADER => build_oauth_header(method, url, query_params)} end |