Class: ABBYY::Cloud::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/abbyy/cloud/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



14
15
16
# File 'lib/abbyy/cloud/connection.rb', line 14

def root
  @root
end

Instance Method Details

#call(http_method, path, body: nil, **options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/abbyy/cloud/connection.rb', line 16

def call(http_method, path, body: nil, **options)
  uri = prepare_uri(path, options)
  req = Net::HTTP.const_get(http_method.capitalize).new(uri)
  req.body = body
  setup_headers(req, options)

  res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(req)
  end
  handle_response(res)
end