burglar 0.3.0 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c280fb2c64ad674715877d9429f1c84ddb7dfb9e9578cc0d7d58b5251eb575b2
4
- data.tar.gz: 68fa5caf9698c083008b530a53e81908c1cf099c08abb887889549cfd5cf363d
3
+ metadata.gz: b846aada4fa7612866c15d3d11abdc0f9629e9679f81e397dd84bae18ab655a6
4
+ data.tar.gz: 80c9c452bd1dba8631ce2daf6beb011f2908e3ef52831e847c5f15d2b722f432
5
5
  SHA512:
6
- metadata.gz: 3f36f39c7b1b2bac802b112e02dc7c7b3300fa36e81481c7527397d69e9106d79d926514f985dc718b5d0e599dcbfb010794bbf158acdac846beac0339c44f79
7
- data.tar.gz: a4fa85124c0430f97238c4bfa3c5e3455187816a8acbb6d9ac36fd6794538c3a8aa5d6dee85ed5860d8dc75ccab113aa160ee5aa40c6eebc4bbeb0e21700e998
6
+ metadata.gz: 0f915956900c13c26218358b9d2fe9af73b8a9d7d67cd9235fe39aa08d4dbce2b850b5e7b088fcacdca8372a988b620b01c3cf99e3eb961fcf274d26410d4d21
7
+ data.tar.gz: 95c69ba4bb1f0395a318760a9fe34d7eb788f045e7b61ceb7367a16ac0058c5facebc17dce2495f34a269f897c5dadb66a12dc94e4c5e144114b0bacddb02a39
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ URL="https://exporter.akerl.app/metric"
6
+ AUTH="Authorization: Bearer $EXPORTER_TOKEN"
7
+ if [[ "$JOB_STATUS" == "success" ]] ; then
8
+ VALUE=1
9
+ else
10
+ VALUE=0
11
+ fi
12
+ BODY="{\"name\":\"gh/${GITHUB_REPOSITORY}\",\"metrics\":[{\"name\":\"ghactions\",\"type\":\"gauge\",\"tags\":{\"repo\":\"${GITHUB_REPOSITORY}\"},\"value\":\"${VALUE}\"}]}"
13
+
14
+ echo "$BODY"
15
+
16
+ curl -i -XPOST -d "$BODY" -H"$AUTH" "$URL"
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Build
3
+ 'on':
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - "**"
9
+ pull_request_target:
10
+ jobs:
11
+ build:
12
+ name: Build
13
+ runs-on: ubuntu-22.04
14
+ permissions:
15
+ contents: write
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v3
19
+ with:
20
+ submodules: recursive
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: '3.1'
24
+ bundler-cache: true
25
+ - name: Build
26
+ run: bundle exec rake
27
+ - name: Release
28
+ if: github.ref_type == 'tag'
29
+ run: bundle exec rake release
30
+ env:
31
+ GEM_HOST_API_KEY: "${{ secrets.GEM_HOST_API_KEY }}"
32
+ - name: Post to hook-exporter
33
+ run: "./.github/exporter.sh"
34
+ env:
35
+ EXPORTER_TOKEN: "${{ secrets.EXPORTER_TOKEN }}"
36
+ JOB_STATUS: "${{ job.status }}"
37
+ if: always() && github.ref == 'refs/heads/main'
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Les Aker
3
+ Copyright (c) 2022 Les Aker
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,9 +2,7 @@ burglar
2
2
  =========
3
3
 
