Method: ApiClient#request_params

Defined in:
motion-prime/api_client.rb

#request_params(data) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'motion-prime/api_client.rb', line 12

def request_params(data)
  params = data.clone

  if config.http_auth?
    params.merge!(credentials: config.http_auth.to_hash)
  end
  if config.sign_request?
    params.delete(:sign)
    signature = RmDigest::MD5.hexdigest(
      config.signature_secret + params.keys.map(&:to_s).sort.join
    )
    params.merge!(sign: signature)
  end
  params
end