class Oca::Oep::Client

Constants

WSDL_URL

Public Class Methods

new(username, password) click to toggle source
Calls superclass method Oca::BaseClient::new
# File lib/oca-epak/oep/client.rb, line 6
def initialize(username, password)
  super
  @opts = { wsdl: WSDL_URL }.merge(Oca::Logger.options)
  @client = Savon.client(@opts)
end

Public Instance Methods

get_html_de_etiquetas_por_orden_or_numero_envio(opts = {}) click to toggle source

Returns the HTML for a label

@param [Hash] opts @option opts [Integer] :id_orden_retiro @option opts [String] :nro_envio @return [String] HTML

# File lib/oca-epak/oep/client.rb, line 18
def get_html_de_etiquetas_por_orden_or_numero_envio(opts = {})
  method = :get_html_de_etiquetas_por_orden_or_numero_envio
  opts = { "idOrdenRetiro" => opts[:id_orden_retiro],
           "nroEnvio" => opts[:nro_envio] }
  response = client.call(method, message: opts)
  parse_result(response, method)
end
get_pdf_de_etiquetas_por_orden_or_numero_envio(opts = {}) click to toggle source

Returns the PDF (Base64 encoded) String for a label

@param [Hash] opts @option opts [Integer] :id_orden_retiro @option opts [String] :nro_envio @option opts [Boolean] :logistica_inversa @return [String] PDF data Base64 encoded

# File lib/oca-epak/oep/client.rb, line 33
def get_pdf_de_etiquetas_por_orden_or_numero_envio(opts = {})
  method = :get_pdf_de_etiquetas_por_orden_or_numero_envio
  opts = {
    "idOrdenRetiro" => opts[:id_orden_retiro],
    "nroEnvio" => opts[:nro_envio],
    "logisticaInversa" => opts.fetch(:logistica_inversa, FALSE_STRING).to_s
  }
  response = client.call(method, message: opts)
  parse_result(response, method)
rescue Savon::SOAPFault => error
  msg = "Oca WS responded with:\n#{error.http.code}\n#{error}"
  raise Oca::Errors::BadRequest.new(msg)
end