examples/historics/create-from-csdl.rb in datasift-2.0.1 vs examples/historics/create-from-csdl.rb in datasift-2.0.2
- old
+ new
@@ -9,22 +9,22 @@
# Function to display usage instructions with an optional error message.
def usage(message = '', end_of_story = true)
puts message + '\n' unless message.length() == 0
puts
puts 'Usage: create-from-csdl <username> <api_key> \\'
- puts ' <csdl_filename> <start> <end> <sources> <name> <sample>'
+ puts ' <csdl_filename> <start> <end> <sources> <sample> <name>'
puts
puts 'Where: csdl_filename = the stream hash the query should run'
puts ' start = the start date for the query (YYYYMMDDHHMMSS)'
puts ' end = the end date for the query (YYYYMMDDHHMMSS)'
puts ' sources = comma separated list of data sources (e.g. twitter)'
- puts ' name = a friendly name for the query'
puts ' sample = the sample rate'
+ puts ' name = a friendly name for the query'
puts
puts 'Example'
puts ' create-from-csdl csdl.txt 20120101000000 20120101235959 \\'
- puts ' twitter HistoricsQuery123 100'
+ puts ' twitter 100 HistoricsQuery123'
puts
exit 1 unless not end_of_story
end
# Include the shared Env class
@@ -40,12 +40,12 @@
# Read the arguments
csdl_filename = env.args[0]
start_date = env.args[1]
end_date = env.args[2]
sources = env.args[3].split(',')
-name = env.args[4]
-sample = env.args[5]
+sample = env.args[4]
+name = env.args[5]
# Parse the dates
start_date = DateTime.strptime(start_date, '%Y%m%d%H%M%S')
end_date = DateTime.strptime(end_date, '%Y%m%d%H%M%S')
@@ -55,10 +55,10 @@
begin
# Create the definition
definition = env.user.createDefinition(csdl)
# Create the Historics query
- historic = definition.createHistoric(start_date, end_date, sources, name, sample)
+ historic = definition.createHistoric(start_date, end_date, sources, sample, name)
# Prepare the query
historic.prepare()
# Display the details