Class: GolosCloud::Connection

Inherits:
SqlBase
  • Object
show all
Defined in:
lib/golos_cloud/models/connection.rb

Class Method Summary collapse

Methods inherited from SqlBase

#tx

Class Method Details

.columns(model_name) ⇒ Object



28
29
30
# File 'lib/golos_cloud/models/connection.rb', line 28

def self.columns(model_name)
  "GolosCloud::#{model_name}".constantize.columns.map(&:name)
end

.steem_per_mvestsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/golos_cloud/models/connection.rb', line 9

def self.steem_per_mvests
  begin
    # SteemDollar.com (fastest)
    steemdollar_response = RestClient::Request.execute(method: :get, url: "https://www.steemdollar.com/vests.php", timeout: 3, open_timeout: 3).body
    Nokogiri::XML.parse(steemdollar_response).css('.text-intro')[2].text.match(/1\s*VESTS\s*=\s*(\d*\.\d*)/)[1]

    # Steemd.com
    # steemd_response = RestClient::Request.execute(method: :get, url: "https://steemd.com", timeout: 3, open_timeout: 3).body
    # Nokogiri::XML.parse(steemd_response).css('.hash3').first.text.match(/^steem_per_mvests(\d*.\d*)/)[1]
  rescue => e
    Rails.logger.error("Error: #{e}")
    Settings.steem_per_mvests
  end
end

.tablesObject



24
25
26
# File 'lib/golos_cloud/models/connection.rb', line 24

def self.tables
  self.connection.tables
end