Class: EzpayInvoice::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ezpay-invoice/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rest_response) ⇒ Response

Returns a new instance of Response.

Raises:



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ezpay-invoice/response.rb', line 9

def initialize(rest_response)
  response_hash = JSON.parse(rest_response.body)
  raise EzpayResponseError.new(
    response_hash['Message'],
    response_hash['Status']
  ) if response_hash['Status'] != 'SUCCESS'

  @body = response_hash
  @status = response_hash['Status']
  @message = response_hash['Message']
  @result = transform_keys(JSON.parse(response_hash['Result']))
  parse_item_detail
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



7
8
9
# File 'lib/ezpay-invoice/response.rb', line 7

def body
  @body
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/ezpay-invoice/response.rb', line 7

def message
  @message
end

#resultObject (readonly)

Returns the value of attribute result.



7
8
9
# File 'lib/ezpay-invoice/response.rb', line 7

def result
  @result
end

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/ezpay-invoice/response.rb', line 7

def status
  @status
end