Class: Boletoman::Services::Soap::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/boletoman/services/soap/request.rb

Direct Known Subclasses

Boletoman::Services::Santander::Request

Instance Method Summary collapse

Instance Method Details

#basic_configObject



37
38
39
# File 'lib/boletoman/services/soap/request.rb', line 37

def basic_config
  { wsdl: wsdl, log: ::Boletoman.configuration.verbose }
end

#callObject



7
8
9
10
11
# File 'lib/boletoman/services/soap/request.rb', line 7

def call
  response_class.new(response, self).tap do |response|
    raise "Falha ao chamar operação #{operation}: #{response.body}" unless response.success?
  end
end

#clientObject



21
22
23
# File 'lib/boletoman/services/soap/request.rb', line 21

def client
  @client ||= Savon.client(config_options)
end

#config_optionsObject



33
34
35
# File 'lib/boletoman/services/soap/request.rb', line 33

def config_options
  basic_config.merge(extra_config_options)
end

#extra_config_optionsObject



41
42
43
# File 'lib/boletoman/services/soap/request.rb', line 41

def extra_config_options
  {}
end

#messageObject

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/boletoman/services/soap/request.rb', line 29

def message
  raise NotImplementedError
end

#operationObject

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/boletoman/services/soap/request.rb', line 25

def operation
  raise NotImplementedError
end

#responseObject



17
18
19
# File 'lib/boletoman/services/soap/request.rb', line 17

def response
  client.call(operation, message: message)
end

#response_classObject



13
14
15
# File 'lib/boletoman/services/soap/request.rb', line 13

def response_class
  "#{self.class}Response".constantize
end

#wsdlObject

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/boletoman/services/soap/request.rb', line 45

def wsdl
  raise NotImplementedError
end