etht 0.1.6 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/Gemfile.lock +3 -3
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/lib/etht/bigquery.rb +22 -19
- data/lib/etht/carteiras.rb +0 -1
- data/lib/etht/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3684c2c8ef10db43c6a2ef339ff4066bf3937198c497f9f6e7d2b8f67889a606
         | 
| 4 | 
            +
              data.tar.gz: 5885a6b55577b25fbb5437b293f69e4a6cefe2e863a5063aca2ebc7ab3c67d1f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 11d672fb263089adc466c30541af7b3218f581d960b2ddc6128e2ddbb958d8c349e70db972f8c569fc8d169d5ebf0c34afb43eab289682453d0315fcfa441360
         | 
| 7 | 
            +
              data.tar.gz: b3ccdf480d22be07f6680362b9ca392821fb0cb29eec8851175c0edd938e84b958f4b5b2cdcbd26bafdb65e742165b87d6bc1c79e58f0bd6094ad3826743439e
         | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                etht (0.1. | 
| 4 | 
            +
                etht (0.1.11)
         | 
| 5 5 | 
             
                  faraday
         | 
| 6 6 | 
             
                  google-cloud-bigquery
         | 
| 7 7 | 
             
                  json
         | 
| @@ -18,7 +18,7 @@ GEM | |
| 18 18 | 
             
                declarative-option (0.1.0)
         | 
| 19 19 | 
             
                faraday (1.0.1)
         | 
| 20 20 | 
             
                  multipart-post (>= 1.2, < 3)
         | 
| 21 | 
            -
                google-api-client (0. | 
| 21 | 
            +
                google-api-client (0.44.0)
         | 
| 22 22 | 
             
                  addressable (~> 2.5, >= 2.5.1)
         | 
| 23 23 | 
             
                  googleauth (~> 0.9)
         | 
| 24 24 | 
             
                  httpclient (>= 2.8.1, < 3.0)
         | 
| @@ -53,7 +53,7 @@ GEM | |
| 53 53 | 
             
                multi_json (1.15.0)
         | 
| 54 54 | 
             
                multipart-post (2.1.1)
         | 
| 55 55 | 
             
                os (1.1.1)
         | 
| 56 | 
            -
                public_suffix (4.0. | 
| 56 | 
            +
                public_suffix (4.0.6)
         | 
| 57 57 | 
             
                rake (12.3.3)
         | 
| 58 58 | 
             
                representable (3.0.4)
         | 
| 59 59 | 
             
                  declarative (< 0.1.0)
         | 
    
        data/README.md
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/etht/bigquery.rb
    CHANGED
    
    | @@ -15,6 +15,8 @@ module Etht | |
| 15 15 | 
             
                attr_reader :job
         | 
| 16 16 | 
             
                # @return [Thor::CoreExt::HashWithIndifferentAccess] opcoes trabalho
         | 
| 17 17 | 
             
                attr_reader :ops
         | 
| 18 | 
            +
                # @return (see sql)
         | 
| 19 | 
            +
                attr_reader :sqr
         | 
| 18 20 |  | 
| 19 21 | 
             
                # @param [Thor::CoreExt::HashWithIndifferentAccess] pop opcoes trabalho
         | 
| 20 22 | 
             
                # @option pop [Hash] :h ({}) configuracao ajuste reposicionamento temporal
         | 
| @@ -56,19 +58,19 @@ module Etht | |
| 56 58 | 
             
                def etht_ins
         | 
| 57 59 | 
             
                  "insert #{BD}.etht(blocknumber,timestamp,txhash,nonce,blockhash,transactionindex,axfrom,axto,value,gas," \
         | 
| 58 60 | 
             
                  'gasprice,iserror,txreceipt_status,input,contractaddress,cumulativegasused,gasused,confirmations,dias' \
         | 
| 59 | 
            -
                  ") VALUES | 
| 61 | 
            +
                  ") VALUES#{transacoes.norml.map { |e| etht_val1(e) }.join(',')}"
         | 
| 60 62 | 
             
                end
         | 
| 61 63 |  | 
| 62 64 | 
             
                # @return [String] comando insert SQL formatado ethk (trx token)
         | 
| 63 65 | 
             
                def ethk_ins
         | 
| 64 66 | 
             
                  "insert #{BD}.ethk(blocknumber,timestamp,txhash,nonce,blockhash,axfrom,contractaddress,axto,value,tokenname," \
         | 
| 65 67 | 
             
                  'tokensymbol,tokendecimal,transactionindex,gas,gasprice,gasused,cumulativegasused,input,confirmations,dias' \
         | 
| 66 | 
            -
                  ") VALUES | 
| 68 | 
            +
                  ") VALUES#{transacoes.token.map { |e| ethk_val1(e) }.join(',')}"
         | 
| 67 69 | 
             
                end
         | 
| 68 70 |  | 
| 69 71 | 
             
                # @return [String] valores formatados etht (trx normais parte1)
         | 
| 70 72 | 
             
                def etht_val1(hes)
         | 
| 71 | 
            -
                  "#{Integer(hes['blockNumber'])}," \
         | 
| 73 | 
            +
                  "(#{Integer(hes['blockNumber'])}," \
         | 
| 72 74 | 
             
                  "#{Integer(hes['timeStamp'])}," \
         | 
| 73 75 | 
             
                  "'#{hes['hash']}'," \
         | 
| 74 76 | 
             
                  "#{Integer(hes['nonce'])}," \
         | 
| @@ -94,12 +96,12 @@ module Etht | |
| 94 96 | 
             
                def etht_val3(hes)
         | 
| 95 97 | 
             
                  "#{hes['contractAddress'].length.zero? ? 'null' : "'#{hes['contractAddress']}'"}," \
         | 
| 96 98 | 
             
                  "0,cast('#{hes['gasUsed']}' as numeric),0," \
         | 
| 97 | 
            -
                  "#{Integer(ops[:h][hes['blockNumber']] || 0)}"
         | 
| 99 | 
            +
                  "#{Integer(ops[:h][hes['blockNumber']] || 0)})"
         | 
| 98 100 | 
             
                end
         | 
| 99 101 |  | 
| 100 102 | 
             
                # @return [String] valores formatados ethk (trx token parte1)
         | 
| 101 103 | 
             
                def ethk_val1(hes)
         | 
| 102 | 
            -
                  "#{Integer(hes['blockNumber'])}," \
         | 
| 104 | 
            +
                  "(#{Integer(hes['blockNumber'])}," \
         | 
| 103 105 | 
             
                  "#{Integer(hes['timeStamp'])}," \
         | 
| 104 106 | 
             
                  "'#{hes['hash']}'," \
         | 
| 105 107 | 
             
                  "#{Integer(hes['nonce'])}," \
         | 
| @@ -126,34 +128,35 @@ module Etht | |
| 126 128 | 
             
                  "cast('#{hes['gasPrice']}' as numeric)," \
         | 
| 127 129 | 
             
                  "cast('#{hes['gasUsed']}' as numeric),0," \
         | 
| 128 130 | 
             
                  "#{hes['input'].length.zero? ? 'null' : "'#{hes['input']}'"},0," \
         | 
| 129 | 
            -
                  "#{Integer(ops[:h][hes['blockNumber']] || 0)}"
         | 
| 131 | 
            +
                  "#{Integer(ops[:h][hes['blockNumber']] || 0)})"
         | 
| 130 132 | 
             
                end
         | 
| 131 133 |  | 
| 132 134 | 
             
                # cria job bigquery & verifica execucao
         | 
| 133 135 | 
             
                #
         | 
| 134 | 
            -
                # @param  | 
| 136 | 
            +
                # @param cmd (see sql)
         | 
| 135 137 | 
             
                # @return [Boolean] job ok?
         | 
| 136 | 
            -
                def job?( | 
| 137 | 
            -
                  @job = api.query_job( | 
| 138 | 
            +
                def job?(cmd)
         | 
| 139 | 
            +
                  @job = api.query_job(cmd)
         | 
| 138 140 | 
             
                  @job.wait_until_done!
         | 
| 139 141 | 
             
                  puts(@job.error['message']) if @job.failed?
         | 
| 140 142 | 
             
                  @job.failed?
         | 
| 141 143 | 
             
                end
         | 
| 142 144 |  | 
| 143 | 
            -
                # cria  | 
| 145 | 
            +
                # cria Structured Query Language (SQL) job bigquery
         | 
| 144 146 | 
             
                #
         | 
| 145 | 
            -
                # @param  | 
| 146 | 
            -
                # @ | 
| 147 | 
            -
                 | 
| 148 | 
            -
             | 
| 147 | 
            +
                # @param [String] cmd comando SQL a executar
         | 
| 148 | 
            +
                # @param [String] red resultado quando SQL tem erro
         | 
| 149 | 
            +
                # @return [Google::Cloud::Bigquery::Data] resultado do SQL
         | 
| 150 | 
            +
                def sql(cmd, red = [])
         | 
| 151 | 
            +
                  @sqr = job?(cmd) ? red : job.data
         | 
| 149 152 | 
             
                end
         | 
| 150 153 |  | 
| 151 | 
            -
                # cria  | 
| 154 | 
            +
                # cria Data Manipulation Language (DML) job bigquery
         | 
| 152 155 | 
             
                #
         | 
| 153 | 
            -
                # @param (see  | 
| 154 | 
            -
                # @return [ | 
| 155 | 
            -
                def  | 
| 156 | 
            -
                  job?( | 
| 156 | 
            +
                # @param cmd (see sql)
         | 
| 157 | 
            +
                # @return [Integer] numero linhas afetadas
         | 
| 158 | 
            +
                def dml(cmd)
         | 
| 159 | 
            +
                  job?(cmd) ? 0 : job.num_dml_affected_rows
         | 
| 157 160 | 
             
                end
         | 
| 158 161 | 
             
              end
         | 
| 159 162 | 
             
            end
         | 
    
        data/lib/etht/carteiras.rb
    CHANGED
    
    
    
        data/lib/etht/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: etht
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.11
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Hernâni Rodrigues Vaz
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 11 | 
            +
            date: 2020-09-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -119,6 +119,7 @@ extra_rdoc_files: [] | |
| 119 119 | 
             
            files:
         | 
| 120 120 | 
             
            - ".gitignore"
         | 
| 121 121 | 
             
            - ".rubocop.yml"
         | 
| 122 | 
            +
            - ".travis.yml"
         | 
| 122 123 | 
             
            - CODE_OF_CONDUCT.md
         | 
| 123 124 | 
             
            - Gemfile
         | 
| 124 125 | 
             
            - Gemfile.lock
         |