Class: Weimark::Client
- Inherits:
-
Object
- Object
- Weimark::Client
- Defined in:
- lib/weimark/client.rb
Constant Summary collapse
- WEIMARK_URL =
'https://secure.weimark.com/api/post'.freeze
Instance Attribute Summary collapse
-
#agents_email ⇒ Object
readonly
Returns the value of attribute agents_email.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #get(application_id) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#post(application_attributes = {}) ⇒ Object
Sample application_attributes: ‘JONATHAN’, lname: ‘CONSUMER’, dob: ‘01/05/1987’, gender: ‘male’, ssn: ‘485774859’, streetnumber: ‘236’, streetname: ‘BIRCH’, streettype: ‘S’, city: ‘BURBANK’, country: ‘USA’, suite: ‘1TEST’, zip: ‘91502’.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/weimark/client.rb', line 11 def initialize( = {}) @url = [:url] || WEIMARK_URL @email = [:email] || ENV['WEIMARK_EMAIL'] @password = [:password] || ENV['WEIMARK_PASSWORD'] @agents_email = [:agents_email] || ENV['AGENTS_EMAIL'] end |
Instance Attribute Details
#agents_email ⇒ Object (readonly)
Returns the value of attribute agents_email.
9 10 11 |
# File 'lib/weimark/client.rb', line 9 def agents_email @agents_email end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
9 10 11 |
# File 'lib/weimark/client.rb', line 9 def email @email end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
9 10 11 |
# File 'lib/weimark/client.rb', line 9 def password @password end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/weimark/client.rb', line 9 def url @url end |
Instance Method Details
#get(application_id) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/weimark/client.rb', line 18 def get(application_id) request( http_method: :post, endpoint: url, body: { request: xml_request( action: "GetApplication", agents_email: agents_email, body: { applicationid: application_id } ) } ) end |
#post(application_attributes = {}) ⇒ Object
Sample application_attributes: ‘JONATHAN’, lname: ‘CONSUMER’, dob: ‘01/05/1987’, gender: ‘male’, ssn: ‘485774859’, streetnumber: ‘236’, streetname: ‘BIRCH’, streettype: ‘S’, city: ‘BURBANK’, country: ‘USA’, suite: ‘1TEST’, zip: ‘91502’
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/weimark/client.rb', line 36 def post(application_attributes = {}) request( http_method: :post, endpoint: url, body: { request: xml_request( action: "NewApplication", agents_email: agents_email, body: { applicant: application_attributes } ) } ) end |