Class: AssUpdater::HTTP
- Inherits:
-
Object
- Object
- AssUpdater::HTTP
- Defined in:
- lib/ass_updater/http.rb
Overview
Note:
1C servise often unavaileble and #get fail on timeout
HTTP access to 1C services.
Constant Summary collapse
- USER_AGENT_DEFAULT =
Value of useragent controled 1C web server and server may return 403 error
'1C+Enterprise/8.2'
Instance Attribute Summary collapse
-
#open_timeout ⇒ Object
see Net::HTTP#open_timeout.
-
#proxy_options ⇒ Hash
see #initialize param.
-
#read_timeout ⇒ Object
see Net::HTTP#read_timeout.
-
#user_agent ⇒ String
Value of useragent controled 1C web server and server may return 403 error.
Instance Method Summary collapse
- #get(uri_str, user_name = nil, password = nil) ⇒ Object
-
#initialize(proxy_options = {}) ⇒ HTTP
constructor
A new instance of HTTP.
Constructor Details
#initialize(proxy_options = {}) ⇒ HTTP
Returns a new instance of HTTP.
23 24 25 26 27 28 29 30 31 |
# File 'lib/ass_updater/http.rb', line 23 def initialize( = {}) self.open_timeout = 30 # fucking 1C self.user_agent = USER_AGENT_DEFAULT self. = { addr: nil, port: nil, user: nil, pass: nil }.merge() yeld self if block_given? end |
Instance Attribute Details
#open_timeout ⇒ Object
Note:
1C servise often unavaileble and #get fail on timeout
see Net::HTTP#open_timeout
17 18 19 |
# File 'lib/ass_updater/http.rb', line 17 def open_timeout @open_timeout end |
#proxy_options ⇒ Hash
see #initialize param
14 15 16 |
# File 'lib/ass_updater/http.rb', line 14 def end |
#read_timeout ⇒ Object
Note:
1C servise often unavaileble and #get fail on timeout
see Net::HTTP#read_timeout
20 21 22 |
# File 'lib/ass_updater/http.rb', line 20 def read_timeout @read_timeout end |
#user_agent ⇒ String
Value of useragent controled 1C web server and server may return 403 error
11 12 13 |
# File 'lib/ass_updater/http.rb', line 11 def user_agent @user_agent end |
Instance Method Details
#get(uri_str, user_name = nil, password = nil) ⇒ Object
Note:
1C servise often unavaileble and #get fail on timeout
37 38 39 40 41 42 43 44 |
# File 'lib/ass_updater/http.rb', line 37 def get(uri_str, user_name = nil, password = nil) response = _http(URI(uri_str)).request(_get(user_name, password, URI(uri_str) ) ) _body(response, uri_str) end |