Module: TyphoeusOAuth::OAuthExtension::InstanceMethods

Includes:
OAuth::Helper
Defined in:
lib/typhoeus_oauth/oauth_extension.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#oauth_helperObject (readonly)

Returns the value of attribute oauth_helper.



18
19
20
# File 'lib/typhoeus_oauth/oauth_extension.rb', line 18

def oauth_helper
  @oauth_helper
end

Instance Method Details

#oauth!(consumer, token, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/typhoeus_oauth/oauth_extension.rb', line 20

def oauth!(consumer, token, options = {})
  options = { :request_uri      => oauth_full_request_uri,
              :consumer         => consumer,
              :token            => token,
              :scheme           => 'header',
              :signature_method => nil,
              :nonce            => nil,
              :timestamp        => nil }.merge(options)
              
  @oauth_helper = OAuth::Client::Helper.new(self, options)
  @oauth_helper.amend_user_agent_header(@headers)
  self.send("set_oauth_#{options[:scheme]}")
end

#paramsObject



46
47
48
49
50
51
52
53
# File 'lib/typhoeus_oauth/oauth_extension.rb', line 46

def params
  query = if [:post, :put].include? method
    self.post_data
  else
    URI.parse(self.url).query
  end
  CGI::parse(query)
end

#post_dataObject



55
56
57
# File 'lib/typhoeus_oauth/oauth_extension.rb', line 55

def post_data
  @post_data ||= nil
end

#signature_base_string(consumer = nil, token = nil, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/typhoeus_oauth/oauth_extension.rb', line 34

def signature_base_string(consumer = nil, token = nil, options = {})
  options = { :request_uri      => oauth_full_request_uri,
              :consumer         => consumer,
              :token            => token,
              :scheme           => 'header',
              :signature_method => nil,
              :nonce            => nil,
              :timestamp        => nil }.merge(options)

  OAuth::Client::Helper.new(self, options).signature_base_string
end