Class: Yardi::Utils::TestDataFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/yardi/utils/test_data_fetcher.rb

Constant Summary collapse

RESIDENTS_PATH =
'test_data/residents/'
GUESTCARD_ACTIVITY_PATH =
'test_data/yardi_prospects/'

Class Method Summary collapse

Class Method Details

.guest_card_activity(property_id, prospect) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/yardi/utils/test_data_fetcher.rb', line 13

def self.guest_card_activity(property_id, prospect)
  search_by = case prospect
              when -> (p) { p.yardi_prospect_id }
                { '/prospect_id/' => prospect.yardi_prospect_id }
              when -> (p) { p.email }
                { '/email/' => prospect.email.gsub(/\./,'') }
              when -> (p) { p.first_name } && -> (p) { p.last_name }
                { '/name/' => prospect.first_name + ' ' + prospect.last_name }
              when -> (p) { p.phone }
                { '/phone/' => prospect.phone }
              end 

  file_path = GUESTCARD_ACTIVITY_PATH + property_id.to_s + search_by.keys.first + search_by[search_by.keys.first] + '.xml'
  GoogleCloudStorage.read_file(file_path: file_path)
end

.residents(property_id) ⇒ Object



9
10
11
# File 'lib/yardi/utils/test_data_fetcher.rb', line 9

def self.residents(property_id)
  GoogleCloudStorage.read_file(file_path: RESIDENTS_PATH + "#{property_id}.xml")
end