Class: GData::Auth::OAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/gdata/auth/oauth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options)
  @oauth_token     = options[:oauth_token]
  @oauth_secret    = options[:oauth_secret]
  @consumer_key    = options[:consumer_key]
  @consumer_secret = options[:consumer_secret]
  @use_body_hash   = options[:use_body_hash]
end

Instance Attribute Details

#consumer_keyObject

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_secretObject

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_secretObject

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_tokenObject

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

Parameters:

  • value

    the value to set the attribute use_body_hash to.



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

Returns:

  • (Boolean)


26
27
28
# File 'lib/gdata/auth/oauth.rb', line 26

def use_body_hash?
  !!@use_body_hash
end