Class: Kishu::Sushi
Constant Summary
Constants included
from Base
Base::ES_HOST
Instance Method Summary
collapse
Methods included from Utils
#checksum, #clean_tmp, #encoded, #encoded_file, #format_instance, #generate_header_footer, #get_authors, #get_metadata, #merged_file
Instance Method Details
#clean_all ⇒ Object
20
21
22
23
24
|
# File 'lib/kishu/sushi.rb', line 20
def clean_all
x =Client.new()
x.clear_index
end
|
#elasticsearch_results ⇒ Object
71
72
73
74
75
76
|
# File 'lib/kishu/sushi.rb', line 71
def elasticsearch_results
es = Client.new()
es = es.get({aggs_size: 10, after_key: ""})
puts es.dig("hits","total")
puts "Aggregations:" + es.fetch("aggregations",[]).first.to_s
end
|
#generate ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/kishu/sushi.rb', line 47
def generate
report = Report.new(options)
report.generate
file = report.merged_file
File.open(file,"w") do |f|
f.write(JSON.pretty_generate report.get_template)
end
LOGGER.info "#{LOGS_TAG} Month of #{report.period.dig("begin-date")} with stats for #{report.total} datasets"
end
|
#push ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/kishu/sushi.rb', line 62
def push
fail "You need to set your JWT" if HUB_TOKEN.blank?
report = Report.new(options)
report.generate
report.send_report report.get_template
LOGGER.info "#{LOGS_TAG} Month of #{report.period.dig("begin-date")} sent to Hub in report #{report.uid} with stats for #{report.total} datasets"
end
|
#stream ⇒ Object
35
36
37
38
39
40
|
# File 'lib/kishu/sushi.rb', line 35
def stream
fail "You need to set your JWT" if HUB_TOKEN.blank?
report = Report.new(options)
report.generate_dataset_array
LOGGER.info "#{LOGS_TAG} Month of #{report.period.dig("begin-date")} sent to Hub in report #{report.uid} with stats for #{report.total} datasets"
end
|