Skip to content

Instantly share code, notes, and snippets.

@kobeumut
Created December 17, 2017 20:53
Show Gist options
  • Save kobeumut/54e8abc77c7468bedfc65457fab5e19f to your computer and use it in GitHub Desktop.
Save kobeumut/54e8abc77c7468bedfc65457fab5e19f to your computer and use it in GitHub Desktop.
require 'rufus-scheduler'
require 'uri'
require 'net/http'
require 'openssl'
require 'json'
def getir
url = URI("https://koineks.com/ticker")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
sonuc = JSON.parse(response.body)
print("ekleniyor")
gonder(sonuc['BTC']['current'],sonuc['ETH']['current'],sonuc['LTC']['current'],sonuc['DASH']['current'])
end
def gonder(btc,eth,ltc,dash)
url = URI("https://script.google.com/macros/s/AKfycbx2BTTNvEX4W3SCGw2PqrdaIr4VLYkuwvzbDgsPchlPU4CSF8M/exec?id=1rpPAa__KLbFCJRLmZ3llsdBsBZQL4NkgQaXldoKn_m4&sheet=Koineks&miktar=#{btc},#{eth},#{ltc},#{dash}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
response = http.request(request)
print(response.read_body)
end
scheduler = Rufus::Scheduler.new
scheduler.every '15m' do
getir
end
scheduler.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment