Module: Ticketbai

Defined in:
lib/ticketbai.rb,
lib/ticketbai/errors.rb,
lib/ticketbai/signer.rb,
lib/ticketbai/tbai_qr.rb,
lib/ticketbai/version.rb,
lib/ticketbai/document.rb,
lib/ticketbai/operation.rb,
lib/ticketbai/api/client.rb,
lib/ticketbai/api/request.rb,
lib/ticketbai/api/registry.rb,
lib/ticketbai/nodes/issuer.rb,
lib/ticketbai/nodes/receiver.rb,
lib/ticketbai/nodes/software.rb,
lib/ticketbai/tbai_identifier.rb,
lib/ticketbai/nodes/lroe_header.rb,
lib/ticketbai/document_validator.rb,
lib/ticketbai/documents/issuance.rb,
lib/ticketbai/nodes/invoice_data.rb,
lib/ticketbai/api/response_parser.rb,
lib/ticketbai/checksum_calculator.rb,
lib/ticketbai/documents/annulment.rb,
lib/ticketbai/operations/issuance.rb,
lib/ticketbai/nodes/breakdown_type.rb,
lib/ticketbai/nodes/invoice_header.rb,
lib/ticketbai/operations/annulment.rb,
lib/ticketbai/documents/api_payload.rb,
lib/ticketbai/nodes/invoice_chaining.rb,
lib/ticketbai/nodes/lroe_issued_invoices.rb,
lib/ticketbai/documents/issuance_unsigned.rb,
lib/ticketbai/operations/issuance_unsigned.rb

Defined Under Namespace

Modules: Api, Documents, Nodes, Operations Classes: APIError, ChecksumCalculator, ClientError, Config, Document, DocumentValidator, Error, Operation, Signer, TBAIFileError, TbaiIdentifier, TbaiQr

Constant Summary collapse

VERSION =
'0.1.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



48
49
50
# File 'lib/ticketbai.rb', line 48

def config
  @config
end

Class Method Details

.configure {|@config| ... } ⇒ Object

Module configuration.

Yields:



43
44
45
46
# File 'lib/ticketbai.rb', line 43

def configure
  @config ||= Config.new
  yield(@config)
end

.debugObject



81
82
83
# File 'lib/ticketbai.rb', line 81

def debug
  instance_variable_get(:@debug) == true
end

.debug=(debug) ⇒ Object



85
86
87
# File 'lib/ticketbai.rb', line 85

def debug=(debug)
  instance_variable_set :@debug, debug
end

.live?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/ticketbai.rb', line 69

def live?
  mode == :live
end

.loggerObject



73
74
75
# File 'lib/ticketbai.rb', line 73

def logger
  instance_variable_get :@logger
end

.logger=(logger) ⇒ Object



77
78
79
# File 'lib/ticketbai.rb', line 77

def logger=(logger)
  instance_variable_set :@logger, logger
end

.modeObject



50
51
52
53
54
55
56
# File 'lib/ticketbai.rb', line 50

def mode
  if instance_variable_defined? :@mode
    instance_variable_get :@mode
  else
    :test
  end
end

.mode=(mode) ⇒ Object



58
59
60
61
62
63
# File 'lib/ticketbai.rb', line 58

def mode=(mode)
  mode = mode&.to_sym
  raise "Invalid mode #{mode}" unless %i[live test].include?(mode)

  instance_variable_set :@mode, mode
end

.test?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/ticketbai.rb', line 65

def test?
  mode == :test
end