Skip to content

Commit

Permalink
Update namespace and rename gem
Browse files Browse the repository at this point in the history
  • Loading branch information
damjack committed Aug 13, 2018
1 parent aa10678 commit 763bcde
Show file tree
Hide file tree
Showing 22 changed files with 113 additions and 191 deletions.
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "bundler/setup"
require "soap"
require "pagopa_soap"
require "pago_pa"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
14 changes: 14 additions & 0 deletions lib/pago_pa.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

require "nori"
require "gyoku"
require "soap"

require "pago_pa/soap"
require "pago_pa/soap/version"
require "pago_pa/soap/configurable"
require "pago_pa/soap/wsdl_loader"
require "pago_pa/soap/message/rpt"
require "pago_pa/soap/message/rt"

module PagoPA; end
17 changes: 17 additions & 0 deletions lib/pago_pa/soap.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module PagoPA; end

module PagoPA::SOAP
class << self
def options
Hash[PagoPA::SOAP.keys.map { |key| [key, config.send(key)] }]
end

# API client based on configured options {Configurable}
def build
return @build if defined?(@build)
@build = PagoPA::SOAP::WSDLLoader.new(options)
end
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module PagopaSoap
module PagoPA::SOAP
class << self
# List of configurable keys for {Pagoparb::Client}
# @return [Array] of option keys
Expand Down Expand Up @@ -28,11 +28,11 @@ class Configurable
attr_accessor :endpoint_notify

def initialize
@namespace ||= "PagoPa"
@namespace ||= "PagoPA"
@wsdl_base ||=
File.expand_path("../../resources/pagopa_base.wsdl", __dir__)
File.expand_path("../../../resources/pagopa_base.wsdl", __dir__)
@wsdl_notify ||=
File.expand_path("../../resources/pagopa_avvisi.wsdl", __dir__)
File.expand_path("../../../resources/pagopa_avvisi.wsdl", __dir__)
end
end
end
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

module PagopaSoap; end
module PagopaSoap::Message; end
module PagoPA; end
module PagoPA::SOAP; end
module PagoPA::SOAP::Message; end

class PagopaSoap::Message::Domain
class PagoPA::SOAP::Message::Domain
REQUIRED_ATTRIBUTES = %i[
identificativo_dominio identificativo_stazione_richiedente
].freeze
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

module PagopaSoap; end
module PagopaSoap::Message; end
module PagoPA; end
module PagoPA::SOAP; end
module PagoPA::SOAP::Message; end

class PagopaSoap::Message::Institution
class PagoPA::SOAP::Message::Institution
REQUIRED_ATTRIBUTES = %i[
denominazione_beneficiario identificativo_univoco_beneficiario
].freeze
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

module PagopaSoap; end
module PagopaSoap::Message; end
module PagoPA; end
module PagoPA::SOAP; end
module PagoPA::SOAP::Message; end

class PagopaSoap::Message::Payer
class PagoPA::SOAP::Message::Payer
REQUIRED_ATTRIBUTES = %i[
anagrafica_pagatore identificativo_univoco_pagatore
].freeze
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# frozen_string_literal: true

require "pagopa_soap/message/single_payment"
require "pago_pa/soap/message/single_payment"

module PagopaSoap; end
module PagopaSoap::Message; end
module PagoPA; end
module PagoPA::SOAP; end
module PagoPA::SOAP::Message; end

