Class: DataDuck::SEMRush::OrganicResults
Instance Attribute Summary
Attributes inherited from Table
#data, #errors
Instance Method Summary
collapse
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, #recreate!, #should_fully_reload?, #show, source, #staging_name, #transform!, transforms, validates
Instance Method Details
#display_limit ⇒ Object
6
7
8
|
# File 'lib/integrations/semrush/organic_results.rb', line 6
def display_limit
25
end
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/integrations/semrush/organic_results.rb', line 26
def (destination, options = {})
dates = options[:dates]
if dates.nil? || dates.length == 0
raise Exception("Must pass at least one date.")
end
self.data = []
self.phrases.each do |phrase|
self.dates.each do |date|
self.extract_results_for_keyword_and_date!(phrase, date)
end
end
end
|
#extract_results_for_keyword_and_date!(phrase, date) ⇒ Object
41
42
43
44
|
# File 'lib/integrations/semrush/organic_results.rb', line 41
def extract_results_for_keyword_and_date!(phrase, date)
response = Typhoeus.get("http://api.semrush.com/?type=phrase_organic&key=#{ self.key }&display_limit=#{ self.display_limit }&export_columns=Dn,Ur&phrase=#{ phrase }&database=#{ self.search_database }")
end
|
#indexes ⇒ Object
46
47
48
|
# File 'lib/integrations/semrush/organic_results.rb', line 46
def indexes
["date", "phrase", "domain"]
end
|
#key ⇒ Object
10
11
12
|
# File 'lib/integrations/semrush/organic_results.rb', line 10
def key
ENV['semrush_api_key']
end
|
#phrases ⇒ Object
14
15
16
|
# File 'lib/integrations/semrush/organic_results.rb', line 14
def phrases
raise Exception("Must implement phrases method to be an array of the phrases you want.")
end
|
#prefix ⇒ Object
18
19
20
|
# File 'lib/integrations/semrush/organic_results.rb', line 18
def prefix
"semrush_"
end
|
#search_database ⇒ Object
22
23
24
|
# File 'lib/integrations/semrush/organic_results.rb', line 22
def search_database
'us'
end
|