Class: DataDuck::Optimizely::Projects
Instance Attribute Summary
Attributes inherited from Table
#data, #errors
Instance Method Summary
collapse
#optimizely_api_token, #should_fully_reload?
Methods inherited from Table
#actions, #batch_size, #building_name, #check_table_valid!, #distribution_key, #etl!, #extract_by_clause, #extract_by_column, #extract_query, #include_with_all?, #limit_clause, #load!, #name, output, #output_column_names, #output_schema, #prefix, #recreate!, #should_fully_reload?, #show, source, #staging_name, #transform!, transforms, validates
Instance Method Details
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/integrations/optimizely/projects.rb', line 12
def (destination, options = {})
self.data = []
now = DateTime.now
response = Typhoeus.get("https://www.optimizelyapis.com/experiment/v1/projects", headers: {'Token' => self.optimizely_api_token})
self.data = Oj.load(response.body)
self.data.each do |project|
project[:dataduck_extracted_at] = now
end
end
|
#indexes ⇒ Object
24
25
26
|
# File 'lib/integrations/optimizely/projects.rb', line 24
def indexes
["id", "account_id", "project_name"]
end
|
#parse_datetimes ⇒ Object
28
29
30
31
|
# File 'lib/integrations/optimizely/projects.rb', line 28
def parse_datetimes
project["created"] = DateTime.parse(project["created"])
project["last_modified"] = DateTime.parse(project["last_modified"])
end
|