loginprompt 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/loginprompt.rb +14 -11
- metadata +1 -1
data/lib/loginprompt.rb
CHANGED
@@ -74,21 +74,24 @@ module LoginPrompt
|
|
74
74
|
def self.call(api_url)
|
75
75
|
result = nil
|
76
76
|
|
77
|
-
|
78
|
-
|
77
|
+
begin
|
78
|
+
uri = URI(api_url)
|
79
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
if uri.scheme =='https'
|
82
|
+
http.use_ssl = true
|
83
|
+
end
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
http.start do
|
86
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
87
|
+
answer = http.request(request)
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
|
89
|
+
if (answer.is_a? Net::HTTPOK)
|
90
|
+
response = JSON.parse(answer.body)
|
91
|
+
result = response if response['success'] == true
|
92
|
+
end
|
91
93
|
end
|
94
|
+
rescue
|
92
95
|
end
|
93
96
|
|
94
97
|
result
|