time_cop 0.1.0 → 0.2.0

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: 2258a186bbf4d192ec0abac9e6f22dd176d3f8c9
4
- data.tar.gz: 958bf194c3cb02fc9d43bda2fab21c6f0ff71ab9
3
+ metadata.gz: dbd30d879f6956f878131b5e070f6973f85f5451
4
+ data.tar.gz: 5fd2f4729fa582dadfd679b3df1a1351112a837c
5
5
  SHA512:
6
- metadata.gz: e482ce70b329d5cc198d869e781689d4984275e5a30743e1724e0e004f4489033d056a8e196d1ac2bded0669395f6c10566216c872c635c7ce0afb04b5e369b3
7
- data.tar.gz: e2430db898725e400db4bdc078ff6f9f14af33c285a860ce32cc862104254c9f989e04fe3622ed3f16dd2c24a01649a87fcbf67e85ad3c6cc1106926b1fd365a
6
+ metadata.gz: 2110f326ec451c4d0068e84cbfe6079eed7b7423f593fee38a47097e61e029904c15fabb19a9061c675ba79bc006f79ce034a09a04bc71e80d014628784a1ee0
7
+ data.tar.gz: 08a5d4bf2b089baee33e764b9a1b94055ac9c9d2f3b7aeb19f5cc10304038913c96fab97924a3c6e8efaed090f3fc88154de16675fe82416ee6c29d8d52144e9
data/README.md CHANGED
@@ -5,32 +5,27 @@ Welcome to your new gem! In this directory, you'll find the files you need to be
5
5
  TODO: Delete this and the text above, and describe your gem
6
6
 
7
7
  ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'time_cop'
13
- ```
8
+ $ gem install time_cop
14
9
 
15
10
  And then execute:
16
11
 
17
- $ bundle
12
+ $ time_cop
18
13
 
19
14
  Or install it yourself as:
20
15
 
21
- $ gem install time_cop
22
-
23
16
  ## Usage
24
17
 
25
- TODO: Write usage instructions here
18
+ $ time_cop --username=user@wild.land --password=super_secret_password
26
19
 
27
20
  ## Development
28
21
 
29
22
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
23
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
24
+ To run the local development copy on your machine, run `$ ruby -Ilib ./exe/time_cop`
25
+
26
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
27
 
33
28
  ## Contributing
34
29
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/time_cop. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
30
+ Bug reports and pull requests are welcome on GitHub at https://github.com/wildland/time_cop. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
31
 
@@ -16,13 +16,13 @@ module TimeCop
16
16
  q4: [{month: 10, day: 1}, {month: 12, day: 31}]
17
17
  }
18
18
 
19
- def initialize(username:, password:, subdomain: 'wildland', date: Date.today, report_builder: nil)
19
+ def initialize(username:, password:, subdomain: 'wildland', date: Date.today, report_builder: nil, email: nil)
20
20
  @client = Harvest.client(username: username, password: password, subdomain: subdomain)
21
21
  @date = date
22
22
  @report_builder = report_builder ||
23
23
  ReportBuilder.new(
24
24
  client: client,
25
- user: user,
25
+ user: email ? fetch_user(email) : default_user,
26
26
  start_date: start_of_quarter_date,
27
27
  end_date: end_of_quarter_date
28
28
  )
@@ -32,7 +32,11 @@ module TimeCop
32
32
  client.account
33
33
  end
34
34
 
35
- def user
35
+ def fetch_user(email)
36
+ client.users.find(email)
37
+ end
38
+
39
+ def default_user
36
40
  account.who_am_i
37
41
  end
38
42
 
@@ -146,6 +150,7 @@ module TimeCop
146
150
  end
147
151
 
148
152
  def print_report
153
+ puts "Quarter Period: #{start_of_quarter_date} #{end_of_quarter_date}"
149
154
  puts "Current Surplus(+)/Deficit(-): #{current_hours_delta.round(2)}"
150
155
  puts "Quarterly Hour Target: #{expected_quarter_hours.round(2)}"
151
156
  puts "Current Quarterly Charged Hours: #{total_quarter_time_tracked.round(2)}"
@@ -19,6 +19,10 @@ module TimeCop
19
19
  options[:password] = password
20
20
  end
21
21
 
22
+ opts.on("-e EMAIL", "--email=EMAIL", "Email of user to get report for") do |email|
23
+ options[:email] = email
24
+ end
25
+
22
26
  opts.on("-h", "--help", "Prints help") do
23
27
  puts opts
24
28
  exit
@@ -6,7 +6,7 @@ module TimeCop
6
6
  options_parser = OptionParser.new(ARGV)
7
7
  options = options_parser.parse
8
8
 
9
- accountability = Accountability.new(username: options[:username], password: options[:password])
9
+ accountability = Accountability.new(username: options[:username], password: options[:password], email: options[:email])
10
10
  accountability.print_report
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module TimeCop
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_cop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Clopton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: harvested