Reference documentation and code samples for the signet class Signet::OAuth1::Client.
Inherits
- Object
Methods
#access_token
def
access_token
()
-
>
Signet
::
OAuth1
::
Credential
Returns the token credential for this client.
- ( Signet::OAuth1::Credential ) — The token credentials.
#access_token=
def
access_token=
(
new_token_credential
)
Sets the token credential for this client.
- new_token_credential( Signet::OAuth1::Credential ) — The token credentials.
#access_token_key
def
access_token_key
()
-
>
String
Returns the token credential key for this client.
- (String) — The token credential key.
#access_token_key=
def
access_token_key=
(
new_token_credential_key
)
Sets the token credential key for this client.
- new_token_credential_key(String, #to_str) — The token credential key.
#access_token_secret
def
access_token_secret
()
-
>
String
Returns the token credential secret for this client.
- (String) — The token credential secret.
#access_token_secret=
def
access_token_secret=
(
new_token_credential_secret
)
Sets the token credential secret for this client.
- new_token_credential_secret(String, #to_str) — The token credential secret.
#access_token_uri
def
access_token_uri
()
-
>
Addressable
::
URI
Returns the token credential URI for this client.
- (Addressable::URI) — The token credential URI.
#access_token_uri=
def
access_token_uri=
(
new_token_credential_uri
)
Sets the token credential URI for this client.
- new_token_credential_uri(Addressable::URI, Hash, String, #to_str) — The token credential URI.
#authorization_uri
def
authorization_uri
(
options
=
{})
-
>
Addressable
::
URI
Returns the authorization URI that the user should be redirected to.
- (Addressable::URI) — The authorization URI.
#authorization_uri=
def
authorization_uri=
(
new_authorization_uri
)
Sets the authorization URI for this client.
- new_authorization_uri(Addressable::URI, String, #to_str) — The authorization URI.
#callback
def
callback
()
-
>
String
Returns the callback for this client.
- (String) — The OAuth callback.
#callback=
def
callback=
(
new_callback
)
Sets the callback for this client.
- new_callback(String, #to_str) — The OAuth callback.
#client_credential
def
client_credential
()
-
>
Signet
::
OAuth1
::
Credential
Returns the client credential for this client.
- ( Signet::OAuth1::Credential ) — The client credentials.
#client_credential=
def
client_credential=
(
new_client_credential
)
Sets the client credential for this client.
- new_client_credential( Signet::OAuth1::Credential ) — The client credentials.
#client_credential_key
def
client_credential_key
()
-
>
String
Returns the client credential key for this client.
- (String) — The client credential key.
#client_credential_key=
def
client_credential_key=
(
new_client_credential_key
)
Sets the client credential key for this client.
- new_client_credential_key(String, #to_str) — The client credential key.
#client_credential_secret
def
client_credential_secret
()
-
>
String
Returns the client credential secret for this client.
- (String) — The client credential secret.
#client_credential_secret=
def
client_credential_secret=
(
new_client_credential_secret
)
Sets the client credential secret for this client.
- new_client_credential_secret(String, #to_str) — The client credential secret.
#consumer_key
def
consumer_key
()
-
>
String
Returns the client credential key for this client.
- (String) — The client credential key.
#consumer_key=
def
consumer_key=
(
new_client_credential_key
)
Sets the client credential key for this client.
- new_client_credential_key(String, #to_str) — The client credential key.
#consumer_secret
def
consumer_secret
()
-
>
String
Returns the client credential secret for this client.
- (String) — The client credential secret.
#consumer_secret=
def
consumer_secret=
(
new_client_credential_secret
)
Sets the client credential secret for this client.
- new_client_credential_secret(String, #to_str) — The client credential secret.
#consumer_token
def
consumer_token
()
-
>
Signet
::
OAuth1
::
Credential
Returns the client credential for this client.
- ( Signet::OAuth1::Credential ) — The client credentials.
#consumer_token=
def
consumer_token=
(
new_client_credential
)
Sets the client credential for this client.
- new_client_credential( Signet::OAuth1::Credential ) — The client credentials.
#fetch_access_token
def
fetch_access_token
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a token credential. This method does not have side-effects within the client.
- options(Hash) —
The configuration parameters for the request.
-
:verifier
- The OAuth verifier provided by the server. Required. -
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The token credential.
token_credential = client . fetch_token_credential ( :verifier = > '12345' )
#fetch_access_token!
def
fetch_access_token!
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a token credential. This method updates the client with the new token credential.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The token credential.
client . fetch_token_credential! ( :verifier = > '12345' )
#fetch_protected_resource
def
fetch_protected_resource
(
options
=
{})
-
>
Array
Transmits a request for a protected resource.
- options(Hash) —
The configuration parameters for the request.
-
:request
- A pre-constructed request to sign. -
:method
- The HTTP method for the request. Defaults to :get. -
:uri
- The URI for the request. -
:headers
- The HTTP headers for the request. -
:body
- The HTTP body for the request. -
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- (Array) — The response object.
# Using Net::HTTP response = client . fetch_protected_resource ( :uri = > 'http://www.example.com/protected/resource' )
# Using Typhoeus response = client . fetch_protected_resource ( :request = > Typhoeus :: Request . new ( 'http://www.example.com/protected/resource' ), :connection = > connection )
#fetch_request_token
def
fetch_request_token
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a temporary credential. This method does not have side-effects within the client.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The temporary credential.
temporary_credential = client . fetch_temporary_credential ( :additional_parameters = > { :scope = > 'https://mail.google.com/mail/feed/atom' } )
#fetch_request_token!
def
fetch_request_token!
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a temporary credential. This method updates the client with the new temporary credential.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The temporary credential.
client . fetch_temporary_credential! ( :additional_parameters = > { :scope = > 'https://mail.google.com/mail/feed/atom' })
#fetch_temporary_credential
def
fetch_temporary_credential
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a temporary credential. This method does not have side-effects within the client.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The temporary credential.
temporary_credential = client . fetch_temporary_credential ( :additional_parameters = > { :scope = > 'https://mail.google.com/mail/feed/atom' } )
#fetch_temporary_credential!
def
fetch_temporary_credential!
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a temporary credential. This method updates the client with the new temporary credential.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The temporary credential.
client . fetch_temporary_credential! ( :additional_parameters = > { :scope = > 'https://mail.google.com/mail/feed/atom' })
#fetch_token_credential
def
fetch_token_credential
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a token credential. This method does not have side-effects within the client.
- options(Hash) —
The configuration parameters for the request.
-
:verifier
- The OAuth verifier provided by the server. Required. -
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The token credential.
token_credential = client . fetch_token_credential ( :verifier = > '12345' )
#fetch_token_credential!
def
fetch_token_credential!
(
options
=
{})
-
>
Signet
::
OAuth1
::
Credential
Transmits a request for a token credential. This method updates the client with the new token credential.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617. -
:connection
- The HTTP connection to use. Must be of typeFaraday::Connection
.
-
- ( Signet::OAuth1::Credential ) — The token credential.
client . fetch_token_credential! ( :verifier = > '12345' )
#generate_access_token_request
def
generate_access_token_request
(
options
=
{})
-
>
Array
Generates a request for token credentials.
- options(Hash) —
The configuration parameters for the request.
-
:verifier
- The OAuth verifier provided by the server. Required. -
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:realm
- The Authorization realm. See RFC 2617.
-
- (Array) — The request object.
#generate_authenticated_request
def
generate_authenticated_request
(
options
=
{})
-
>
Array
Generates an authenticated request for protected resources.
- options(Hash) —
The configuration parameters for the request.
-
:request
- A pre-constructed request to sign. -
:method
- The HTTP method for the request. Defaults to :get. -
:uri
- The URI for the request. -
:headers
- The HTTP headers for the request. -
:body
- The HTTP body for the request. -
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:realm
- The Authorization realm. See RFC 2617.
-
- (Array) — The request object.
#generate_request_token_request
def
generate_request_token_request
(
options
=
{})
-
>
Array
Generates a request for temporary credentials.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617.
-
- (Array) — The request object.
#generate_temporary_credential_request
def
generate_temporary_credential_request
(
options
=
{})
-
>
Array
Generates a request for temporary credentials.
- options(Hash) —
The configuration parameters for the request.
-
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:additional_parameters
- Non-standard additional parameters. -
:realm
- The Authorization realm. See RFC 2617.
-
- (Array) — The request object.
#generate_token_credential_request
def
generate_token_credential_request
(
options
=
{})
-
>
Array
Generates a request for token credentials.
- options(Hash) —
The configuration parameters for the request.
-
:verifier
- The OAuth verifier provided by the server. Required. -
:signature_method
- The signature method. Defaults to'HMAC-SHA1'
. -
:realm
- The Authorization realm. See RFC 2617.
-
- (Array) — The request object.
#initialize
def
initialize
(
options
=
{})
-
>
Client
Creates an OAuth 1.0 client.
- options(Hash) —
The configuration parameters for the client.
-
:temporary_credential_uri
- The OAuth temporary credentials URI. -
:authorization_uri
- The OAuth authorization URI. -
:token_credential_uri
- The OAuth token credentials URI. -
:client_credential_key
- The OAuth client credential key. -
:client_credential_secret
- The OAuth client credential secret. -
:callback
- The OAuth callback. Defaults to 'oob'.
-
- ( Client ) — a new instance of Client
client = Signet :: OAuth1 :: Client . new ( :temporary_credential_uri = > 'https://www.google.com/accounts/OAuthGetRequestToken' , :authorization_uri = > 'https://www.google.com/accounts/OAuthAuthorizeToken' , :token_credential_uri = > 'https://www.google.com/accounts/OAuthGetAccessToken' , :client_credential_key = > 'anonymous' , :client_credential_secret = > 'anonymous' )
#request_token
def
request_token
()
-
>
Signet
::
OAuth1
::
Credential
Returns the temporary credential for this client.
- ( Signet::OAuth1::Credential ) — The temporary credentials.
#request_token=
def
request_token=
(
new_temporary_credential
)
Sets the temporary credential for this client.
- new_temporary_credential( Signet::OAuth1::Credential ) — The temporary credentials.
#request_token_key
def
request_token_key
()
-
>
String
Returns the temporary credential key for this client.
- (String) — The temporary credential key.
#request_token_key=
def
request_token_key=
(
new_temporary_credential_key
)
Sets the temporary credential key for this client.
- new_temporary_credential_key(String, #to_str) — The temporary credential key.
#request_token_secret
def
request_token_secret
()
-
>
String
Returns the temporary credential secret for this client.
- (String) — The temporary credential secret.
#request_token_secret=
def
request_token_secret=
(
new_temporary_credential_secret
)
Sets the temporary credential secret for this client.
- new_temporary_credential_secret(String, #to_str) — The temporary credential secret.
#request_token_uri
def
request_token_uri
()
-
>
Addressable
::
URI
Returns the temporary credentials URI for this client.
- (Addressable::URI) — The temporary credentials URI.
#request_token_uri=
def
request_token_uri=
(
new_temporary_credential_uri
)
Sets the temporary credentials URI for this client.
- new_temporary_credential_uri(Addressable::URI, String, #to_str) — The temporary credentials URI.
#temporary_credential
def
temporary_credential
()
-
>
Signet
::
OAuth1
::
Credential
Returns the temporary credential for this client.
- ( Signet::OAuth1::Credential ) — The temporary credentials.
#temporary_credential=
def
temporary_credential=
(
new_temporary_credential
)
Sets the temporary credential for this client.
- new_temporary_credential( Signet::OAuth1::Credential ) — The temporary credentials.
#temporary_credential_key
def
temporary_credential_key
()
-
>
String
Returns the temporary credential key for this client.
- (String) — The temporary credential key.
#temporary_credential_key=
def
temporary_credential_key=
(
new_temporary_credential_key
)
Sets the temporary credential key for this client.
- new_temporary_credential_key(String, #to_str) — The temporary credential key.
#temporary_credential_secret
def
temporary_credential_secret
()
-
>
String
Returns the temporary credential secret for this client.
- (String) — The temporary credential secret.
#temporary_credential_secret=
def
temporary_credential_secret=
(
new_temporary_credential_secret
)
Sets the temporary credential secret for this client.
- new_temporary_credential_secret(String, #to_str) — The temporary credential secret.
#temporary_credential_uri
def
temporary_credential_uri
()
-
>
Addressable
::
URI
Returns the temporary credentials URI for this client.
- (Addressable::URI) — The temporary credentials URI.
#temporary_credential_uri=
def
temporary_credential_uri=
(
new_temporary_credential_uri
)
Sets the temporary credentials URI for this client.
- new_temporary_credential_uri(Addressable::URI, String, #to_str) — The temporary credentials URI.
#to_json
def
to_json
(
*
_args
)
-
>
String
Serialize the client object to JSON.
- (String) — A serialized JSON representation of the client.
#token_credential
def
token_credential
()
-
>
Signet
::
OAuth1
::
Credential
Returns the token credential for this client.
- ( Signet::OAuth1::Credential ) — The token credentials.
#token_credential=
def
token_credential=
(
new_token_credential
)
Sets the token credential for this client.
- new_token_credential( Signet::OAuth1::Credential ) — The token credentials.
#token_credential_key
def
token_credential_key
()
-
>
String
Returns the token credential key for this client.
- (String) — The token credential key.
#token_credential_key=
def
token_credential_key=
(
new_token_credential_key
)
Sets the token credential key for this client.
- new_token_credential_key(String, #to_str) — The token credential key.
#token_credential_secret
def
token_credential_secret
()
-
>
String
Returns the token credential secret for this client.
- (String) — The token credential secret.
#token_credential_secret=
def
token_credential_secret=
(
new_token_credential_secret
)
Sets the token credential secret for this client.
- new_token_credential_secret(String, #to_str) — The token credential secret.
#token_credential_uri
def
token_credential_uri
()
-
>
Addressable
::
URI
Returns the token credential URI for this client.
- (Addressable::URI) — The token credential URI.
#token_credential_uri=
def
token_credential_uri=
(
new_token_credential_uri
)
Sets the token credential URI for this client.
- new_token_credential_uri(Addressable::URI, Hash, String, #to_str) — The token credential URI.
#two_legged
def
two_legged
()
-
>
TrueClass
,
FalseClass
Returns whether the client is in two-legged mode.
- (TrueClass, FalseClass) —
true
for two-legged mode,false
otherwise.
#two_legged=
def
two_legged=
(
new_two_legged
)
Sets the client for two-legged mode.
- new_two_legged(TrueClass, FalseClass) —
true
for two-legged mode,false
otherwise.
#update!
def
update!
(
options
=
{})
Updates an OAuth 1.0 client.
- options(Hash) —
The configuration parameters for the client.
-
:temporary_credential_uri
- The OAuth temporary credentials URI. -
:authorization_uri
- The OAuth authorization URI. -
:token_credential_uri
- The OAuth token credentials URI. -
:client_credential_key
- The OAuth client credential key. -
:client_credential_secret
- The OAuth client credential secret. -
:callback
- The OAuth callback. Defaults to 'oob'.
-
client . update! ( :temporary_credential_uri = > 'https://www.google.com/accounts/OAuthGetRequestToken' , :authorization_uri = > 'https://www.google.com/accounts/OAuthAuthorizeToken' , :token_credential_uri = > 'https://www.google.com/accounts/OAuthGetAccessToken' , :client_credential_key = > 'anonymous' , :client_credential_secret = > 'anonymous' )