Sha256: babd74caa1a48dbbb0eca5967f599185a0f52e091269554df0b013cacf3cba06

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

require "savon"

module RussianPost
  class Client
    attr_reader :savon, :endpoint, :namespace
    
    def initialize
      @endpoint  = "http://voh.russianpost.ru:8080/niips-operationhistory-web/OperationHistory"
      @namespace = "http://russianpost.org/operationhistory/data"
      @savon     = Savon.client(endpoint: endpoint, namespace: namespace, log: false)
    end

    def call(opts = {barcode: nil})
      message = { "wsdl:Barcode" => opts[:barcode], "wsdl:MessageType" => "0" }
      response = savon.call("OperationHistoryRequest", message: message)

      response.to_hash[:operation_history_data][:history_record]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
russianpost-0.3.0 lib/russianpost/client.rb