Class: Ticketbai::Api::Request
- Inherits:
-
Object
- Object
- Ticketbai::Api::Request
- Defined in:
- lib/ticketbai/api/request.rb
Constant Summary collapse
- TEST_PRESENTATION_ENDPOINT =
'https://pruesarrerak.bizkaia.eus/N3B4000M/aurkezpena'.freeze
- LIVE_PRESENTATION_ENDPOINT =
'https://sarrerak.bizkaia.eus/N3B4000M/aurkezpena'.freeze
- TEST_QUERY_ENDPOINT =
'https://pruesarrerak.bizkaia.eus/N3B4001M/kontsulta'.freeze
- SUPPORTED_OPERATIONS =
OPERATIONS issuance_unsigned: (invoices issued without guarantor software): When a TicketBai file has been rejected due to a poorly generated XML result,
taking into account that the TicketBAI file cannot be generated again and that its information must be sent, it must be done by indicating the subchapter Invoices issued no guarantor softwareissuance: New invoices issued that we want to register using the guarantor software annulment: Cancel invoices that we have previously registered using the guarantor software
[ Ticketbai::Operations::Issuance::OPERATION_NAME, Ticketbai::Operations::Annulment::OPERATION_NAME, Ticketbai::Operations::IssuanceUnsigned::OPERATION_NAME ].freeze
- OPERATION_MAPPING =
{ issuance: 'A00', annulment: 'AN0', modify: 'M00', query: 'C00', issuance_unsigned: 'A00' }.freeze
- LROE_MODEL =
'240'.freeze
- LROE_CHAPTER =
'1'.freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(issued_invoices:, nif:, company_name:, year:, certificate_name:, operation:) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(issued_invoices:, nif:, company_name:, year:, certificate_name:, operation:) ⇒ Request
Returns a new instance of Request.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ticketbai/api/request.rb', line 42 def initialize(issued_invoices:, nif:, company_name:, year:, certificate_name:, operation:) raise ArgumentError, "Unsupported operation: #{operation}" unless SUPPORTED_OPERATIONS.include? operation.downcase.to_sym @issued_invoices = Array(issued_invoices) @nif = nif @company_name = company_name @year = year @company_cert = Ticketbai.config.certificates[certificate_name.to_sym] @operation = operation.downcase.to_sym end |
Instance Method Details
#execute ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ticketbai/api/request.rb', line 53 def execute client = Client.new( url: presentation_endpoint, headers: headers, body: gzip_body, company_cert: @company_cert ) client.execute end |