hayesdavis-grackle 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/grackle.gemspec +1 -1
- data/lib/grackle/client.rb +0 -1
- data/lib/grackle/transport.rb +13 -2
- data/lib/grackle.rb +1 -1
- metadata +1 -1
data/grackle.gemspec
CHANGED
data/lib/grackle/client.rb
CHANGED
@@ -83,7 +83,6 @@ module Grackle
|
|
83
83
|
|
84
84
|
#Basic OAuth information needed to communicate with Twitter
|
85
85
|
TWITTER_OAUTH_SPEC = {
|
86
|
-
:site=>'http://twitter.com',
|
87
86
|
:request_token_path=>'/oauth/request_token',
|
88
87
|
:access_token_path=>'/oauth/access_token',
|
89
88
|
:authorize_path=>'/oauth/authorize'
|
data/lib/grackle/transport.rb
CHANGED
@@ -59,7 +59,7 @@ module Grackle
|
|
59
59
|
if options[:auth][:type] == :basic
|
60
60
|
add_basic_auth(req,options[:auth])
|
61
61
|
elsif options[:auth][:type] == :oauth
|
62
|
-
add_oauth(req,options[:auth])
|
62
|
+
add_oauth(http,req,options[:auth])
|
63
63
|
end
|
64
64
|
end
|
65
65
|
dump_request(req) if debug
|
@@ -151,16 +151,27 @@ module Grackle
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
-
def add_oauth(req,auth)
|
154
|
+
def add_oauth(conn,req,auth)
|
155
155
|
options = auth.reject do |key,value|
|
156
156
|
[:type,:consumer_key,:consumer_secret,:token,:token_secret].include?(key)
|
157
157
|
end
|
158
|
+
unless options.has_key?(:site)
|
159
|
+
options[:site] = oauth_site(conn,req)
|
160
|
+
end
|
158
161
|
consumer = OAuth::Consumer.new(auth[:consumer_key],auth[:consumer_secret],options)
|
159
162
|
access_token = OAuth::AccessToken.new(consumer,auth[:token],auth[:token_secret])
|
160
163
|
consumer.sign!(req,access_token)
|
161
164
|
end
|
162
165
|
|
163
166
|
private
|
167
|
+
def oauth_site(conn,req)
|
168
|
+
site = "#{(conn.use_ssl? ? "https" : "http")}://#{conn.address}"
|
169
|
+
if (conn.use_ssl? && conn.port != 443) || (!conn.use_ssl? && conn.port != 80)
|
170
|
+
site << ":#{conn.port}"
|
171
|
+
end
|
172
|
+
site
|
173
|
+
end
|
174
|
+
|
164
175
|
def dump_request(req)
|
165
176
|
puts "Sending Request"
|
166
177
|
puts"#{req.method} #{req.path}"
|
data/lib/grackle.rb
CHANGED