adp-downloader 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e22d6a2d101c5fd813316d6eb144e30357be097
4
- data.tar.gz: a94fa0e54e3f023fb695d5dcdf7791ed73a81c04
3
+ metadata.gz: 74636952a5502d798d4324d53ee023be0b73af7d
4
+ data.tar.gz: f861249c96f55e16bb560abff6796ce50a024155
5
5
  SHA512:
6
- metadata.gz: 1fe857e5187102d7e8d04061250b8b96ff9786453435f982b73b6677b84be04882e0b75e060eeeb87bfcb4fa237ce7a8fb2bd98c3963c9edd0698ea12e9d90d3
7
- data.tar.gz: 4d3973c4d8db0f06721345fb9d75f05d591703201dd19b52655adaa844de243560ca8c04eba2d2af723143ae8c7e04c01c9165f8fc689f7c9a30b2cf66319742
6
+ metadata.gz: bd8ff91bf6864ad6d46b197aa58d764e757e68251556080db71143c05886cd10af5a9ad5a0e688ca4600b6ef905367802a5ba3df54592a30d83b719e3d37a2cd
7
+ data.tar.gz: 27ee300c652947c7b85e6df5e9309600d195ad92c9d0aeeecfab60b9e67364e43ae781e388cde63d3d0f3644950bed23126b30872767d1bab6462f988de2131a
data/README.md CHANGED
@@ -30,6 +30,9 @@ Go to the directory where you want the pay stubs to be saved and run:
30
30
 
31
31
  adp-downloader
32
32
 
33
+ # if you want to download stubs from multiple employers/accounts
34
+ adp-downloader --employer <employername>
35
+
33
36
  Enter your credentials and profit: all pay statements currently
34
37
  available will be downloaded, both in JSON and PDF formats. When you
35
38
  receive your next paycheck, just go back to the directory and re-run
@@ -41,8 +44,12 @@ If you want to run it automatically (e.g. in a cron job), create or edit
41
44
  you local [`.netrc` file][netrc] (usually in your home directory, unless
42
45
  you put it somewhere else) with your credentials:
43
46
 
47
+ # in case of a single employer/account
44
48
  machine adp-downloader login ___username___ password ___password___
45
49
 
50
+ # for multiple employers/accounts
51
+ machine adp-downloader-employername login ___username___ password ___password___
52
+
46
53
  Adding your credentials to this file will skip the interactive step.
47
54
 
48
55
 
@@ -5,6 +5,7 @@ module ADPDownloader
5
5
  class Config
6
6
  class << self
7
7
  attr_writer :quiet
8
+ attr_accessor :employer
8
9
 
9
10
  def credentials
10
11
  from_netrc or from_stdin
@@ -21,7 +22,8 @@ module ADPDownloader
21
22
 
22
23
  def from_netrc
23
24
  n = Netrc.read
24
- username, password = n[MACHINE_NAME]
25
+ credential_string = [MACHINE_NAME, employer].compact.join('-')
26
+ username, password = n[credential_string]
25
27
  creds(username, password) if username and password
26
28
  end
27
29
 
@@ -33,6 +33,7 @@ module ADPDownloader
33
33
  def parse_options
34
34
  options = OptionParser.new
35
35
  options.banner = "Usage: adp-downloader [options]"
36
+ options.on("-e", "--employer EMP", "Employer name") { |e| Config.employer = e }
36
37
  options.on("-v", "--quiet", "Only display errors") { Config.quiet = true }
37
38
  options.on("-h", "--help", "Show this message") { puts(options); exit }
38
39
  options.parse!(@arguments)
@@ -21,6 +21,11 @@ module ADPDownloader
21
21
  [date, id, file_suffix].compact.join("-")
22
22
  end
23
23
 
24
+ def full_path(name)
25
+ parts = [Config.employer, year, name].compact
26
+ File.join(*parts)
27
+ end
28
+
24
29
  def file_suffix
25
30
  nil
26
31
  end
@@ -35,11 +40,11 @@ module ADPDownloader
35
40
  end
36
41
 
37
42
  def pdf
38
- File.join(year, "#{filename}.pdf")
43
+ full_path("#{filename}.pdf")
39
44
  end
40
45
 
41
46
  def json
42
- File.join(year, "#{filename}.json")
47
+ full_path("#{filename}.json")
43
48
  end
44
49
 
45
50
  def _(string)
@@ -1,3 +1,3 @@
1
1
  module ADPDownloader
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adp-downloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anderson Mesquita (andersonvom)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize