Sha256: b7c0ba0a6295f524b8e84129b26d958535f713c6b9f3946aafb884a65fdd2c32

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 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)
    end

    def call(barcode: nil)
      message = { "wsdl:Barcode" => 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.1.0 lib/russianpost/client.rb