menthol 0.1.1 → 0.2.0
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/README.md +11 -6
- data/exe/menthol +29 -5
- data/lib/menthol/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9a061597984e8421a60f0d97087590ce061cb2f
|
|
4
|
+
data.tar.gz: 949e0bfb5e75b7b3f858ae9c711455ca00965947
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66481de0ec1da19e1c379bfbf4d6111a05c16a72e22ff287cbccb74518d95ed3f1bfba644566cda59dc50e132be78676152775d4ab0acab1b007b003b7b20b83
|
|
7
|
+
data.tar.gz: 8e00e80974cc0e0ca043727a2dd6cc9557171fe69a89164cf796c0adfbc128354e37ff46cce6f67c643159b4e59cc583245906a91ff48009c9194979aa25a7f3
|
data/README.md
CHANGED
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
**Warning**: This project is a work in progress.
|
|
4
4
|
|
|
5
|
+
Install with:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
gem install menthol
|
|
9
|
+
```
|
|
10
|
+
|
|
5
11
|
Menthol is a web scraper that fetch your Thai bank account balances and sum
|
|
6
12
|
them for you in your terminal.
|
|
7
13
|
|
|
8
|
-
Store your configuration under `~/.mentholrc` and run with `
|
|
14
|
+
Store your configuration under `~/.mentholrc` and run with `mentholrc fetch`.
|
|
9
15
|
|
|
10
16
|
Here's a sample `~/.mentholrc` configuration file:
|
|
11
17
|
|
|
@@ -31,10 +37,9 @@ This library currently support:
|
|
|
31
37
|
- Local (the amount must be given in the configuration file as the
|
|
32
38
|
smallest currency subunit)
|
|
33
39
|
|
|
34
|
-
You'll
|
|
35
|
-
|
|
40
|
+
You'll also need Chrome installed and [chrome-webdriver][1] somewhere on
|
|
41
|
+
your PATH.
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
If you run on a linux box in only a terminal you can install the optional `headless` gem and let it run without the need for a screen to be attached.
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
- add web server to display balances and their history
|
|
45
|
+
[1]: https://sites.google.com/a/chromium.org/chromedriver/downloads
|
data/exe/menthol
CHANGED
|
@@ -4,21 +4,45 @@ require "menthol"
|
|
|
4
4
|
|
|
5
5
|
profile = Menthol::Profile.configure(File.expand_path("~/.mentholrc"))
|
|
6
6
|
|
|
7
|
+
begin
|
|
8
|
+
require "headless"
|
|
9
|
+
rescue LoadError
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
if defined?(Headless)
|
|
13
|
+
headless = Headless.new
|
|
14
|
+
headless.start
|
|
15
|
+
end
|
|
16
|
+
|
|
7
17
|
case ARGV.first
|
|
8
|
-
when "
|
|
18
|
+
when "fetch"
|
|
9
19
|
profile.sync_all!
|
|
10
20
|
|
|
21
|
+
accounts = []
|
|
22
|
+
|
|
11
23
|
profile.providers.each do |provider|
|
|
12
24
|
provider.accounts.each do |account|
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
accounts.push({
|
|
26
|
+
name: "#{provider.name} #{account.name}",
|
|
27
|
+
amount: account.amount.fractional,
|
|
28
|
+
currency: account.amount.currency.iso_code,
|
|
29
|
+
})
|
|
15
30
|
end
|
|
16
31
|
end
|
|
17
32
|
|
|
18
|
-
puts
|
|
19
|
-
|
|
33
|
+
puts(JSON.pretty_generate({
|
|
34
|
+
accounts: accounts,
|
|
35
|
+
total: {
|
|
36
|
+
amount: profile.amount.fractional,
|
|
37
|
+
currency: profile.amount.currency.iso_code,
|
|
38
|
+
}
|
|
39
|
+
}) << "\n")
|
|
20
40
|
else
|
|
21
41
|
puts "usage: menthold COMMAND"
|
|
22
42
|
end
|
|
23
43
|
|
|
44
|
+
if defined?(Headless)
|
|
45
|
+
headless.destroy
|
|
46
|
+
end
|
|
47
|
+
|
|
24
48
|
exit 0
|
data/lib/menthol/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: menthol
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robin Clart
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-11-
|
|
11
|
+
date: 2016-11-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: watir
|