4
4
  [![Gem Version](https://img.shields.io/gem/v/burglar.svg)](https://rubygems.org/gems/burglar)
5
- [![Build Status](https://img.shields.io/travis/com/akerl/burglar.svg)](https://travis-ci.com/akerl/burglar)
6
- [![Coverage Status](https://img.shields.io/codecov/c/github/akerl/burglar.svg)](https://codecov.io/github/akerl/burglar)
7
- [![Code Quality](https://img.shields.io/codacy/940f3f131d724124a68a0be7d21f951b.svg)](https://www.codacy.com/app/akerl/burglar)
5
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/akerl/burglar/build.yml?branch=main)](https://github.com/akerl/burglar/actions)
8
6
  [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
9
7
 
10
8
  Tool for parsing data from bank websites into the format of [ledger](http://ledger-cli.org/)
data/burglar.gemspec CHANGED
@@ -5,8 +5,7 @@ require 'burglar/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'burglar'
7
7
  s.version = Burglar::VERSION
8
- s.date = Time.now.strftime('%Y-%m-%d')
9
- s.required_ruby_version = '>= 2.5.0'
8
+ s.required_ruby_version = '>= 3.0'
10
9
 
11
10
  s.summary = 'Tool for parsing data from bank websites'
12
11
  s.description = 'Tool for parsing data from bank websites'
@@ -16,7 +15,6 @@ Gem::Specification.new do |s|
16
15
  s.license = 'MIT'
17
16
 
18
17
  s.files = `git ls-files`.split
19
- s.test_files = `git ls-files spec/*`.split
20
18
  s.executables = ['burglar']
21
19
 
22
20
  s.add_dependency 'cymbal', '~> 2.0.0'
@@ -24,8 +22,7 @@ Gem::Specification.new do |s|
24
22
  s.add_dependency 'logcabin', '~> 0.1.3'
25
23
  s.add_dependency 'mercenary', '~> 0.4.0'
26
24
 
27
- s.add_development_dependency 'codecov', '~> 0.5.1'
28
- s.add_development_dependency 'goodcop', '~> 0.9.3'
29
- s.add_development_dependency 'rake', '~> 13.0.3'
30
- s.add_development_dependency 'rspec', '~> 3.10.0'
25
+ s.add_development_dependency 'goodcop', '~> 0.9.7'
26
+
27
+ s.metadata['rubygems_mfa_required'] = 'true'
31
28
  end
data/lib/burglar/bank.rb CHANGED
@@ -19,12 +19,12 @@ module Burglar
19
19
  @end_date ||= @options[:end]
20
20
  end
21
21
 
22
- private
23
-
24
22
  def account_name
25
23
  @account_name ||= @options[:account] || default_account_name
26
24
  end
27
25
 
26
+ private
27
+
28
28
  def default_account_name
29
29
  raise('Module failed to override default_account_name')
30
30
  end
@@ -4,12 +4,19 @@ module LogCabin
4
4
  module Modules
5
5
  ##
6
6
  # Plaid
7
- module Plaid
7
+ module Plaid # rubocop:disable Metrics/ModuleLength
8
8
  include Burglar.helpers.find(:creds)
9
9
  include Burglar.helpers.find(:ledger)
10
10
 
11
11
  PLAID_DOMAIN = 'https://plaid.com'.freeze
12
12
 
13
+ def self.load_accounts(client, access_token)
14
+ @accounts ||= {}
15
+ return @accounts[access_token] if @accounts[access_token]
16
+ req = ::Plaid::AccountsGetRequest.new(access_token: access_token)
17
+ @accounts[access_token] = client.accounts_get(req).accounts
18
+ end
19
+
13
20
  def raw_transactions # rubocop:disable Metrics/MethodLength
14
21
  @raw_transactions ||= all_transactions.map do |row|
15
22
  amount = format('$%.2f', row.amount)
@@ -30,6 +37,10 @@ module LogCabin
30
37
  end
31
38
  end
32
39
 
40
+ def balance
41
+ @balance ||= load_balance
42
+ end
43
+
33
44
  private
34
45
 
35
46
  def api_configuration
@@ -49,6 +60,16 @@ module LogCabin
49
60
  @client ||= ::Plaid::PlaidApi.new(api_client)
50
61
  end
51
62
 
63
+ def load_balance
64
+ resp = client.accounts_balance_get(::Plaid::AccountsBalanceGetRequest.new(
65
+ access_token: access_token,
66
+ options: ::Plaid::AccountsBalanceGetRequestOptions.new(
67
+ account_ids: [account_id]
68
+ )
69
+ ))
70
+ resp.accounts.first.balances.current
71
+ end
72
+
52
73
  def get_transactions_page(offset)
53
74
  resp = client.transactions_get(::Plaid::TransactionsGetRequest.new(
54
75
  access_token: access_token,
@@ -86,7 +107,7 @@ module LogCabin
86
107
  end
87
108
 
88
109
  def accounts
89
- @accounts || client.accounts_get(::Plaid::AccountsGetRequest.new(access_token: access_token)).accounts
110
+ LogCabin::Modules::Plaid.load_accounts(client, access_token)
90
111
  end
91
112
 
92
113
  def account
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Set the version (needed for Mercenary -v)
3
3
  module Burglar
4
- VERSION = '0.3.0'.freeze
4
+ VERSION = '0.3.2'.freeze
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,2 @@
1
- if ENV['CI'] == 'true'
2
- require 'simplecov'
3
- require 'codecov'
4
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
5
- SimpleCov.start do
6
- add_filter '/spec/'
7
- end
8
- end
9
-
10
1
  require 'rspec'
11
2
  require 'burglar'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burglar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-25 00:00:00.000000000 Z
11
+ date: 2023-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cymbal
@@ -66,62 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.4.0
69
- - !ruby/object:Gem::Dependency
70
- name: codecov
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.5.1
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.5.1
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: goodcop
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: 0.9.3
75
+ version: 0.9.7
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: 0.9.3
97
- - !ruby/object:Gem::Dependency
98
- name: rake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 13.0.3
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 13.0.3
111
- - !ruby/object:Gem::Dependency
112
- name: rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 3.10.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 3.10.0
82
+ version: 0.9.7
125
83
  description: Tool for parsing data from bank websites
126
84
  email: me@lesaker.org
127
85
  executables:
@@ -129,12 +87,11 @@ executables:
129
87
  extensions: []
130
88
  extra_rdoc_files: []
131
89
  files:
132
- - ".circle-ruby"
90
+ - ".github/exporter.sh"
91
+ - ".github/workflows/build.yml"
133
92
  - ".gitignore"
134
- - ".prospectus"
135
93
  - ".rspec"
136
94
  - ".rubocop.yml"
137
- - ".travis.yml"
138
95
  - Gemfile
139
96
  - LICENSE
140
97
  - README.md
@@ -154,8 +111,9 @@ files:
154
111
  homepage: https://github.com/akerl/burglar
155
112
  licenses:
156
113
  - MIT
157
- metadata: {}
158
- post_install_message:
114
+ metadata:
115
+ rubygems_mfa_required: 'true'
116
+ post_install_message:
159
117
  rdoc_options: []
160
118
  require_paths:
161
119
  - lib
@@ -163,17 +121,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
121
  requirements:
164
122
  - - ">="
165
123
  - !ruby/object:Gem::Version
166
- version: 2.5.0
124
+ version: '3.0'
167
125
  required_rubygems_version: !ruby/object:Gem::Requirement
168
126
  requirements:
169
127
  - - ">="
170
128
  - !ruby/object:Gem::Version
171
129
  version: '0'
172
130
  requirements: []
173
- rubygems_version: 3.2.33
174
- signing_key:
131
+ rubygems_version: 3.3.26
132
+ signing_key:
175
133
  specification_version: 4
176
134
  summary: Tool for parsing data from bank websites
177
- test_files:
178
- - spec/burglar_spec.rb
179
- - spec/spec_helper.rb
135
+ test_files: []
data/.circle-ruby DELETED
@@ -1,4 +0,0 @@
1
- 2.6.1
2
- 2.5.3
3
- 2.4.5
4
- 2.3.8
data/.prospectus DELETED
@@ -1,11 +0,0 @@
1
- my_slug = 'akerl/burglar'
2
-
3
- Prospectus.extra_dep('file', 'prospectus_travis')
4
- Prospectus.extra_dep('file', 'prospectus_gems')
5
-
6
- item do
7
- noop
8
-
9
- extend ProspectusGems::Gemspec.new
10
- extend ProspectusTravis::Build.new(my_slug)
11
- end
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- dist: xenial
2
- install:
3
- - for i in $(cat .circle-ruby) ; do rvm install $i || exit 1 ; done
4
- - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle install || exit 1 ; done
5
- script:
6
- - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle exec rake || exit 1 ; done
7
- notifications:
8
- email: false
9
- slack:
10
- secure: SYccHD5WsfHDkCyAcr5vfAckVcrFbR9ZjkfkahXbeyW+uC9LC1M+oqbqiLy3Oi00HV2myKg5ajsqzrXihLP5uTyWWcUAXwvAmVzerdMAfjbzteKlZnTD8fsFJ82rEoJJthk4ua4+kzYnXOv7j3cNvkssVEATEqefwZ+mJfS8HQxmnY6NPyqm4AtQBR/GFnDShDjE0mWvjeUPpS60xOOOiHKcN5bp3Epdg43AXyFV37YtDHyhpmjsJTfY9WMwdf6p2jwCeqV0vdmyAFMy3efFC4/uP//9ac3O0HuwFX3xVyBhhwd7naN+aXpkjDmrLtsPttcJWVkeWWn4Cqdausa36ZLwSjHO0hcEJS5DYTqeI6uzVQP54gKZaxIWXgyYHCG6H0bzZFov4J2W47MX9AKQ2Z5ATjJgEqSCKZlbD1enQR+5ip+BJonmxbHx0N4VCDhK24l4GETIhhASGGDAkiKEVSG/k3XrGszPMJDpR/JXypo1jt+8i5BElBW6O/7smvYwP0ejNJIiZgSuODbFltnIKMdGjIwP1gHreNKMNS9ziR8nh1KJpKD6iFwBCwv+PhH8YQ1uEJDtweeIZKLA36SttwKlDoiWxZj/Zkw1MVsO7Rvijxuyg66Dm9HggZ5zpISvPm1JYsHUN34Wmc8hIUmG3b/+96viyausXV/3li0SLVI=