Created
December 17, 2017 20:53
-
-
Save kobeumut/54e8abc77c7468bedfc65457fab5e19f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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