Skip to content
Browse files

fixing authsub request

  • Loading branch information...
1 parent a74f63e commit d1e483bc94748e71cef5cd2fe1d06556ffc8f59a @chebyte chebyte committed
Showing with 22 additions and 14 deletions.
  1. +1 −0 .gitignore
  2. +20 −13 lib/youtube_it/client.rb
  3. +1 −1 lib/youtube_it/version.rb
View
1 .gitignore
@@ -1,5 +1,6 @@
.DS_Store
.idea
*.tmproj
+*.pkg
pkg/
Gemfile.lock
View
33 lib/youtube_it/client.rb
@@ -310,9 +310,11 @@ def create_session_token
response = nil
session_token_url = "/accounts/AuthSubSessionToken"
- http_connection do |session|
- response = session.get2('https://%s' % session_token_url,session_token_header).body
- end
+ response = http_connection.get do |req|
+ req.url session_token_url
+ req.headers = session_token_header
+ end.body
+
@authsub_token = response.sub('Token=','')
end
@@ -320,9 +322,11 @@ def revoke_session_token
response = nil
session_token_url = "/accounts/AuthSubRevokeToken"
- http_connection do |session|
- response = session.get2('https://%s' % session_token_url,session_token_header).code
- end
+ response = http_connection.get do |req|
+ req.url session_token_url
+ req.headers = session_token_header
+ end.status
+
response.to_s == '200' ? true : false
end
@@ -330,10 +334,12 @@ def session_token_info
response = nil
session_token_url = "/accounts/AuthSubTokenInfo"
- http_connection do |session|
- response = session.get2('https://%s' % session_token_url,session_token_header)
+ response = http_connection.get do |req|
+ req.url session_token_url
+ req.headers = session_token_header
end
- {:code => response.code, :body => response.body }
+
+ {:code => response.status, :body => response.body }
end
private
@@ -349,12 +355,13 @@ def session_token_header
end
def http_connection
- http = Net::HTTP.new("www.google.com")
- http.set_debug_output(logger) if @http_debugging
- http.start do |session|
- yield(session)
+ Faraday.new(:url => 'https://www.google.com', :ssl => {:verify => false}) do |builder|
+ builder.request :url_encoded
+ builder.response :logger if @legacy_debug_flag
+ builder.adapter Faraday.default_adapter
end
end
+
end
class OAuthClient < Client
View
2 lib/youtube_it/version.rb
@@ -1,4 +1,4 @@
class YouTubeIt
- VERSION = '2.1.5'
+ VERSION = '2.1.6'
end

0 comments on commit d1e483b

Please sign in to comment.
Something went wrong with that request. Please try again.