Class: LazopApiClient::Response

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

Instance Method Summary collapse

Constructor Details

#initialize(type, code, message, r_id, body) ⇒ Response

Returns a new instance of Response.



217
218
219
220
221
222
223
# File 'lib/lazop_api_client.rb', line 217

def initialize(type,code,message,r_id,body)
    @type = type 
    @code = code
    @message = message
    @body = body
    @request_id = r_id
end

Instance Method Details

#bodyObject



243
244
245
246
# File 'lib/lazop_api_client.rb', line 243

def body
    # http response body, contains all fileds 
    @body
end

#codeObject



234
235
236
237
# File 'lib/lazop_api_client.rb', line 234

def code
    # response code, 0 is no error
    @code
end

#messageObject



239
240
241
# File 'lib/lazop_api_client.rb', line 239

def message
    @message
end

#request_idObject



248
249
250
251
# File 'lib/lazop_api_client.rb', line 248

def request_id
    # api uniqe request id
    @request_id
end

#success?Boolean

Returns:

  • (Boolean)


253
254
255
# File 'lib/lazop_api_client.rb', line 253

def success?
    @code == '0'
end

#typeObject



225
226
227
228
229
230
231
232
# File 'lib/lazop_api_client.rb', line 225

def type
    # response type nil,ISP,ISV,SYSTEM
    # nil :no error
    # ISP : API Service Provider Error
    # ISV : API Request Client Error
    # SYSTEM : Lazop platform Error
    @type
end