Class: RussianPost::Client
- Inherits:
-
Object
- Object
- RussianPost::Client
- Includes:
- Singleton
- Defined in:
- lib/russianpost/client.rb
Constant Summary collapse
- ENDPOINT =
'http://voh.russianpost.ru:8080/niips-operationhistory-web/OperationHistory'
- NAMESPACE =
'http://russianpost.org/operationhistory/data'
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#savon ⇒ Object
readonly
Returns the value of attribute savon.
Instance Method Summary collapse
- #call(opts = {barcode: nil}) ⇒ Object
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
8 9 10 |
# File 'lib/russianpost/client.rb', line 8 def endpoint @endpoint end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
8 9 10 |
# File 'lib/russianpost/client.rb', line 8 def namespace @namespace end |
#savon ⇒ Object (readonly)
Returns the value of attribute savon.
8 9 10 |
# File 'lib/russianpost/client.rb', line 8 def savon @savon end |
Instance Method Details
#call(opts = {barcode: nil}) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/russianpost/client.rb', line 21 def call(opts = {barcode: nil}) = { 'wsdl:Barcode' => opts[:barcode], 'wsdl:MessageType' => '0' } response = savon.call('OperationHistoryRequest', message: ) result = response.to_hash[:operation_history_data][:history_record] result.kind_of?(Array) ? result : [result].compact end |