Class: SIBAApi::Client

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

Overview

Main client class that implements communication with the API global_params:

  • include_related_objects: int 0-1 0

  • page: int positive 1

  • per_page: int positive 20

Constant Summary

Constants inherited from API

API::HTTP_STATUS_MAPPING

Constants included from HttpStatusCodes

HttpStatusCodes::HTTP_BAD_REQUEST_CODE, HttpStatusCodes::HTTP_FORBIDDEN_CODE, HttpStatusCodes::HTTP_NOT_FOUND_CODE, HttpStatusCodes::HTTP_OK_CODE, HttpStatusCodes::HTTP_UNAUTHORIZED_CODE, HttpStatusCodes::HTTP_UNPROCESSABLE_ENTITY_CODE

Constants included from Constants

SIBAApi::Constants::ACCEPT, SIBAApi::Constants::ACCEPTED_OAUTH_SCOPES, SIBAApi::Constants::ACCEPT_CHARSET, SIBAApi::Constants::API_ACCESS_KEY, SIBAApi::Constants::API_ESTABLISHMENT, SIBAApi::Constants::API_HOTEL_UNIT, SIBAApi::Constants::API_HOTEL_UNIT_INFO, SIBAApi::Constants::API_WSDL, SIBAApi::Constants::CACHE_CONTROL, SIBAApi::Constants::CONTENT_LENGTH, SIBAApi::Constants::CONTENT_TYPE, SIBAApi::Constants::DATE, SIBAApi::Constants::ETAG, SIBAApi::Constants::HEADER_LAST, SIBAApi::Constants::HEADER_LINK, SIBAApi::Constants::HEADER_NEXT, SIBAApi::Constants::LOCATION, SIBAApi::Constants::META_FIRST, SIBAApi::Constants::META_LAST, SIBAApi::Constants::META_NEXT, SIBAApi::Constants::META_PREV, SIBAApi::Constants::META_REL, SIBAApi::Constants::OAUTH_SCOPES, SIBAApi::Constants::PARAM_INCLUDE_RELATED, SIBAApi::Constants::PARAM_PAGE, SIBAApi::Constants::PARAM_PER_PAGE, SIBAApi::Constants::PARAM_START_PAGE, SIBAApi::Constants::RATELIMIT_LIMIT, SIBAApi::Constants::RATELIMIT_REMAINING, SIBAApi::Constants::RATELIMIT_RESET, SIBAApi::Constants::SERVER, SIBAApi::Constants::USER_AGENT

Constants included from ApiExceptions

ApiExceptions::APIExceptionError, ApiExceptions::ApiError, ApiExceptions::ApiRequestsQuotaReachedError, ApiExceptions::BadRequestError, ApiExceptions::ForbiddenError, ApiExceptions::NotFoundError, ApiExceptions::UnauthorizedError, ApiExceptions::UnprocessableEntityError

Instance Attribute Summary

Attributes inherited from API

#last_response

Instance Method Summary collapse

Methods inherited from API

#initialize, #yield_or_eval

Constructor Details

This class inherits a constructor from SIBAApi::API

Instance Method Details

#deliver_bulletins(file_number, bulletins = [], _global_params = {}) ⇒ Object

SIBAApi::Client.new.calendar(38859, ‘2022-01-01’, ‘2022-07-31’)

<sef:UnidadeHoteleira>?</sef:UnidadeHoteleira>
<sef:Estabelecimento>?</sef:Estabelecimento>
<!--Optional:-->
<sef:ChaveAcesso>?</sef:ChaveAcesso>
<!--Optional:-->
<sef:Boletins>?</sef:Boletins>

Boletins: <sef:Apelido>Apelido</sef:Apelido> <sef:Nome>Teste</sef:Nome> <sef:Nacionalidade>DZA</sef:Nacionalidade> <sef:Data_Nascimento>2000-01-01</sef:Data_Nascimento> <sef:Local_Nascimento></sef:Local_Nascimento> <sef:Documento_Identificacao></sef:Documento_Identificacao> <sef:Pais_Emissor_Documento></sef:Pais_Emissor_Documento> <sef:Tipo_Documento></sef:Tipo_Documento> <sef:Pais_Residencia_Origem></sef:Pais_Residencia_Origem> <sef:Data_Entrada></sef:Data_Entrada> <sef:Data_Saida></sef:Data_Saida> <sef:Local_Residencia_Origem></sef:Local_Residencia_Origem>

'Apelido' => 'Surname',
'Nome' => 'Name',
'Nacionalidade' => 'VEN',
'Data_Nascimento' => '19990101',
'Local_Nascimento' => 'Place of Birth',
'Documento_Identificacao' => '123456789',
'Pais_Emissor_Documento' => 'YEM',
'Tipo_Documento' => 'P',
'Pais_Residencia_Origem' => 'ZMB',
'Data_Entrada' => '20220801',
'Data_Saida' => '20220831',
'Local_Residencia_Origem' => 'Place of Residence',


48
49
50
51
52
53
54
55
56
57
# File 'lib/siba_api/client.rb', line 48

def deliver_bulletins(file_number, bulletins = [], _global_params = {})
  bulletins_encoded = build_encoded_bulletins_xml(file_number, bulletins)
  response = request(
    operation: :entrega_boletins_alojamento,
    params: {
      Boletins: bulletins_encoded
    }
  )
  process_response(response)
end