Class: Cryptomus::Connection

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

Constant Summary collapse

MIME_TYPE =
'application/json'

Instance Method Summary collapse

Instance Method Details

#post(path, body: nil, query: nil) ⇒ Object

Parameters:

  • path (String)
  • body (Hash, nil) (defaults to: nil)

Raises:



12
13
14
15
16
17
18
19
20
21
# File 'lib/cryptomus/connection.rb', line 12

def post(path, body: nil, query: nil)
  response = connection.post do |req|
    req.url(path, query)
    raw_body = body&.to_json
    req.body = raw_body
    req[:sign] = Signature.generate(raw_body)
  end
  handle_response(response)
  response.body
end