Class: HealthTools::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/health_tools/service.rb

Instance Method Summary collapse

Instance Method Details

#get_checksumObject



21
22
23
# File 'lib/health_tools/service.rb', line 21

def get_checksum
  Digest::SHA2.hexdigest(set_content.to_s)
end

#reply_healthObject



4
5
6
7
8
# File 'lib/health_tools/service.rb', line 4

def reply_health
  data = set_content
  data.store("checksum", get_checksum)
  HTTParty.post(ENV['api_url'], body: data)
end

#set_contentObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/health_tools/service.rb', line 10

def set_content
  {
      "service_code" => ENV['service_code'],
      "action_name" => "check",
      "start_time" =>  DateTime.now.strftime("%d/%m/%Y %H:%M"),
      "status_code" => "200",
      "value" => "1",
      "note" => "cool",
  }
end