Class: Culqi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/culqi/client.rb

Constant Summary collapse

ERROR_MESSAGES =
{
  failed_request: 'Error al crear venta, HTTP code:'
}

Instance Method Summary collapse

Constructor Details

#initialize(key, endpoint, code) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
# File 'lib/culqi/client.rb', line 10

def initialize(key, endpoint, code)
  @key  = key
  @url  = URI(endpoint + '/api/v1/web/crear')
  @code = code
end

Instance Method Details

#crear_venta(attrs) ⇒ Object



16
17
18
19
20
21
# File 'lib/culqi/client.rb', line 16

def crear_venta(attrs)
  sale    = Culqi::Sale.new(attrs)
  request = http_request(sale.payload)

  http_response(request)
end