Class: DdrAux::Client::Connection
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- DdrAux::Client::Connection
- Defined in:
- lib/ddr_aux/client/connection.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_response(relative_path) ⇒ Object
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
12 13 14 15 16 17 18 19 |
# File 'lib/ddr_aux/client/connection.rb', line 12 def initialize conn = Net::HTTP.new(uri.host, uri.port) if uri.scheme == "https" conn.use_ssl = true conn.verify_mode = OpenSSL::SSL::VERIFY_NONE end super conn end |
Class Method Details
.call(*args) ⇒ Object
8 9 10 |
# File 'lib/ddr_aux/client/connection.rb', line 8 def self.call(*args) new.get_response(*args) end |
Instance Method Details
#get_response(relative_path) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/ddr_aux/client/connection.rb', line 21 def get_response(relative_path) path = uri.path + relative_path res = get(path, request_headers) res.value # raises exception if not 2XX response code JSON.parse(res.body) end |