Class: SsciInc::Request
Constant Summary collapse
- COURT_TYPES =
{ bankruptcy: "Bankruptcy", federal: "Federal", felony: "Felony", felony_misdemeanor: "Felony Misdemeanor", lower_civil: "Lower Civil", property_search: "Property Search", upper_civil: "Upper Civil", upper_lower_civil: "Upper and Lower Civil" }
Instance Attribute Summary collapse
-
#action ⇒ Object
BackgroundSearchPackage.
-
#address_line ⇒ Object
PostalAddress.
-
#affix ⇒ Object
PersonName.
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#base_uri ⇒ Object
BackgroundCheck.
-
#config ⇒ Object
BackgroundCheck.
-
#country_code ⇒ Object
PostalAddress.
-
#county ⇒ Object
PostalAddress.
-
#date_of_birth ⇒ Object
DemographicDetail.
-
#district ⇒ Object
PostalAddress.
-
#email_address ⇒ Object
SpecialRequestInfo.
-
#extra_identifier ⇒ Object
SpecialRequestInfo.
-
#family_name ⇒ Object
PersonName.
-
#given_name ⇒ Object
PersonName.
-
#middle_name ⇒ Object
PersonName.
-
#municipality ⇒ Object
PostalAddress.
-
#ordernotes ⇒ Object
SpecialRequestInfo.
-
#password ⇒ Object
BackgroundCheck.
-
#postal_code ⇒ Object
PostalAddress.
-
#reference ⇒ Object
BackgroundSearchPackage.
-
#reference_id ⇒ Object
BackgroundSearchPackage.
-
#region ⇒ Object
PostalAddress.
-
#screenings ⇒ Object
readonly
Screenings.
-
#ssn ⇒ Object
DemographicDetail.
-
#street_name ⇒ Object
PostalAddress.
-
#telephone ⇒ Object
SpecialRequestInfo.
-
#type ⇒ Object
BackgroundSearchPackage.
-
#use_defaults ⇒ Object
Returns the value of attribute use_defaults.
-
#user_name ⇒ Object
BackgroundCheck.
Instance Method Summary collapse
- #account_code ⇒ Object
- #as_xml ⇒ Object
- #build_request ⇒ Object
- #init_default_screenings ⇒ Object
-
#initialize(h = {}) ⇒ Request
constructor
A new instance of Request.
- #request_options ⇒ Object
- #site_identifier ⇒ Object
- #submit ⇒ Object
- #to_xml ⇒ Object
Methods included from DSL
Constructor Details
#initialize(h = {}) ⇒ Request
Returns a new instance of Request.
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ssci_inc/request.rb', line 61 def initialize(h={}) init_defaults h.each do |k,v| send("#{k}=", v) if respond_to?("#{k}=") end county = yield self if block_given? end |
Instance Attribute Details
#action ⇒ Object
BackgroundSearchPackage
24 25 26 |
# File 'lib/ssci_inc/request.rb', line 24 def action @action end |
#address_line ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def address_line @address_line end |
#affix ⇒ Object
PersonName
30 31 32 |
# File 'lib/ssci_inc/request.rb', line 30 def affix @affix end |
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
59 60 61 |
# File 'lib/ssci_inc/request.rb', line 59 def aliases @aliases end |
#base_uri ⇒ Object
BackgroundCheck
18 19 20 |
# File 'lib/ssci_inc/request.rb', line 18 def base_uri @base_uri end |
#config ⇒ Object
BackgroundCheck
18 19 20 |
# File 'lib/ssci_inc/request.rb', line 18 def config @config end |
#country_code ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def country_code @country_code end |
#county ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def county @county end |
#date_of_birth ⇒ Object
DemographicDetail
36 37 38 |
# File 'lib/ssci_inc/request.rb', line 36 def date_of_birth @date_of_birth end |
#district ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def district @district end |
#email_address ⇒ Object
SpecialRequestInfo
50 51 52 |
# File 'lib/ssci_inc/request.rb', line 50 def email_address @email_address end |
#extra_identifier ⇒ Object
SpecialRequestInfo
50 51 52 |
# File 'lib/ssci_inc/request.rb', line 50 def extra_identifier @extra_identifier end |
#family_name ⇒ Object
PersonName
30 31 32 |
# File 'lib/ssci_inc/request.rb', line 30 def family_name @family_name end |
#given_name ⇒ Object
PersonName
30 31 32 |
# File 'lib/ssci_inc/request.rb', line 30 def given_name @given_name end |
#middle_name ⇒ Object
PersonName
30 31 32 |
# File 'lib/ssci_inc/request.rb', line 30 def middle_name @middle_name end |
#municipality ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def municipality @municipality end |
#ordernotes ⇒ Object
SpecialRequestInfo
50 51 52 |
# File 'lib/ssci_inc/request.rb', line 50 def ordernotes @ordernotes end |
#password ⇒ Object
BackgroundCheck
18 19 20 |
# File 'lib/ssci_inc/request.rb', line 18 def password @password end |
#postal_code ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def postal_code @postal_code end |
#reference ⇒ Object
BackgroundSearchPackage
24 25 26 |
# File 'lib/ssci_inc/request.rb', line 24 def reference @reference end |
#reference_id ⇒ Object
BackgroundSearchPackage
24 25 26 |
# File 'lib/ssci_inc/request.rb', line 24 def reference_id @reference_id end |
#region ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def region @region end |
#screenings ⇒ Object (readonly)
Screenings
56 57 58 |
# File 'lib/ssci_inc/request.rb', line 56 def screenings @screenings end |
#ssn ⇒ Object
DemographicDetail
36 37 38 |
# File 'lib/ssci_inc/request.rb', line 36 def ssn @ssn end |
#street_name ⇒ Object
PostalAddress
40 41 42 |
# File 'lib/ssci_inc/request.rb', line 40 def street_name @street_name end |
#telephone ⇒ Object
SpecialRequestInfo
50 51 52 |
# File 'lib/ssci_inc/request.rb', line 50 def telephone @telephone end |
#type ⇒ Object
BackgroundSearchPackage
24 25 26 |
# File 'lib/ssci_inc/request.rb', line 24 def type @type end |
#use_defaults ⇒ Object
Returns the value of attribute use_defaults.
57 58 59 |
# File 'lib/ssci_inc/request.rb', line 57 def use_defaults @use_defaults end |
#user_name ⇒ Object
BackgroundCheck
18 19 20 |
# File 'lib/ssci_inc/request.rb', line 18 def user_name @user_name end |
Instance Method Details
#account_code ⇒ Object
163 164 165 |
# File 'lib/ssci_inc/request.rb', line 163 def account_code @account_code || config.account_code end |
#as_xml ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/ssci_inc/request.rb', line 72 def as_xml Nokogiri::XML::Builder.new do |xml| xml.BackgroundCheck(:userId => user_name, :password => password) { xml.BatchData { xml.DestSiteIdentifier "SOUTHEASTERN" xml.SourceSiteIdentifier site_identifier xml.AcctCode account_code xml.BatchID 1 xml.RecordCount 1 } xml.BackgroundSearchPackage { xml.PersonalData { xml.PersonName { xml.GivenName given_name xml.MiddleName middle_name if middle_name.present? xml.FamilyName family_name xml.Affix affix if affix.present? } if aliases.any? xml.AliasNames { aliases.each do |a| xml.parent << a.as_xml end } end xml.DemographicDetail { xml.Ssn ssn xml.DateOfBirth date_of_birth } # DemographicDetail xml.AddressSummary { xml.CountryCode country_code == "Canada" ? "CA" : "US" xml.PostalCode postal_code xml.Region region xml.Municipality municipality xml.AddressLine street_name } # AddressSummary xml.RequestIdData { xml.ReferenceID reference_id } xml.SpecialRequestInfo { xml.OtherInfo ordernotes xml.ApplicantPhone telephone xml.ApplicantEmail email_address xml.ExtraIdentifier extra_identifier } } # PersonalData xml.Screenings { init_default_screenings if use_defaults @screenings.each do |s| xml.parent << s.as_xml end } # Screenings } # BackgroundSearchPackage } # BackgroundCheck end end |
#build_request ⇒ Object
141 142 143 |
# File 'lib/ssci_inc/request.rb', line 141 def build_request HTTParty::Request.new(Net::HTTP::Post, base_uri, ) end |
#init_default_screenings ⇒ Object
189 190 191 192 |
# File 'lib/ssci_inc/request.rb', line 189 def init_default_screenings @screenings = [Screening::Social.new, Screening::Other.new(qualifier: 'US Crim / Sex Offender Search')] end |
#request_options ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/ssci_inc/request.rb', line 133 def { body: to_xml, basic_auth: { username: user_name, password: password }, headers: { "Content-Type" => "text/xml"} } end |
#site_identifier ⇒ Object
159 160 161 |
# File 'lib/ssci_inc/request.rb', line 159 def site_identifier @site_identifier || config.site_identifier end |
#submit ⇒ Object
145 146 147 148 149 |
# File 'lib/ssci_inc/request.rb', line 145 def submit response = build_request.perform data = response.parsed_response SsciInc::Response.new(data) end |
#to_xml ⇒ Object
129 130 131 |
# File 'lib/ssci_inc/request.rb', line 129 def to_xml as_xml.to_xml end |