Class: Satoshi::Graph
- Inherits:
-
Object
- Object
- Satoshi::Graph
- Defined in:
- lib/satoshi/graph.rb
Class Method Summary collapse
Class Method Details
.createGraphForCoin(ticker, type, timeframe) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/satoshi/graph.rb', line 3 def self.createGraphForCoin(ticker, type , timeframe) ticker = "iota" if ticker == "MIOTA" url = "https://cryptohistory.org/charts/#{type}/#{ticker.downcase}-usd/#{timeframe}/png" path = 'lib/satoshi/graph.png' begin File.write path, open(url).read rescue OpenURI::HTTPError puts "ERROR WITH TICKER FOR THAT COIN" else self.print_pic(path) end end |
.print_pic(path) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/satoshi/graph.rb', line 17 def self.print_pic(path) Catpix::print_image path, :limit_x => 0.8, :limit_y => 1.2, :center_x => true, :center_y => true, # :bg => "gray", # :bg_fill => true, :resolution => "high" end |