Class: MPIClient::AccountManagement::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/mpi_client/account_management/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_source) ⇒ Response

Returns a new instance of Response.



10
11
12
# File 'lib/mpi_client/account_management/response.rb', line 10

def initialize(response_source)
  @response_source = response_source
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def 
  @account_id
end

#acquirer_binObject (readonly)

Returns the value of attribute acquirer_bin.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def acquirer_bin
  @acquirer_bin
end

#brandObject (readonly)

Returns the value of attribute brand.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def brand
  @brand
end

#certificateObject (readonly)

Returns the value of attribute certificate.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def certificate
  @certificate
end

#certificate_subjectObject (readonly)

Returns the value of attribute certificate_subject.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def certificate_subject
  @certificate_subject
end

#client_urlObject (readonly)

Returns the value of attribute client_url.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def client_url
  @client_url
end

#country_codeObject (readonly)

Returns the value of attribute country_code.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def country_code
  @country_code
end

#directory_server_urlObject (readonly)

Returns the value of attribute directory_server_url.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def directory_server_url
  @directory_server_url
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def error_code
  @error_code
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def error_message
  @error_message
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def errors
  @errors
end

#merchant_idObject (readonly)

Returns the value of attribute merchant_id.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def merchant_id
  @merchant_id
end

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def password
  @password
end

#private_keyObject (readonly)

Returns the value of attribute private_key.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def private_key
  @private_key
end

#response_sourceObject (readonly)

Returns the value of attribute response_source.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def response_source
  @response_source
end

#response_urlObject (readonly)

Returns the value of attribute response_url.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def response_url
  @response_url
end

#site_nameObject (readonly)

Returns the value of attribute site_name.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def site_name
  @site_name
end

#site_urlObject (readonly)

Returns the value of attribute site_url.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def site_url
  @site_url
end

#term_urlObject (readonly)

Returns the value of attribute term_url.



4
5
6
# File 'lib/mpi_client/account_management/response.rb', line 4

def term_url
  @term_url
end

Instance Method Details

#parseObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mpi_client/account_management/response.rb', line 18

def parse
  doc = Nokogiri::XML.parse(response_source)

  if error = doc.xpath("//Error").first
    @error_code    = error[:code]
    @error_message = error.text
    @errors        = errors_to_hash
  else
     doc.xpath("//Transaction/*")
  end

end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/mpi_client/account_management/response.rb', line 14

def success?
  error_code.nil? && error_message.nil?
end