Class: Nicos::Connector::Xml
- Defined in:
- lib/classes/connector.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Connector
Instance Method Summary collapse
Methods inherited from Connector
Methods included from SetWait
Methods inherited from Config
Constructor Details
This class inherits a constructor from Nicos::Connector::Connector
Instance Method Details
#get(host, entity, param) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/classes/connector.rb', line 164 def get (host, entity, param) response = nil @retryCount = 0 res = {} begin @nowAccess = host + entity + param puts "Request to " + @nowAccess Net::HTTP.start(host, 80) { |http| response = http.get(entity + param, HEADER) } @retryCount += 1 rescue => e puts e rescue Timeout::Error => e timedOut res[:order] = :retry else res = case response when Net::HTTPSuccess then reviewRes( response.body.force_encoding("UTF-8") ) # when Net::HTTPRedirection # fetch(response['location'], limit - 1) when Net::HTTPForbidden then forbidden when Net::HTTPNotFound then notFound when Net::HTTPServiceUnavailable then serviceUnavailable else unknownError end end until res[:order] != :retry res end |