Sha256: 8d2b5a307af2b9a66fcd3c26a6e08896c2bd7c0e86cde6f4e4cd77a0efed06fd
Contents?: true
Size: 864 Bytes
Versions: 1
Compression:
Stored size: 864 Bytes
Contents
require 'savon' require 'singleton' module RussianPost class Client include Singleton attr_reader :savon, :endpoint, :namespace ENDPOINT = 'http://voh.russianpost.ru:8080/niips-operationhistory-web/OperationHistory' NAMESPACE = 'http://russianpost.org/operationhistory/data' def initialize(opts = {}) @savon = Savon.client( endpoint: ENDPOINT, namespace: NAMESPACE, open_timeout: opts[:timeout] || 10, # in seconds log: false) end def call(opts = {barcode: nil}) message = { 'wsdl:Barcode' => opts[:barcode], 'wsdl:MessageType' => '0' } response = savon.call('OperationHistoryRequest', message: message) result = response.to_hash[:operation_history_data][:history_record] result.kind_of?(Array) ? result : [result].compact end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
russianpost-0.7.0 | lib/russianpost/client.rb |