loginprompt 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. data/lib/loginprompt.rb +14 -11
  2. 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
- uri = URI(api_url)
78
- http = Net::HTTP.new(uri.host, uri.port)
77
+ begin
78
+ uri = URI(api_url)
79
+ http = Net::HTTP.new(uri.host, uri.port)
79
80
 
80
- if uri.scheme =='https'
81
- http.use_ssl = true
82
- end
81
+ if uri.scheme =='https'
82
+ http.use_ssl = true
83
+ end
83
84
 
84
- http.start do
85
- request = Net::HTTP::Get.new(uri.request_uri)
86
- answer = http.request(request)
85
+ http.start do
86
+ request = Net::HTTP::Get.new(uri.request_uri)
87
+ answer = http.request(request)
87
88
 
88
- if (answer.is_a? Net::HTTPOK)
89
- response = JSON.parse(answer.body)
90
- result = response if response['success'] == true
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loginprompt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: