Module: Eet

Defined in:
lib/eet.rb,
lib/eet/utils.rb,
lib/eet/client.rb,
lib/eet/sender.rb,
lib/eet/message.rb,
lib/eet/version.rb

Defined Under Namespace

Modules: Utils Classes: Client, Message, Sender, UnknownEnvironmentError

Constant Summary collapse

VERSION =
'0.3.1'

Class Method Summary collapse

Class Method Details

.playground_certificateObject



28
29
30
31
# File 'lib/eet.rb', line 28

def self.playground_certificate
  cert = File.join(File.dirname(__dir__), 'spec', 'fixtures', 'EET_CA1_Playground-CZ00000019.p12')
  OpenSSL::PKCS12.new(File.open(cert), 'eet')
end

.test_playgroundObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eet.rb', line 10

def self.test_playground
  data = { celk_trzba: '0.00',
           dic_popl: 'CZ00000019',
           id_pokl: 'p1',
           id_provoz: '11',
           porad_cis: '1' }

  message = Message.new(data)

  message.pkp = Utils.create_pkp(message, playground_certificate)
  message.bkp = Utils.create_bkp(message.pkp)

  signed_message = Utils.sign(message.to_xml, playground_certificate)

  sender = Sender.new
  response = sender.send_to_playground(signed_message)
end