Class: Laximo::Respond::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/laximo/respond.rb

Constant Summary collapse

RESPONSE_RESULT =
'//QueryDataResponse/return'.freeze
RESPONSE_LOGIN_RESULT =
'//QueryDataLoginResponse/return'.freeze
RESPONSE_SOAP_ERROR =
'//Fault/faultstring'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
17
18
19
# File 'lib/laximo/respond.rb', line 12

def initialize(request)

  @error  = nil
  @result = []

  prepare_request(request)

end

Instance Method Details

#errorObject



31
32
33
# File 'lib/laximo/respond.rb', line 31

def error
  @error
end

#failure?Boolean Also known as: error?

success?

Returns:

  • (Boolean)


25
26
27
# File 'lib/laximo/respond.rb', line 25

def failure?
  !@error.nil?
end

#parsing_result(str) ⇒ Object

result!



46
47
48
# File 'lib/laximo/respond.rb', line 46

def parsing_result(str)
  ::NotImplementedError.new("Метод `parsing_result` не реализован в классе #{self.class.name}")
end

#resultObject

error



35
36
37
# File 'lib/laximo/respond.rb', line 35

def result
  @result
end

#result!Object

result

Raises:

  • (StandardError)


39
40
41
42
43
44
# File 'lib/laximo/respond.rb', line 39

def result!

  raise StandardError, error.inspect if failure?
  result

end

#success?Boolean

initialize

Returns:

  • (Boolean)


21
22
23
# File 'lib/laximo/respond.rb', line 21

def success?
  @error.nil?
end