lib/etht/bigquery.rb in etht-0.1.3 vs lib/etht/bigquery.rb in etht-0.1.4
- old
+ new
@@ -1,27 +1,20 @@
# frozen_string_literal: true
-require 'etherscan'
require 'google/cloud/bigquery'
-# config/initializers/etherscan.rb
-Etherscan.configure do |config|
- config.key = 'QA14GAMNM3AJIX8IEGA8MHEHBHJDTDSBPX'
-end
-
+# @author Hernani Rodrigues Vaz
module Etht
DF = '%Y-%m-%d'
DI = '%Y-%m-%d %H:%M:%S'
# (see Bigquery)
class Bigquery
# @return [Google::Cloud::Bigquery] API bigquery
attr_reader :apibq
- # @return [Roo::CSV] folha calculo a processar
- attr_reader :folha
- # @return [Hash<Symbol, Boolean>] opcoes trabalho com linhas
- attr_reader :linha
+ # @return [Etherscan::Api] API etherscan
+ attr_reader :apies
# @return [Array] row folha calculo em processamento
attr_reader :row
# @return [Google::Cloud::Bigquery::QueryJob] job bigquery
attr_reader :job
@@ -32,15 +25,20 @@
# @param [Hash<Symbol, Boolean>] ops opcoes trabalho com linhas
# @option ops [Boolean] :e (false) apaga linha igual?
# @option ops [Boolean] :m (false) apaga linhas existencia multipla?
# @option ops [Boolean] :i (false) insere linha nova?
# @return [Bigquery] acesso folhas calculo bloks.io & correspondente bigquery dataset
- def initialize(csv = '', ops = { e: false, m: false, i: false })
+ def initialize(ops = { e: false, m: false, i: false })
# usa env GOOGLE_APPLICATION_CREDENTIALS para obter credentials
# @see https://cloud.google.com/bigquery/docs/authentication/getting-started
@apibq = Google::Cloud::Bigquery.new
- @folha = Roo::CSV.new(csv) if csv.size.positive?
+ @apies = Etht::Accounts.new
@linha = ops
+ end
+
+ def processa_eth
+ contract_address = '0xfc325129a11fab241287e42a9f04a74f14077b77'
+ p apies.normal_transactions(contract_address)
end
# cria job bigquery & verifica execucao
#
# @param [String] sql a executar