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'

Instance Method Summary collapse

Instance Method Details

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



15
16
17
18
19
20
# File 'lib/redox/connection.rb', line 15

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