@@ -26,8 +26,11 @@ class Hoptoad < Base
26
26
INPUT_FORMAT = /^([^:]+):(\d +)(?::in `([^']+)')?$/
27
27
28
28
class << self
29
- attr_accessor :secure , :api_key , :proxy_host , :proxy_port
29
+ attr_accessor :secure , :api_key
30
+ attr_accessor :proxy_host , :proxy_port , :proxy_user , :proxy_pass
30
31
attr_accessor :server_environment
32
+ attr_accessor :host , :port
33
+ attr_accessor :http_read_timeout , :http_open_timeout
31
34
end
32
35
33
36
def self . count
@@ -43,17 +46,20 @@ def self.configure
43
46
44
47
def save
45
48
http = use_ssl? ? :https : :http
46
- url = URI . parse ( "#{ http } ://hoptoadapp.com/notifier_api/v2/notices" )
49
+ host = self . class . host || 'hoptoadapp.com'
50
+ port = self . class . port
51
+ url = URI . parse ( "#{ http } ://#{ host } :#{ port } /notifier_api/v2/notices/" )
47
52
48
- request = Net ::HTTP ::Proxy ( self . class . proxy_host , self . class . proxy_port )
53
+ request = Net ::HTTP ::Proxy self . class . proxy_host , self . class . proxy_port ,
54
+ self . class . proxy_user , self . class . proxy_pass
49
55
http = request . new ( url . host , url . port )
50
56
headers = {
51
57
'Content-type' => 'text/xml' ,
52
58
'Accept' => 'text/xml, application/xml'
53
59
}
54
60
55
- http . read_timeout = 5 # seconds
56
- http . open_timeout = 2 # seconds
61
+ http . read_timeout = self . class . http_read_timeout || 5 # seconds
62
+ http . open_timeout = self . class . http_open_timeout || 2 # seconds
57
63
58
64
http . use_ssl = use_ssl?
59
65
0 commit comments