Class: GData::Auth::OAuth
- Inherits:
-
Object
- Object
- GData::Auth::OAuth
- Defined in:
- lib/gdata/auth/oauth.rb
Instance Attribute Summary collapse
-
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
-
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
-
#oauth_secret ⇒ Object
Returns the value of attribute oauth_secret.
-
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
-
#use_body_hash ⇒ Object
writeonly
Sets the attribute use_body_hash.
Instance Method Summary collapse
-
#initialize(options) ⇒ OAuth
constructor
A new instance of OAuth.
- #sign_request!(request) ⇒ Object
- #use_body_hash? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ OAuth
Returns a new instance of OAuth.
12 13 14 15 16 17 18 |
# File 'lib/gdata/auth/oauth.rb', line 12 def initialize() @oauth_token = [:oauth_token] @oauth_secret = [:oauth_secret] @consumer_key = [:consumer_key] @consumer_secret = [:consumer_secret] @use_body_hash = [:use_body_hash] end |
Instance Attribute Details
#consumer_key ⇒ Object
Returns the value of attribute consumer_key.
9 10 11 |
# File 'lib/gdata/auth/oauth.rb', line 9 def consumer_key @consumer_key end |
#consumer_secret ⇒ Object
Returns the value of attribute consumer_secret.
9 10 11 |
# File 'lib/gdata/auth/oauth.rb', line 9 def consumer_secret @consumer_secret end |
#oauth_secret ⇒ Object
Returns the value of attribute oauth_secret.
9 10 11 |
# File 'lib/gdata/auth/oauth.rb', line 9 def oauth_secret @oauth_secret end |
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
9 10 11 |
# File 'lib/gdata/auth/oauth.rb', line 9 def oauth_token @oauth_token end |
#use_body_hash=(value) ⇒ Object (writeonly)
Sets the attribute use_body_hash
10 11 12 |
# File 'lib/gdata/auth/oauth.rb', line 10 def use_body_hash=(value) @use_body_hash = value end |
Instance Method Details
#sign_request!(request) ⇒ Object
20 21 22 23 24 |
# File 'lib/gdata/auth/oauth.rb', line 20 def sign_request!(request) header_parts = oauth_parameters(request) header_parts['oauth_signature'] = calc_signature(request, header_parts) request.headers['Authorization'] = "OAuth " + header_parts.map { |k,v| "#{k}=\"#{v}\"" }.sort.join(', ') end |
#use_body_hash? ⇒ Boolean
26 27 28 |
# File 'lib/gdata/auth/oauth.rb', line 26 def use_body_hash? !!@use_body_hash end |