Class: SsciInc::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Response

Returns a new instance of Response.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ssci_inc/response.rb', line 13

def initialize(data)
  @data = data
  document = Nokogiri::XML.parse(data)

  # errors
  @error_code = document.at("//ErrorCode").try(:text)
  @error_description = document.at("//ErrorDescription").try(:text)

  # completed postback response
  @screening_results_type = document.at("//BackgroundReportPackage//@type").try(:text)
  @order_status = document.at("//OrderStatus").try(:text)
  @result_status = document.at("//ResultStatus").try(:text)
  @date_order_received = document.at("//DateOrderReceived").try(:text)
  @result_url = document.at("//InternetWebAddress//CDATA").try(:text)
  @result_url = document.at("//InternetWebAddress").try(:text) unless @result_url
  @order_id = document.at("//Receipt").try(:text)
  @reference_id = document.at("//ExtraIdentifier").try(:text)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#date_order_receivedObject (readonly)

postback



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

def date_order_received
  @date_order_received
end

#error_codeObject (readonly)

ErrorReport



7
8
9
# File 'lib/ssci_inc/response.rb', line 7

def error_code
  @error_code
end

#error_descriptionObject (readonly)

ErrorReport



7
8
9
# File 'lib/ssci_inc/response.rb', line 7

def error_description
  @error_description
end

#order_idObject (readonly)

postback



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

def order_id
  @order_id
end

#order_statusObject (readonly)

postback



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

def order_status
  @order_status
end

#reference_idObject (readonly)

postback



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

def reference_id
  @reference_id
end

#result_statusObject (readonly)

postback



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

def result_status
  @result_status
end

#result_urlObject (readonly)

postback



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

def result_url
  @result_url
end

#screening_statusObject (readonly)

postback



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

def screening_status
  @screening_status
end