arquivo 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +20 -6
- data/arquivo.gemspec +1 -0
- data/lib/arquivo.rb +6 -0
- data/lib/arquivo/dir.rb +16 -3
- data/lib/arquivo/noise.rb +3 -0
- data/lib/arquivo/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21339beec18ea834dfa2524eba7181a1fba0397f2c02e32cc39430bdec64e5dd
|
4
|
+
data.tar.gz: 4982d9660b49dca975a73cdfccf5698d69a55335eb2324a48ede6fd32dd2e4cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae5e58177ded024eb030f431e0c991abc9ab3ef2a54d2e04c082bc84cf38582af7a451d57c984a4e6d412e72519a2919178619daec7638696cde36e31b8f1000
|
7
|
+
data.tar.gz: 68017fa4d90eca7612494aeb51ed965aa46fe8c17ab7f03bbcb4581fef320945788d1966aab3b933dfbe330f5c5bdb31a768afbc273bf3dd9dfee81c37f34eb3
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
arquivo (0.2.
|
4
|
+
arquivo (0.2.6)
|
5
5
|
fastimage (~> 2.1)
|
6
6
|
google-api-client (~> 0.34)
|
7
|
+
google-cloud-bigquery
|
7
8
|
pdf-reader (~> 2.3)
|
8
9
|
thor (~> 0.1)
|
9
10
|
yard (~> 0.9)
|
@@ -15,12 +16,13 @@ GEM
|
|
15
16
|
addressable (2.7.0)
|
16
17
|
public_suffix (>= 2.0.2, < 5.0)
|
17
18
|
afm (0.2.2)
|
19
|
+
concurrent-ruby (1.1.6)
|
18
20
|
declarative (0.0.10)
|
19
21
|
declarative-option (0.1.0)
|
20
|
-
faraday (1.0.
|
22
|
+
faraday (1.0.1)
|
21
23
|
multipart-post (>= 1.2, < 3)
|
22
24
|
fastimage (2.1.7)
|
23
|
-
google-api-client (0.37.
|
25
|
+
google-api-client (0.37.3)
|
24
26
|
addressable (~> 2.5, >= 2.5.1)
|
25
27
|
googleauth (~> 0.9)
|
26
28
|
httpclient (>= 2.8.1, < 3.0)
|
@@ -28,6 +30,18 @@ GEM
|
|
28
30
|
representable (~> 3.0)
|
29
31
|
retriable (>= 2.0, < 4.0)
|
30
32
|
signet (~> 0.12)
|
33
|
+
google-cloud-bigquery (1.21.0)
|
34
|
+
concurrent-ruby (~> 1.0)
|
35
|
+
google-api-client (~> 0.33)
|
36
|
+
google-cloud-core (~> 1.2)
|
37
|
+
googleauth (~> 0.9)
|
38
|
+
mini_mime (~> 1.0)
|
39
|
+
google-cloud-core (1.5.0)
|
40
|
+
google-cloud-env (~> 1.0)
|
41
|
+
google-cloud-errors (~> 1.0)
|
42
|
+
google-cloud-env (1.3.1)
|
43
|
+
faraday (>= 0.17.3, < 2.0)
|
44
|
+
google-cloud-errors (1.0.0)
|
31
45
|
googleauth (0.11.0)
|
32
46
|
faraday (>= 0.17.3, < 2.0)
|
33
47
|
jwt (>= 1.4, < 3.0)
|
@@ -42,14 +56,14 @@ GEM
|
|
42
56
|
mini_mime (1.0.2)
|
43
57
|
multi_json (1.14.1)
|
44
58
|
multipart-post (2.1.1)
|
45
|
-
os (1.0
|
59
|
+
os (1.1.0)
|
46
60
|
pdf-reader (2.4.0)
|
47
61
|
Ascii85 (~> 1.0.0)
|
48
62
|
afm (~> 0.2.1)
|
49
63
|
hashery (~> 2.0)
|
50
64
|
ruby-rc4
|
51
65
|
ttfunk
|
52
|
-
public_suffix (4.0.
|
66
|
+
public_suffix (4.0.4)
|
53
67
|
rake (13.0.1)
|
54
68
|
representable (3.0.4)
|
55
69
|
declarative (< 0.1.0)
|
@@ -57,7 +71,7 @@ GEM
|
|
57
71
|
uber (< 0.2.0)
|
58
72
|
retriable (3.1.2)
|
59
73
|
ruby-rc4 (0.1.5)
|
60
|
-
signet (0.
|
74
|
+
signet (0.14.0)
|
61
75
|
addressable (~> 2.3)
|
62
76
|
faraday (>= 0.17.3, < 2.0)
|
63
77
|
jwt (>= 1.5, < 3.0)
|
data/arquivo.gemspec
CHANGED
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
|
39
39
|
spec.add_dependency 'fastimage', '~> 2.1'
|
40
40
|
spec.add_dependency 'google-api-client', '~> 0.34'
|
41
|
+
spec.add_dependency 'google-cloud-bigquery'
|
41
42
|
spec.add_dependency 'pdf-reader', '~> 2.3'
|
42
43
|
spec.add_dependency 'thor', '~> 0.1'
|
43
44
|
spec.add_dependency 'yard', '~> 0.9'
|
data/lib/arquivo.rb
CHANGED
@@ -64,6 +64,12 @@ module Arquivo
|
|
64
64
|
C118pdf.new(dashboard, options).faz_dashboard
|
65
65
|
end
|
66
66
|
|
67
|
+
desc 'big', 'processa dados bigquery c118'
|
68
|
+
# processa bigquery c118
|
69
|
+
def big
|
70
|
+
C118dir.new('.', options).processa_big
|
71
|
+
end
|
72
|
+
|
67
73
|
desc 'dir PASTA', 'processa faturas/recibos/extratos/minutas ' \
|
68
74
|
'e cria arquivos c118'
|
69
75
|
option :fuzz, type: :numeric, default: 29,
|
data/lib/arquivo/dir.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'google/apis/sheets_v4'
|
4
4
|
require 'googleauth'
|
5
5
|
require 'googleauth/stores/file_token_store'
|
6
|
+
require 'google/cloud/bigquery'
|
6
7
|
|
7
8
|
require 'arquivo/noise'
|
8
9
|
|
@@ -66,6 +67,18 @@ module Arquivo
|
|
66
67
|
processa_items
|
67
68
|
end
|
68
69
|
|
70
|
+
def processa_big
|
71
|
+
puts contem
|
72
|
+
# This uses Application Default Credentials to authenticate.
|
73
|
+
# @see https://cloud.google.com/bigquery/docs/authentication/getting-started
|
74
|
+
bigquery = Google::Cloud::Bigquery.new
|
75
|
+
|
76
|
+
r = bigquery.query 'select * from arquivo.bal order by 1 desc limit 10'
|
77
|
+
r.each do |row|
|
78
|
+
puts "#{row[:data]}: #{row[:documento]}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
69
82
|
# @return [String] proximo item dentro da pasta
|
70
83
|
def next_item
|
71
84
|
@item = items.next
|
@@ -92,12 +105,12 @@ module Arquivo
|
|
92
105
|
#
|
93
106
|
# @return [Google::Apis::SheetsV4::SheetsService] c118 sheets_v4
|
94
107
|
def c118_sheets
|
95
|
-
p = '/home/c118
|
108
|
+
p = '/home/c118/.'
|
96
109
|
# file obtido console.cloud.google.com/apis OAuth 2.0 client IDs
|
97
|
-
i = Google::Auth::ClientId.from_file("#{p}
|
110
|
+
i = Google::Auth::ClientId.from_file("#{p}sheets.json")
|
98
111
|
s = Google::Apis::SheetsV4::AUTH_SPREADSHEETS_READONLY
|
99
112
|
# file criado aquando new_credentials is executed
|
100
|
-
f = Google::Auth::Stores::FileTokenStore.new(file: "#{p}
|
113
|
+
f = Google::Auth::Stores::FileTokenStore.new(file: "#{p}sheets.yaml")
|
101
114
|
z = Google::Auth::UserAuthorizer.new(i, s, f)
|
102
115
|
|
103
116
|
sheets = Google::Apis::SheetsV4::SheetsService.new
|
data/lib/arquivo/noise.rb
CHANGED
@@ -44,12 +44,15 @@ module Arquivo
|
|
44
44
|
# @return [C118dir] pasta de documentos c118
|
45
45
|
def initialize(dir, opt)
|
46
46
|
c = Dir.glob(File.join(dir, '*'))
|
47
|
+
puts c
|
47
48
|
@local = dir
|
49
|
+
puts @local
|
48
50
|
@items = c.each
|
49
51
|
@nome = File.basename(dir, File.extname(dir)) + '-' +
|
50
52
|
Date.today.strftime('%Y%m%d')
|
51
53
|
@opcoes = opt
|
52
54
|
@contem = obtem_conteudo(c)
|
55
|
+
puts @contem
|
53
56
|
end
|
54
57
|
|
55
58
|
# Agrupa conteudo duma pasta segundo tipos de documentos validos
|
data/lib/arquivo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arquivo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
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-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.34'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: google-cloud-bigquery
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: pdf-reader
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|