Class: B2bCenterApi::WebService::Response
- Inherits:
-
Object
- Object
- B2bCenterApi::WebService::Response
- Defined in:
- lib/b2b_center_api/web_service/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#ret ⇒ Object
readonly
Returns the value of attribute ret.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/b2b_center_api/web_service/response.rb', line 8 def initialize(response) @body = response.body @ret = @body.values[0][:return] @status = @ret.delete(:status) if @status[:error_code] == '0' @result = @ret else fail B2bCenterApi::EtpError, format('Код ошибки: %s, Сообщение: %s', @status[:error_code], @status[:error_message]) end end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/b2b_center_api/web_service/response.rb', line 6 def body @body end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/b2b_center_api/web_service/response.rb', line 6 def result @result end |
#ret ⇒ Object (readonly)
Returns the value of attribute ret.
6 7 8 |
# File 'lib/b2b_center_api/web_service/response.rb', line 6 def ret @ret end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/b2b_center_api/web_service/response.rb', line 6 def status @status end |