Class: TokiServer

Inherits:
Sinatra::Application
  • Object
show all
Defined in:
lib/TokiServer/tokiserver.rb

Instance Method Summary collapse

Instance Method Details

#basic_titleObject



372
373
374
# File 'lib/TokiServer/tokiserver.rb', line 372

def basic_title
  "Total"
end

#sort_log(resp) ⇒ Object



359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/TokiServer/tokiserver.rb', line 359

def sort_log resp
  bucket, net = [], {}
  resp['data']['log'].each do |id, content|
    bucket << [id, content]
  end
  bucket.sort_by! {|id, content| content['start']}
  bucket.each do |id, content|
    net[id] = content
  end
  resp['data']['log'] = net
  resp
end

#top(resp, tk) ⇒ Object



87
88
89
90
91
92
93
94
# File 'lib/TokiServer/tokiserver.rb', line 87

def top resp, tk
  if resp['meta']['code'] == 200
    title = 'Top'
    erb :apps_total, locals: {tk: tk, title: title, resp: resp}
  else
    erb :error, locals: {resp: resp, message: 'No data for this request'}
  end
end