Class: Entrata::TestClient
- Inherits:
-
Object
- Object
- Entrata::TestClient
- Defined in:
- lib/entrata/test_client.rb
Overview
TestClient is meant to be substituted for the real Client by consuming apps
during test. It matches the interface of the real Client and can return
successful or failure responses by providing special input params. See
comments below or docs for specifics.
Class Method Summary collapse
-
.get_access_token(auth_code:, client_id:, client_secret:, conn: nil) ⇒ Object
Fails when auth_code == ‘fail’.
-
.get_client_info(token, conn: nil) ⇒ Object
Fails when token == ‘fail’.
Instance Method Summary collapse
-
#get_ils_properties_data(property_ids) ⇒ Object
Fails when property_ids includes at lease one value == ‘fail’.
-
#get_property_info(property_id) ⇒ Object
Fails when property_id == ‘fail’.
- #inactive_lead_request_body(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) ⇒ Object
-
#initialize(subdomain:, token:) ⇒ TestClient
constructor
A new instance of TestClient.
- #lead_details_request_body(customer:, preferences:, property_id:) ⇒ Object
-
#process_property_activation(property_id, activation_status: 'approve') ⇒ Object
Fails when property_id == ‘fail’.
- #reactivate_lead_request_body(applicant_id:, application_id:, customer:, preferences:, property_id:) ⇒ Object
- #send_general_leads(customer:, lead_source_id:, preferences:, property_id:) ⇒ Object
- #send_inactive_leads(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) ⇒ Object
- #send_lead_details(customer:, preferences:, property_id:) ⇒ Object
- #send_reactivate_leads(applicant_id:, application_id:, customer:, preferences:, property_id:) ⇒ Object
Constructor Details
#initialize(subdomain:, token:) ⇒ TestClient
Returns a new instance of TestClient.
17 |
# File 'lib/entrata/test_client.rb', line 17 def initialize(subdomain:, token:); end |
Class Method Details
.get_access_token(auth_code:, client_id:, client_secret:, conn: nil) ⇒ Object
Fails when auth_code == ‘fail’
21 22 23 24 25 26 27 |
# File 'lib/entrata/test_client.rb', line 21 def get_access_token(auth_code:, client_id:, client_secret:, conn: nil) if auth_code == 'fail' raise Entrata::Request::Error, 'TestClient forced error' else StaticFileFetcher.parsed_response_for('get_access_token') end end |
.get_client_info(token, conn: nil) ⇒ Object
Fails when token == ‘fail’
30 31 32 33 34 35 36 |
# File 'lib/entrata/test_client.rb', line 30 def get_client_info(token, conn: nil) if token == 'fail' raise Entrata::Request::Error, 'TestClient forced error' else StaticFileFetcher.parsed_response_for('get_client_info') end end |
Instance Method Details
#get_ils_properties_data(property_ids) ⇒ Object
Fails when property_ids includes at lease one value == ‘fail’
52 53 54 55 |
# File 'lib/entrata/test_client.rb', line 52 def get_ils_properties_data(property_ids) raise_forced_failure! if property_ids.include?('fail') StaticFileFetcher.parsed_response_for('get_ils_properties_data') end |
#get_property_info(property_id) ⇒ Object
Fails when property_id == ‘fail’
40 41 42 43 |
# File 'lib/entrata/test_client.rb', line 40 def get_property_info(property_id) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('get_property_info') end |
#inactive_lead_request_body(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) ⇒ Object
77 78 79 80 |
# File 'lib/entrata/test_client.rb', line 77 def inactive_lead_request_body(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('inactive_lead_request_body') end |
#lead_details_request_body(customer:, preferences:, property_id:) ⇒ Object
87 88 89 90 |
# File 'lib/entrata/test_client.rb', line 87 def lead_details_request_body(customer:, preferences:, property_id:) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('lead_details_request_body') end |
#process_property_activation(property_id, activation_status: 'approve') ⇒ Object
Fails when property_id == ‘fail’
46 47 48 49 |
# File 'lib/entrata/test_client.rb', line 46 def process_property_activation(property_id, activation_status: 'approve') raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('process_property_activation') end |
#reactivate_lead_request_body(applicant_id:, application_id:, customer:, preferences:, property_id:) ⇒ Object
82 83 84 85 |
# File 'lib/entrata/test_client.rb', line 82 def reactivate_lead_request_body(applicant_id:, application_id:, customer:, preferences:, property_id:) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('reactivate_lead_request_body') end |
#send_general_leads(customer:, lead_source_id:, preferences:, property_id:) ⇒ Object
67 68 69 70 |
# File 'lib/entrata/test_client.rb', line 67 def send_general_leads(customer:, lead_source_id:, preferences:, property_id:) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('send_general_leads') end |
#send_inactive_leads(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) ⇒ Object
62 63 64 65 |
# File 'lib/entrata/test_client.rb', line 62 def send_inactive_leads(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('send_inactive_leads') end |
#send_lead_details(customer:, preferences:, property_id:) ⇒ Object
57 58 59 60 |
# File 'lib/entrata/test_client.rb', line 57 def send_lead_details(customer:, preferences:, property_id:) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('send_lead_details') end |
#send_reactivate_leads(applicant_id:, application_id:, customer:, preferences:, property_id:) ⇒ Object
72 73 74 75 |
# File 'lib/entrata/test_client.rb', line 72 def send_reactivate_leads(applicant_id:, application_id:, customer:, preferences:, property_id:) raise_forced_failure! if property_id == 'fail' StaticFileFetcher.parsed_response_for('send_reactivate_leads') end |