class PagopaSoap::Message::Payment
class PagoPA::SOAP::Message::Payment
REQUIRED_ATTRIBUTES = %i[
data_esecuzione_pagamento importo_totale_da_versare tipo_versamento
identificativo_univoco_versamento codice_contesto_pagamento
Expand Down Expand Up @@ -54,7 +55,7 @@ def validate_attrs!

def single_payments
@single_payments ||= attributes[:dati_singolo_versamento].map do |single|
PagopaSoap::Message::SinglePayment.new(single).perform!
PagoPA::SOAP::Message::SinglePayment.new(single).perform!
end
end
end
22 changes: 11 additions & 11 deletions lib/pagopa_soap/message/rpt.rb → lib/pago_pa/soap/message/rpt.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

require "pagopa_soap/message/domain"
require "pagopa_soap/message/payer"
require "pagopa_soap/message/institution"
require "pagopa_soap/message/payment"
require "pago_pa/soap/message/domain"
require "pago_pa/soap/message/payer"
require "pago_pa/soap/message/institution"
require "pago_pa/soap/message/payment"

module PagopaSoap; end
module PagopaSoap::Message; end
module PagoPA::SOAP; end
module PagoPA::SOAP::Message; end

class PagopaSoap::Message::Rpt
class PagoPA::SOAP::Message::Rpt
class << self
def decode(string)
nori = Nori.new(
Expand Down Expand Up @@ -64,23 +64,23 @@ def to_xml
private

def domain
@domain ||= PagoSoap::Message::Domain.new(attributes[:dominio]).perform!
@domain ||= PagoPA::SOAP::Message::Domain.new(attributes[:dominio]).perform!
end

def payer
@payer ||=
PagoSoap::Message::Payer.new(attributes[:soggetto_pagatore]).perform!
PagoPA::SOAP::Message::Payer.new(attributes[:soggetto_pagatore]).perform!
end

def institution
@institution ||=
PagoSoap::Message::Institution.new(
PagoPA::SOAP::Message::Institution.new(
attributes[:ente_beneficiario]
).perform!
end

def payment
@payment ||=
PagoSoap::Message::Payment.new(attributes[:dati_versamento]).perform!
PagoPA::SOAP::Message::Payment.new(attributes[:dati_versamento]).perform!
end
end
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

module PagopaSoap; end
module PagopaSoap::Message; end
module PagoPA; end
module PagoPA::SOAP; end
module PagoPA::SOAP::Message; end

class PagopaSoap::Message::Rt
class PagoPA::SOAP::Message::Rt
class << self
def decode(string)
Base64.decode64(string)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

module PagopaSoap; end
module PagopaSoap::Message; end
module PagoPA; end
module PagoPA::SOAP; end
module PagoPA::SOAP::Message; end

class PagopaSoap::Message::SinglePayment
class PagoPA::SOAP::Message::SinglePayment
REQUIRED_ATTRIBUTES = %i[].freeze

attr_reader :attributes
Expand Down
8 changes: 8 additions & 0 deletions lib/pago_pa/soap/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

module PagoPA; end
module PagoPA::SOAP; end

module PagoPA::SOAP
VERSION = "0.1.0"
end
15 changes: 8 additions & 7 deletions lib/pagopa_soap/base.rb → lib/pago_pa/soap/wsdl_loader.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# frozen_string_literal: true

module PagopaSoap; end
module PagoPA; end
module PagoPA::SOAP; end

class PagopaSoap::Base
class PagoPA::SOAP::WSDLLoader
attr_reader :wsdl_base
attr_reader :wsdl_notify
attr_reader :namespace

def initialize(options = {})
@wsdl_base = options[:wsdl_base] || PagopaSoap.config.wsdl_base
@wsdl_notify = options[:wsdl_notify] || PagopaSoap.config.wsdl_notify
@namespace = options[:namespace] || PagopaSoap.config.namespace
@wsdl_base = options[:wsdl_base] || PagoPA::SOAP.config.wsdl_base
@wsdl_notify = options[:wsdl_notify] || PagoPA::SOAP.config.wsdl_notify
@namespace = options[:namespace] || PagoPA::SOAP.config.namespace

validate_wsdl_base!
validate_wsdl_notify!
Expand Down Expand Up @@ -40,7 +41,7 @@ def soap_base
Soap::Base.new(
wsdl: wsdl_base,
namespace: namespace,
endpoint: PagopaSoap.config.endpoint_base
endpoint: PagoPA::SOAP.config.endpoint_base
)
end

Expand All @@ -49,7 +50,7 @@ def soap_notify
Soap::Base.new(
wsdl: wsdl_notify,
namespace: namespace,
endpoint: PagopaSoap.config.endpoint_notify
endpoint: PagoPA::SOAP.config.endpoint_notify
)
end

Expand Down
25 changes: 0 additions & 25 deletions lib/pagopa_soap.rb

This file was deleted.

72 changes: 0 additions & 72 deletions lib/pagopa_soap/client.rb

This file was deleted.

14 changes: 0 additions & 14 deletions lib/pagopa_soap/error.rb

This file was deleted.

5 changes: 0 additions & 5 deletions lib/pagopa_soap/version.rb

This file was deleted.

Loading

0 comments on commit 763bcde

Please sign in to comment.