Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update - using faraday to make web calls

  • Loading branch information...
commit bfaad549483594429fe7147e2c101e5c704a6c4f 1 parent bff17c0
CodePorting authored

Showing 1 changed file with 8 additions and 16 deletions. Show diff stats Hide diff stats

  1. +8 16 services/CodePorting-C#2Java.rb
24 services/CodePorting-C#2Java.rb
@@ -30,16 +30,13 @@ def receive_push
30 30 end
31 31
32 32 def perform_login
33   - uri = URI.parse("https://apps.codeporting.com")
34   - http = Net::HTTP.new(uri.host, uri.port)
35   - http.use_ssl = true
36   - http.verify_mode = OpenSSL::SSL::VERIFY_NONE
37   - path = '/csharp2java/v0/UserSignin'
38   - data = "LoginName=#{username}&Password=#{password}"
  33 + http.ssl[:verify] = false
  34 + data = "LoginName=#{username}&Password=#{password}"
39 35 headers = {
40 36 'Content-Type' => 'application/x-www-form-urlencoded'
41 37 }
42   - resp, data = http.post(path, data, headers)
  38 + resp, data = http_post "https://apps.codeporting.com/csharp2java/v0/UserSignin", data, headers
  39 +
43 40 doc = REXML::Document.new(data)
44 41 retValue = ""
45 42 doc.each_element('//return') { |item|
@@ -56,17 +53,12 @@ def perform_login
56 53 end
57 54
58 55 def process_on_codeporting
59   - uri = URI.parse("https://apps.codeporting.com")
60   - http_porting = Net::HTTP.new(uri.host, uri.port)
61   - http_porting.use_ssl = true
62   - http_porting.verify_mode = OpenSSL::SSL::VERIFY_NONE
63   - path_porting = '/csharp2java/v0/githubpluginsupport'
64   - data_porting = "token=#{token}&ProjectName=#{project_name}&RepoKey=#{repo_key}&TarRepoKey=#{target_repo_key}&Username=#{username}&Password=#{password}&GithubUserId=#{userid}"
65   -
66   - headers_porting = {
  56 + http.ssl[:verify] = false
  57 + data = "token=#{token}&ProjectName=#{project_name}&RepoKey=#{repo_key}&TarRepoKey=#{target_repo_key}&Username=#{username}&Password=#{password}&GithubUserId=#{userid}"
  58 + headers = {
67 59 'Content-Type' => 'application/x-www-form-urlencoded'
68 60 }
69   - resp, data = http_porting.post(path_porting, data_porting, headers_porting)
  61 + resp, data = http_post "https://apps.codeporting.com/csharp2java/v0/githubpluginsupport", data, headers
70 62
71 63 doc = REXML::Document.new(data)
72 64 retValue = ""

0 comments on commit bfaad54

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