add config

This commit is contained in:
Alexander Popov 2022-09-03 22:48:12 +03:00
parent 86b6f75eb7
commit 94480744c1
Signed by: iiiypuk
GPG Key ID: D8C9B59A9F04A70C
3 changed files with 10 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
lib/
config.yml

3
config.example.yml Normal file
View File

@ -0,0 +1,3 @@
---
sms.ru:
api_id: F1FC9A76-1408-E4CF-1F89-E7CC756762B6

View File

@ -1,6 +1,10 @@
require "yaml"
require "http/client" require "http/client"
CONFIG = File.open("./config.yml") { |file| YAML.parse(file) }
CONFIG.class
get "/api/v1.0/smsru_status" do get "/api/v1.0/smsru_status" do
response = HTTP::Client.get "https://sms.ru/my/free?api_id=F1FC9A76-1408-E4CF-1F89-E7CC756762B6&json=1" response = HTTP::Client.get "https://sms.ru/my/free?api_id=#{CONFIG["sms.ru"]["api_id"]}&json=1"
response.body response.body
end end