Class: Cns::Bigquery
- Inherits:
-
Object
- Object
- Cns::Bigquery
- Defined in:
- lib/cns/bigquery.rb
Overview
classe para processar bigquery
Instance Attribute Summary collapse
-
#api ⇒ Google::Cloud::Bigquery
readonly
API bigquery.
-
#job ⇒ Google::Cloud::Bigquery::QueryJob
readonly
Job bigquery.
-
#ops ⇒ Thor::CoreExt::HashWithIndifferentAccess
readonly
Opcoes trabalho.
-
#sqr ⇒ Google::Cloud::Bigquery::Data
readonly
Resultado do SQL.
Instance Method Summary collapse
-
#initialize(pop) ⇒ Bigquery
constructor
API bigquery.
-
#mostra_seth ⇒ Object
mostra situacao completa entre etherscan & bigquery.
-
#mostra_skrk ⇒ Object
mostra situacao completa entre kraken/etherscan & bigquery.
-
#mostra_tudo ⇒ Object
mostra situacao completa entre kraken/bitcoinde/paymium/therock/etherscan/greymass/beaconchain & bigquery.
-
#processa_ceth ⇒ Object
insere (caso existam) dados novos etherscan no bigquery (output to file).
-
#processa_tudo ⇒ Object
insere (caso existam) dados novos kraken/bitcoinde/paymium/therock/etherscan/greymass/beaconchain no bigquery.
-
#processa_weth ⇒ Object
insere (caso existam) dados novos etherscan no bigquery.
-
#processa_wkrk ⇒ Object
insere (caso existam) dados novos kraken/etherscan no bigquery.
-
#trs_ini ⇒ String
Texto inicial transacoes.
Constructor Details
#initialize(pop) ⇒ Bigquery
Returns API bigquery.
27 28 29 30 31 32 |
# File 'lib/cns/bigquery.rb', line 27 def initialize(pop) # usa env GOOGLE_APPLICATION_CREDENTIALS para obter credentials # @see https://cloud.google.com/bigquery/docs/authentication/getting-started @api = Google::Cloud::Bigquery.new @ops = pop end |
Instance Attribute Details
#api ⇒ Google::Cloud::Bigquery (readonly)
Returns API bigquery.
14 15 16 |
# File 'lib/cns/bigquery.rb', line 14 def api @api end |
#job ⇒ Google::Cloud::Bigquery::QueryJob (readonly)
Returns job bigquery.
16 17 18 |
# File 'lib/cns/bigquery.rb', line 16 def job @job end |
#ops ⇒ Thor::CoreExt::HashWithIndifferentAccess (readonly)
Returns opcoes trabalho.
18 19 20 |
# File 'lib/cns/bigquery.rb', line 18 def ops @ops end |
#sqr ⇒ Google::Cloud::Bigquery::Data (readonly)
Returns resultado do SQL.
20 21 22 |
# File 'lib/cns/bigquery.rb', line 20 def sqr @sqr end |
Instance Method Details
#mostra_seth ⇒ Object
mostra situacao completa entre etherscan & bigquery
52 53 54 |
# File 'lib/cns/bigquery.rb', line 52 def mostra_seth apies.mostra_resumo end |
#mostra_skrk ⇒ Object
mostra situacao completa entre kraken/etherscan & bigquery
46 47 48 49 |
# File 'lib/cns/bigquery.rb', line 46 def mostra_skrk apius.mostra_resumo apies.mostra_resumo end |
#mostra_tudo ⇒ Object
mostra situacao completa entre kraken/bitcoinde/paymium/therock/etherscan/greymass/beaconchain & bigquery
35 36 37 38 39 40 41 42 43 |
# File 'lib/cns/bigquery.rb', line 35 def mostra_tudo apius.mostra_resumo apide.mostra_resumo #apifr.mostra_resumo #apimt.mostra_resumo apies.mostra_resumo apigm.mostra_resumo #apibc.mostra_resumo end |
#processa_ceth ⇒ Object
insere (caso existam) dados novos etherscan no bigquery (output to file)
80 81 82 83 |
# File 'lib/cns/bigquery.rb', line 80 def processa_ceth str = processa_ethc File.open(FO, mode: 'a') { |out| out.puts(trs_ini + str) } end |
#processa_tudo ⇒ Object
insere (caso existam) dados novos kraken/bitcoinde/paymium/therock/etherscan/greymass/beaconchain no bigquery
62 63 64 65 |
# File 'lib/cns/bigquery.rb', line 62 def processa_tudo str = processa_us + ", " + processa_de + ", " + processa_eth + ", " + processa_eos puts(trs_ini + str) end |
#processa_weth ⇒ Object
insere (caso existam) dados novos etherscan no bigquery
74 75 76 77 |
# File 'lib/cns/bigquery.rb', line 74 def processa_weth str = processa_eth puts(trs_ini + str) end |
#processa_wkrk ⇒ Object
insere (caso existam) dados novos kraken/etherscan no bigquery
68 69 70 71 |
# File 'lib/cns/bigquery.rb', line 68 def processa_wkrk str = processa_us + ", " + processa_eth puts(trs_ini + str) end |
#trs_ini ⇒ String
Returns texto inicial transacoes.
57 58 59 |
# File 'lib/cns/bigquery.rb', line 57 def trs_ini Time.now.strftime("TRANSACOES %Y-%m-%d %H:%M:%S ") end |