Class: Experian::ConnectCheck::Request

Inherits:
Request
  • Object
show all
Defined in:
lib/experian/connect_check/request.rb

Instance Attribute Summary

Attributes inherited from Request

#xml

Instance Method Summary collapse

Methods inherited from Request

#initialize

Constructor Details

This class inherits a constructor from Experian::Request

Instance Method Details

#add_account_type(xml) ⇒ Object



84
85
86
87
88
89
90
91
# File 'lib/experian/connect_check/request.rb', line 84

def (xml)
  xml.tag!('AccountType') do
    xml.tag!('Type', @options[:account_type])
    xml.tag!('Terms', @options[:account_terms])
    xml.tag!('FullAmount', @options[:account_full_amount])
    xml.tag!('AbbreviatedAmount', @options[:account_abbreviated_amount])
  end if @options[:account_type]
end

#add_applicant(xml) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/experian/connect_check/request.rb', line 36

def add_applicant(xml)
  xml.tag!('PrimaryApplicant') do
    xml.tag!('Name') do
      xml.tag!('Surname', @options[:last_name])
      xml.tag!('First', @options[:first_name])
      xml.tag!('Middle', @options[:middle_name]) if @options[:middle_name]
      xml.tag!('Gen', @options[:generation_code]) if @options[:generation_code]
    end
    xml.tag!('SSN', @options[:ssn]) if @options[:ssn]
    add_current_address(xml)
    add_previous_address(xml)
    add_driver_license(xml)
    add_employment(xml)
    xml.tag!('Age', @options[:age]) if @options[:age]
    xml.tag!('DOB', @options[:dob]) if @options[:dob]
    xml.tag!('YOB', @options[:yob]) if @options[:yob]
  end
end

#add_current_address(xml) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/experian/connect_check/request.rb', line 55

def add_current_address(xml)
  xml.tag!('CurrentAddress') do
    xml.tag!('Street', @options[:street])
    xml.tag!('City', @options[:city])
    xml.tag!('State', @options[:state])
    xml.tag!('Zip', @options[:zip])
  end if @options[:zip]
end

#add_driver_license(xml) ⇒ Object



73
74
75
76
77
78
# File 'lib/experian/connect_check/request.rb', line 73

def add_driver_license(xml)
  xml.tag!('DriverLicense') do
    xml.tag!('State', @options[:driver_license_state])
    xml.tag!('Number', @options[:driver_license_number])
  end if @options[:driver_license_number]
end

#add_employment(xml) ⇒ Object



80
81
82
# File 'lib/experian/connect_check/request.rb', line 80

def add_employment(xml)
  # Not Implemented
end

#add_options(xml) ⇒ Object



107
108
109
110
111
112
# File 'lib/experian/connect_check/request.rb', line 107

def add_options(xml)
  xml.tag!('Options') do
    xml.tag!('ReferenceNumber', @options[:reference_number])
    xml.tag!('EndUser', @options[:end_user])
  end if @options[:reference_number]
end

#add_output_type(xml) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/experian/connect_check/request.rb', line 93

def add_output_type(xml)
  xml.tag!('OutputType') do
    xml.tag!('ARF') do
      xml.tag!('ARFVersion', Experian::ARF_VERSION)
    end
  end
end

#add_previous_address(xml) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/experian/connect_check/request.rb', line 64

def add_previous_address(xml)
  xml.tag!('PreviousAddress') do
    xml.tag!('Street', @options[:previous_street])
    xml.tag!('City', @options[:previous_city])
    xml.tag!('State', @options[:previous_state])
    xml.tag!('Zip', @options[:previous_zip])
  end if @options[:previous_zip]
end

#add_reference_id(xml) ⇒ Object



24
25
26
# File 'lib/experian/connect_check/request.rb', line 24

def add_reference_id(xml)
  xml.tag!('ReferenceId', @options[:reference_id]) if @options[:reference_id]
end

#add_subscriber(xml) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/experian/connect_check/request.rb', line 28

def add_subscriber(xml)
  xml.tag!('Subscriber') do
    xml.tag!('Preamble', Experian.preamble)
    xml.tag!('OpInitials', Experian.op_initials)
    xml.tag!('SubCode', Experian.subcode)
  end
end

#add_vendor(xml) ⇒ Object



101
102
103
104
105
# File 'lib/experian/connect_check/request.rb', line 101

def add_vendor(xml)
  xml.tag!('Vendor') do
    xml.tag!('VendorNumber', Experian.vendor_number)
  end
end

#build_requestObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/experian/connect_check/request.rb', line 5

def build_request
  super do |xml|
    xml.tag!('EAI', Experian.eai)
    xml.tag!('DBHost', ConnectCheck.db_host)
    add_reference_id(xml)
    xml.tag!('Request', :xmlns => Experian::XML_REQUEST_NAMESPACE, :version => '1.0') do
      xml.tag!('Products') do
        xml.tag!('ConnectCheck') do
          add_subscriber(xml)
          add_applicant(xml)
          add_output_type(xml)
          add_vendor(xml)
          add_options(xml)
        end
      end
    end
  end
end