Class: Updox::Connection

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

Constant Summary collapse

TEST_HOST =
'updoxqa.com'
PROD_HOST =
'xxxxxxx.com'

Instance Method Summary collapse

Instance Method Details

#request(endpoint: Updox::Models::Auth::PING_ENDPOINT, body: {}, headers: {}, auth: Updox::Models::Auth.new, required_auths: [], account_id: nil, user_id: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/updox/connection.rb', line 14

def request(endpoint: Updox::Models::Auth::PING_ENDPOINT, body: {}, headers: {}, auth: Updox::Models::Auth.new, required_auths: [], account_id: nil, user_id: nil)
  if body.is_a?(Hash)
    auth[:accountId] =  unless .nil?
    auth[:userId]    = user_id unless user_id.nil?

    body = auth_data(auth, required_auths).merge(body)
    body = body.to_json
  end

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