Class: RestfullOauth::Connection
- Inherits:
-
Object
- Object
- RestfullOauth::Connection
- Defined in:
- lib/restfull_oauth.rb
Overview
>> puts JSON.parse(response.body).to_yaml
Instance Method Summary collapse
- #connect(method, uri, post_data = nil) ⇒ Object
-
#initialize(config = {}) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(config = {}) ⇒ Connection
Returns a new instance of Connection.
29 30 31 32 |
# File 'lib/restfull_oauth.rb', line 29 def initialize(config = {}) @config = config self end |
Instance Method Details
#connect(method, uri, post_data = nil) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/restfull_oauth.rb', line 34 def connect(method, uri, post_data=nil) params = params(@config['consumer_key'], @config['token'] ) signature_base_string = signature_base_string(method, uri.to_s, params) signing_key = @config['consumer_secret'] + '&' + @config['token_secret'] params['oauth_signature'] = url_encode(sign(signing_key, signature_base_string)) header_string = create_header(params) json_response = request_data(header_string, uri, method, post_data) end |