Class: PagoPA::SOAP::Message::Rpt

Inherits:
Object
  • Object
show all
Defined in:
lib/pago_pa/soap/message/rpt.rb

Constant Summary collapse

REQUIRED_ATTRIBUTES =
%i[
  versione_oggetto dominio identificativo_messaggio_richiesta
  data_ora_messaggio_richiesta autenticazione_soggetto
  soggetto_pagatore ente_beneficiario dati_versamento
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(decode = false, **args) ⇒ Rpt

Returns a new instance of Rpt.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/pago_pa/soap/message/rpt.rb', line 38

def initialize(decode = false, **args)
  if decode && args.key?(:base_64)
    args = self.decode(args[:base_64] || "")
  end

  @attributes = args
  @version = attributes.delete(:versione_oggetto)
  @request_id = attributes.delete(:identificativo_messaggio_richiesta)
  @date_request = attributes.delete(:data_ora_messaggio_richiesta)
  @auth = attributes.delete(:autenticazione_soggetto)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



31
32
33
# File 'lib/pago_pa/soap/message/rpt.rb', line 31

def attributes
  @attributes
end

#authObject (readonly)

Returns the value of attribute auth.



35
36
37
# File 'lib/pago_pa/soap/message/rpt.rb', line 35

def auth
  @auth
end

#base_64Object (readonly)

Returns the value of attribute base_64.



36
37
38
# File 'lib/pago_pa/soap/message/rpt.rb', line 36

def base_64
  @base_64
end

#date_requestObject (readonly)

Returns the value of attribute date_request.



34
35
36
# File 'lib/pago_pa/soap/message/rpt.rb', line 34

def date_request
  @date_request
end

#request_idObject (readonly)

Returns the value of attribute request_id.



33
34
35
# File 'lib/pago_pa/soap/message/rpt.rb', line 33

def request_id
  @request_id
end

#versionObject (readonly)

Returns the value of attribute version.



32
33
34
# File 'lib/pago_pa/soap/message/rpt.rb', line 32

def version
  @version
end

Class Method Details

.decode(string) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/pago_pa/soap/message/rpt.rb', line 13

def decode(string)
  nori = Nori.new(
    advanced_typecasting: false,
    convert_tags_to: lambda do |tag|
      Soap.to_snakecase(tag.split(":").last).to_sym
    end
  )
  xml = Base64.decode64(string)
  nori.parse(xml)
end

Instance Method Details

#encodeObject



56
57
58
# File 'lib/pago_pa/soap/message/rpt.rb', line 56

def encode
  Base64.encode64(to_xml)
end

#to_paramsObject



50
51
52
53
54
# File 'lib/pago_pa/soap/message/rpt.rb', line 50

def to_params
  {
    "RPT" => {}
  }
end

#to_xmlObject



60
61
62
# File 'lib/pago_pa/soap/message/rpt.rb', line 60

def to_xml
  Gyoku.xml(to_params)
end