Class: Evva::GoogleSheet

Inherits:
Object
  • Object
show all
Defined in:
lib/evva/google_sheet.rb

Instance Method Summary collapse

Constructor Details

#initialize(events_url, people_properties_url, enum_classes_url) ⇒ GoogleSheet



6
7
8
9
10
# File 'lib/evva/google_sheet.rb', line 6

def initialize(events_url, people_properties_url, enum_classes_url)
  @events_url = events_url
  @people_properties_url = people_properties_url
  @enum_classes_url = enum_classes_url
end

Instance Method Details

#enum_classesObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/evva/google_sheet.rb', line 37

def enum_classes
  Logger.info("Downloading data from Google Sheet at #{@enum_classes_url}")
  csv = get_csv(@enum_classes_url)

  enum_list = []
  csv.each do |row|
    enum_name = row['Enum Name']
    values = row['Possible Values'].split(',')
    enum_list << Evva::MixpanelEnum.new(enum_name, values)
  end
  enum_list
end

#eventsObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/evva/google_sheet.rb', line 12

def events
  Logger.info("Downloading data from Google Sheet at #{@events_url}")
  csv = get_csv(@events_url)

  event_list = []
  csv.each do |row|
    event_name = row['Event Name']
    properties = hash_parser(row['Event Properties'])
    event_list << Evva::MixpanelEvent.new(event_name, properties)
  end
  event_list
end

#people_propertiesObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/evva/google_sheet.rb', line 25

def people_properties
  Logger.info("Downloading data from Google Sheet at #{@people_properties_url}")
  csv = get_csv(@people_properties_url)

  people_list = []
  csv.each do |row|
    value = row['Property Name']
    people_list << value
  end
  people_list
end