Class: SsciInc::Request
Constant Summary collapse
- ADDITIONAL_ITEMS =
[:postback_url, :postback_username, :postback_password, :embed_credentials, :ordernotes, :interface, :monthly_income, :monthly_rent]
- 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
PersonalData.
-
#family_name ⇒ Object
PersonName.
-
#given_name ⇒ Object
PersonName.
-
#middle_name ⇒ Object
PersonName.
-
#municipality ⇒ Object
PostalAddress.
-
#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
PersonalData.
-
#type ⇒ Object
BackgroundSearchPackage.
-
#use_defaults ⇒ Object
Returns the value of attribute use_defaults.
-
#user_name ⇒ Object
BackgroundCheck.
Instance Method Summary collapse
- #account_code ⇒ Object
- #additional_items ⇒ Object
- #as_xml ⇒ Object
- #build_request ⇒ Object
- #init_default_screenings ⇒ Object
-
#initialize(h = {}) ⇒ Request
constructor
A new instance of Request.
- #postback_password ⇒ Object
- #postback_url ⇒ Object
- #postback_username ⇒ Object
- #request_options ⇒ Object
- #site_identifier ⇒ Object
- #submit ⇒ Object
- #to_xml ⇒ Object
Methods included from DSL
Constructor Details
#initialize(h = {}) ⇒ Request
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ssci_inc/request.rb', line 66 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
28 29 30 |
# File 'lib/ssci_inc/request.rb', line 28 def action @action end |
#address_line ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def address_line @address_line end |
#affix ⇒ Object
PersonName
38 39 40 |
# File 'lib/ssci_inc/request.rb', line 38 def affix @affix end |
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
64 65 66 |
# File 'lib/ssci_inc/request.rb', line 64 def aliases @aliases end |
#base_uri ⇒ Object
BackgroundCheck
22 23 24 |
# File 'lib/ssci_inc/request.rb', line 22 def base_uri @base_uri end |
#config ⇒ Object
BackgroundCheck
22 23 24 |
# File 'lib/ssci_inc/request.rb', line 22 def config @config end |
#country_code ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def country_code @country_code end |
#county ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def county @county end |
#date_of_birth ⇒ Object
DemographicDetail
44 45 46 |
# File 'lib/ssci_inc/request.rb', line 44 def date_of_birth @date_of_birth end |
#district ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def district @district end |
#email_address ⇒ Object
PersonalData
34 35 36 |
# File 'lib/ssci_inc/request.rb', line 34 def email_address @email_address end |
#family_name ⇒ Object
PersonName
38 39 40 |
# File 'lib/ssci_inc/request.rb', line 38 def family_name @family_name end |
#given_name ⇒ Object
PersonName
38 39 40 |
# File 'lib/ssci_inc/request.rb', line 38 def given_name @given_name end |
#middle_name ⇒ Object
PersonName
38 39 40 |
# File 'lib/ssci_inc/request.rb', line 38 def middle_name @middle_name end |
#municipality ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def municipality @municipality end |
#password ⇒ Object
BackgroundCheck
22 23 24 |
# File 'lib/ssci_inc/request.rb', line 22 def password @password end |
#postal_code ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def postal_code @postal_code end |
#reference ⇒ Object
BackgroundSearchPackage
28 29 30 |
# File 'lib/ssci_inc/request.rb', line 28 def reference @reference end |
#reference_id ⇒ Object
BackgroundSearchPackage
28 29 30 |
# File 'lib/ssci_inc/request.rb', line 28 def reference_id @reference_id end |
#region ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def region @region end |
#screenings ⇒ Object (readonly)
Screenings
58 59 60 |
# File 'lib/ssci_inc/request.rb', line 58 def screenings @screenings end |
#ssn ⇒ Object
DemographicDetail
44 45 46 |
# File 'lib/ssci_inc/request.rb', line 44 def ssn @ssn end |
#street_name ⇒ Object
PostalAddress
48 49 50 |
# File 'lib/ssci_inc/request.rb', line 48 def street_name @street_name end |
#telephone ⇒ Object
PersonalData
34 35 36 |
# File 'lib/ssci_inc/request.rb', line 34 def telephone @telephone end |
#type ⇒ Object
BackgroundSearchPackage
28 29 30 |
# File 'lib/ssci_inc/request.rb', line 28 def type @type end |
#use_defaults ⇒ Object
Returns the value of attribute use_defaults.
59 60 61 |
# File 'lib/ssci_inc/request.rb', line 59 def use_defaults @use_defaults end |
#user_name ⇒ Object
BackgroundCheck
22 23 24 |
# File 'lib/ssci_inc/request.rb', line 22 def user_name @user_name end |
Instance Method Details
#account_code ⇒ Object
173 174 175 |
# File 'lib/ssci_inc/request.rb', line 173 def account_code @account_code || config.account_code end |
#additional_items ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/ssci_inc/request.rb', line 77 def additional_items ADDITIONAL_ITEMS.inject({}) do |h,a| v = send(a) h[a] = send(a) unless v.nil? h end end |
#as_xml ⇒ Object
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 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/ssci_inc/request.rb', line 85 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.ReferenceId reference_id xml.Reference reference 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 address_line } # AddressSummary xml.SpecialRequestInfo { xml.ApplicantPhone telephone xml.ApplicantEmail email_address } } # 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
151 152 153 |
# File 'lib/ssci_inc/request.rb', line 151 def build_request HTTParty::Request.new(Net::HTTP::Post, base_uri, ) end |
#init_default_screenings ⇒ Object
211 212 213 214 |
# File 'lib/ssci_inc/request.rb', line 211 def init_default_screenings @screenings = [Screening::Social.new, Screening::Other.new(qualifier: 'US Crim / Sex Offender Search')] end |
#postback_password ⇒ Object
193 194 195 |
# File 'lib/ssci_inc/request.rb', line 193 def postback_password @postback_password || config.postback_password end |
#postback_url ⇒ Object
185 186 187 |
# File 'lib/ssci_inc/request.rb', line 185 def postback_url @postback_url || config.postback_url end |
#postback_username ⇒ Object
189 190 191 |
# File 'lib/ssci_inc/request.rb', line 189 def postback_username @postback_username || config.postback_username end |
#request_options ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/ssci_inc/request.rb', line 143 def { body: to_xml, basic_auth: { username: user_name, password: password }, headers: { "Content-Type" => "text/xml"} } end |
#site_identifier ⇒ Object
169 170 171 |
# File 'lib/ssci_inc/request.rb', line 169 def site_identifier @site_identifier || config.site_identifier end |
#submit ⇒ Object
155 156 157 158 159 |
# File 'lib/ssci_inc/request.rb', line 155 def submit response = build_request.perform data = response.parsed_response SsciInc::Response.new(data) end |
#to_xml ⇒ Object
139 140 141 |
# File 'lib/ssci_inc/request.rb', line 139 def to_xml as_xml.to_xml end |