Class: B2bCenterApi::WebService::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/b2b_center_api/web_service/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (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

#resultObject (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

#retObject (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

#statusObject (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