lib/authlogic_connect/oauth/tokens/oauth_token.rb in authlogic-connect-0.0.5.1 vs lib/authlogic_connect/oauth/tokens/oauth_token.rb in authlogic-connect-0.0.6
- old
+ new
@@ -18,18 +18,30 @@
def oauth_version
self.class.oauth_version
end
- def get(path, options = {})
- client.get(path, options)
+ def get(path, headers = {})
+ client.get(path, headers)
end
-
+
def post(path, body = "", headers = {})
client.post(path, body, headers)
end
-
+
+ def head(path, headers = {})
+ client.head(path, headers)
+ end
+
+ def put(path, body = "", headers = {})
+ client.put(path, body, headers)
+ end
+
+ def delete(path, headers = {})
+ client.delete(path, headers)
+ end
+
class << self
# oauth version, 1.0 or 2.0
def version(value)
@oauth_version = value
@@ -53,14 +65,18 @@
def oauth_key
@oauth_key
end
+ def config
+ super.merge(credentials[:options] || {})
+ end
+
def consumer
if oauth_version == 1.0
- OAuth::Consumer.new(credentials[:key], credentials[:secret], config.merge(credentials[:options] || {}))
+ OAuth::Consumer.new(credentials[:key], credentials[:secret], config)
else
- OAuth2::Client.new(credentials[:key], credentials[:secret], config.merge(credentials[:options] || {}))
+ OAuth2::Client.new(credentials[:key], credentials[:secret], config)
end
end
# if we're lucky we can find it by the token.
def find_by_key_or_token(key, token, options = {})