Class: Ticketbai::Api::Client

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

Constant Summary collapse

KO_RESPONSE =
:incorrecto
OK_RESPONSE =
:correcto
PARTIALLY_OK_RESPONSE =
:parcialmentecorrecto

Instance Method Summary collapse

Constructor Details

#initialize(url:, headers:, body:, company_cert:) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
# File 'lib/ticketbai/api/client.rb', line 8

def initialize(url:, headers:, body:, company_cert:)
  @url = url
  @headers = headers
  @body = body
  @company_cert = company_cert
end

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
# File 'lib/ticketbai/api/client.rb', line 15

def execute
  response = connection.post do |req|
    req.url(@url)
    req.headers = @headers
    req.body = @body
  end

  ResponseParser.new(response).to_h
end