burglar 0.2.0 → 0.3.1

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: 25e844e95a2d468f0bcc283db3f4b1e8f5c229d7416d9ce6c801864b50a13674
4
- data.tar.gz: 1767116723d58b400f42f80da9929003c22b050a0ddb5959579c0ac6cf3e2fb1
3
+ metadata.gz: f6156befb30e8d1ebd9fa1700eb0638352d42f3f80fad1acc448df7589ecc30d
4
+ data.tar.gz: 71765092e9611b282234eaad2255e09ff085689c2c3c737f495096a3acca4823
5
5
  SHA512:
6
- metadata.gz: a50c49a22f97a600ff75ebf80473a497aeb52c66257526ee5b68cd5cfa9e78fc7ebb45bc23bbdf7eda6d22607cb099e9ccc9fdd8c8ac3a8ab1177ad4ee1f83e4
7
- data.tar.gz: 032d386ed122727eb197e25efe77d4ef256967e7e2f18e8a2e27940847ab739c689ecc596c8d09dc3baac7a1575dd584126446dffb7b171c09656cd6c7e60dcd
6
+ metadata.gz: 4d6e6af478622865c6e0f10013e3934d9de06b007df40994f8f377920cefa69101b220ca70fba93a537f4f56e00ae58a446cf260c8b1154ac1d1795e59a7a1cf
7
+ data.tar.gz: a76ffc8de3e77afe19416efd922078d5b38d0313f3e60bbe02cee8472bb617c295053d28a6e71e559469e4a1a1d25078fd359339a8e42ee4303299b0ee1b67f8
@@ -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,7 +4,7 @@ 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
 
@@ -30,24 +30,49 @@ module LogCabin
30
30
  end
31
31
  end
32
32
 
33
+ def balance
34
+ @balance ||= load_balance
35
+ end
36
+
33
37
  private
34
38
 
39
+ def api_configuration
40
+ @api_configuration ||= ::Plaid::Configuration.new do |c|
41
+ c.server_index = ::Plaid::Configuration::Environment['development']
42
+ c.api_key['PLAID-CLIENT-ID'] = client_id
43
+ c.api_key['PLAID-SECRET'] = secret_key
44
+ c.api_key['Plaid-Version'] = '2020-09-14'
45
+ end
46
+ end
47
+
35
48
  def api_client
36
- @api_client ||= ::Plaid::Client.new(
37
- env: 'development',
38
- client_id: client_id,
39
- secret: secret_key
40
- )
49
+ @api_client ||= ::Plaid::ApiClient.new api_configuration
50
+ end
51
+
52
+ def client
53
+ @client ||= ::Plaid::PlaidApi.new(api_client)
54
+ end
55
+
56
+ def load_balance
57
+ resp = client.accounts_balance_get(::Plaid::AccountsBalanceGetRequest.new(
58
+ access_token: access_token,
59
+ options: ::Plaid::AccountsBalanceGetRequestOptions.new(
60
+ account_ids: [account_id]
61
+ )
62
+ ))
63
+ resp.accounts.first.balances.current
41
64
  end
42
65
 
43
66
  def get_transactions_page(offset)
44
- resp = api_client.transactions.get(
45
- access_token,
46
- begin_date_str,
47
- end_date_str,
48
- account_ids: [account_id],
49
- offset: offset
50
- )
67
+ resp = client.transactions_get(::Plaid::TransactionsGetRequest.new(
68
+ access_token: access_token,
69
+ start_date: begin_date_str,
70
+ end_date: end_date_str,
71
+ options: ::Plaid::TransactionsGetRequestOptions.new(
72
+ account_ids: [account_id],
73
+ offset: offset
74
+ )
75
+ ))
51
76
  [resp.transactions, resp.total_transactions]
52
77
  end
53
78
 
@@ -75,16 +100,16 @@ module LogCabin
75
100
  end
76
101
 
77
102
  def accounts
78
- @accounts ||= api_client.accounts.get(access_token)['accounts']
103
+ @accounts || client.accounts_get(::Plaid::AccountsGetRequest.new(access_token: access_token)).accounts
79
104
  end
80
105
 
81
106
  def account
82
107
  @account ||= accounts.first if accounts.size == 1
83
- @account ||= accounts.find { |x| x['name'] == account_clean_name }
108
+ @account ||= accounts.find { |x| x.name == account_clean_name }
84
109
  end
85
110
 
86
111
  def account_id
87
- @account_id ||= account['account_id']
112
+ @account_id ||= account.account_id
88
113
  end
89
114
 
90
115
  def account_clean_name
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Set the version (needed for Mercenary -v)
3
3
  module Burglar
4
- VERSION = '0.2.0'.freeze
4
+ VERSION = '0.3.1'.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.2.0
4
+ version: 0.3.1
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: 2021-03-06 00:00:00.000000000 Z
11
+ date: 2023-10-14 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.1.2
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=