Class: Scrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/app/scrapper.rb

Constant Summary collapse

WIKIPEDIA =
"https://en.wikipedia.org/wiki/"
@@pastel =
Pastel.new

Class Method Summary collapse

Class Method Details

.binancecoin_historyObject



45
46
47
# File 'lib/app/scrapper.rb', line 45

def self.binancecoin_history 
    webCryptoName("Binancecoin")
end

.bitcoin_gold_historyObject



81
82
83
# File 'lib/app/scrapper.rb', line 81

def self.bitcoin_gold_history 
   webCryptoName("Bitcoin_Gold")
end

.bitcoin_historyObject



37
38
39
# File 'lib/app/scrapper.rb', line 37

def self.bitcoin_history
    webCryptoName("Bitcoin")
end

.brief_history_title(coin_title) ⇒ Object



18
19
20
21
22
# File 'lib/app/scrapper.rb', line 18

def self.brief_history_title(coin_title)
    puts @@pastel.magenta.on_white.bold("
        A Brief on #{coin_title.upcase}...
        ")
end

.cardano_historyObject



49
50
51
# File 'lib/app/scrapper.rb', line 49

def self.cardano_history 
    webCryptoName("Cardano_(blockchain_platform)")
end

.decentraland_historyObject



77
78
79
# File 'lib/app/scrapper.rb', line 77

def self.decentraland_history 
    webCryptoName("Decentraland")
end

.dogecoin_historyObject



61
62
63
# File 'lib/app/scrapper.rb', line 61

def self.dogecoin_history 
    webCryptoName("Dogecoin")
end

.ethereum_historyObject



41
42
43
# File 'lib/app/scrapper.rb', line 41

def self.ethereum_history 
    webCryptoName("Ethereum")
end

.get_page(url) ⇒ Object



24
25
26
27
# File 'lib/app/scrapper.rb', line 24

def self.get_page(url)
    html = URI.open(url)
    doc = Nokogiri::HTML(html)
end

.iota_historyObject



85
86
87
# File 'lib/app/scrapper.rb', line 85

def self.iota_history 
    webCryptoName("IOTA_(technology)")
end

.litecoin_historyObject



73
74
75
# File 'lib/app/scrapper.rb', line 73

def self.litecoin_history 
    webCryptoName("Litecoin")
end

.loopring_historyObject



57
58
59
# File 'lib/app/scrapper.rb', line 57

def self.loopring_history 
    webCryptoName("Decentralized_finance")
end

.monero_historyObject



93
94
95
# File 'lib/app/scrapper.rb', line 93

def self.monero_history 
    webCryptoName("Monero")
end

.qtum_historyObject



65
66
67
# File 'lib/app/scrapper.rb', line 65

def self.qtum_history 
   webCryptoName("Quantum")
end

.ripple_historyObject



53
54
55
# File 'lib/app/scrapper.rb', line 53

def self.ripple_history 
    webCryptoName("Ripple_(payment_protocol)")
end

.stellar_historyObject



89
90
91
# File 'lib/app/scrapper.rb', line 89

def self.stellar_history 
  webCryptoName("Stellar_(payment_network)")
end

.text_iterator(scrapped_texts) ⇒ Object



29
30
31
32
33
34
# File 'lib/app/scrapper.rb', line 29

def self.text_iterator(scrapped_texts)
    scrapped_texts.each do |t|
        puts @@pastel.magenta.on_white.bold(" #{t.text}                   
            ")
    end
end

.tron_historyObject



69
70
71
# File 'lib/app/scrapper.rb', line 69

def self.tron_history 
    webCryptoName("Tron_(cryptocurrency)")
end

.webCryptoName(name) ⇒ Object



11
12
13
14
15
16
# File 'lib/app/scrapper.rb', line 11

def self.webCryptoName(name)
    doc = get_page("https://en.wikipedia.org/wiki/#{name}")
    history = doc.css("div.mw-body-content.mw-content-ltr div.mw-parser-output p")
    brief_history_title(name.upcase)
    text_iterator(history[0..5])
end