Class: Redox::Connection

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/redox/connection.rb

Direct Known Subclasses

Authentication

Constant Summary collapse

DEFAULT_ENDPOINT =
'/endpoint'.freeze

Instance Method Summary collapse

Instance Method Details

#request(endpoint: DEFAULT_ENDPOINT, body: nil, headers: {}, auth: true) ⇒ Object



13
14
15
16
17
18
# File 'lib/redox/connection.rb', line 13

def request(endpoint: DEFAULT_ENDPOINT, body: nil, headers: {}, auth: true)
  body    = body.to_json if body.is_a?(Hash)
  headers = auth_header.merge(headers) if auth

  self.class.post(endpoint, body: body, headers: headers)
end