attend 0.1.0 → 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 +5 -5
- data/.rubocop.yml +3 -1
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/Gemfile.lock +49 -37
- data/README.md +23 -20
- data/attend.gemspec +6 -7
- data/exe/attend +6 -38
- data/lib/attend.rb +26 -1
- data/lib/attend/get_absent_days.rb +17 -0
- data/lib/attend/register_attendances.rb +25 -0
- data/lib/attend/version.rb +1 -1
- data/lib/zoho/people/api.rb +61 -0
- data/lib/zoho/people/attendance.rb +15 -4
- data/lib/zoho/people/attendance_report.rb +23 -0
- data/lib/zoho/people/attendance_report/record.rb +20 -0
- metadata +20 -17
- data/entrypoiny.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c46e25b56aaf29efe1459cd66c089ad2a38ff6005f9e5f55740df8b2536c7e9f
|
|
4
|
+
data.tar.gz: 35a78bc6703ba3bd444bfff9d358a9c0c3028070ca01217a17ef755266b7b32b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5deeb346f54560476edf64aacae31310e8c14076f3f43549b28e73bf7d2676c1ad63e43d1dc4ba6ccd932ec4342c585e04762d2cffa62a8d4dfe4b52fe31b3f
|
|
7
|
+
data.tar.gz: 1d81cd85960b9b60b93fb7da2a8271963ca4fe7db981eff47d6551e3bed25b226bbc6c9bdc95a3f765e0bd915d79f531cb4757d054b0ed742a0ee1a6d8c09231
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.6.3
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,57 +1,69 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
attend (0.
|
|
5
|
-
clamp (~> 1.
|
|
6
|
-
|
|
4
|
+
attend (0.2.0)
|
|
5
|
+
clamp (~> 1.3)
|
|
6
|
+
http (~> 4.1)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
addressable (2.6.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
13
|
+
ast (2.4.0)
|
|
14
|
+
clamp (1.3.0)
|
|
13
15
|
diff-lcs (1.3)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
domain_name (0.5.20180417)
|
|
17
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
18
|
+
http (4.1.1)
|
|
19
|
+
addressable (~> 2.3)
|
|
20
|
+
http-cookie (~> 1.0)
|
|
21
|
+
http-form_data (~> 2.0)
|
|
22
|
+
http_parser.rb (~> 0.6.0)
|
|
23
|
+
http-cookie (1.0.3)
|
|
24
|
+
domain_name (~> 0.5)
|
|
25
|
+
http-form_data (2.1.1)
|
|
26
|
+
http_parser.rb (0.6.0)
|
|
27
|
+
jaro_winkler (1.5.2)
|
|
28
|
+
parallel (1.17.0)
|
|
29
|
+
parser (2.6.3.0)
|
|
30
|
+
ast (~> 2.4.0)
|
|
31
|
+
public_suffix (3.1.1)
|
|
32
|
+
rainbow (3.0.0)
|
|
33
|
+
rspec (3.8.0)
|
|
34
|
+
rspec-core (~> 3.8.0)
|
|
35
|
+
rspec-expectations (~> 3.8.0)
|
|
36
|
+
rspec-mocks (~> 3.8.0)
|
|
37
|
+
rspec-core (3.8.0)
|
|
38
|
+
rspec-support (~> 3.8.0)
|
|
39
|
+
rspec-expectations (3.8.3)
|
|
31
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
-
rspec-support (~> 3.
|
|
33
|
-
rspec-mocks (3.
|
|
41
|
+
rspec-support (~> 3.8.0)
|
|
42
|
+
rspec-mocks (3.8.0)
|
|
34
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
|
-
rspec-support (~> 3.
|
|
36
|
-
rspec-support (3.
|
|
37
|
-
rubocop (0.
|
|
44
|
+
rspec-support (~> 3.8.0)
|
|
45
|
+
rspec-support (3.8.0)
|
|
46
|
+
rubocop (0.71.0)
|
|
47
|
+
jaro_winkler (~> 1.5.1)
|
|
38
48
|
parallel (~> 1.10)
|
|
39
|
-
parser (>= 2.
|
|
40
|
-
|
|
41
|
-
rainbow (>= 1.99.1, < 3.0)
|
|
49
|
+
parser (>= 2.6)
|
|
50
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
42
51
|
ruby-progressbar (~> 1.7)
|
|
43
|
-
unicode-display_width (
|
|
44
|
-
ruby-progressbar (1.
|
|
45
|
-
|
|
52
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
|
53
|
+
ruby-progressbar (1.10.1)
|
|
54
|
+
unf (0.1.4)
|
|
55
|
+
unf_ext
|
|
56
|
+
unf_ext (0.0.7.6)
|
|
57
|
+
unicode-display_width (1.6.0)
|
|
46
58
|
|
|
47
59
|
PLATFORMS
|
|
48
60
|
ruby
|
|
49
61
|
|
|
50
62
|
DEPENDENCIES
|
|
51
63
|
attend!
|
|
52
|
-
bundler (~> 1.
|
|
53
|
-
rspec (~> 3.
|
|
54
|
-
rubocop (~> 0.
|
|
64
|
+
bundler (~> 1.17)
|
|
65
|
+
rspec (~> 3.8)
|
|
66
|
+
rubocop (~> 0.71.0)
|
|
55
67
|
|
|
56
68
|
BUNDLED WITH
|
|
57
|
-
1.
|
|
69
|
+
1.17.2
|
data/README.md
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
# Attend
|
|
1
|
+
# Attend [](https://travis-ci.org/SponsorPay/stack-retrace)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
|
3
|
+
Register your attendance at Zoho using CLI.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
Install `attend` Ruby gem:
|
|
10
8
|
|
|
11
|
-
```
|
|
12
|
-
gem
|
|
9
|
+
```bash
|
|
10
|
+
gem install attend
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$ bundle
|
|
18
|
-
|
|
19
|
-
Or install it yourself as:
|
|
20
|
-
|
|
21
|
-
$ gem install attend
|
|
13
|
+
and that's it!
|
|
22
14
|
|
|
23
15
|
## Usage
|
|
24
16
|
|
|
25
|
-
|
|
17
|
+
First of all you need to set [Zoho Poeople auth token](https://www.zoho.com/people/help/api/auth-token.html) as env variable in your terminal. After that you will be ready to use `attend`.
|
|
26
18
|
|
|
27
|
-
|
|
19
|
+
```bash
|
|
20
|
+
export ZOHO_PEOPLE_AUTH_TOKEN='YOUR_TOKEN'
|
|
21
|
+
```
|
|
28
22
|
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
23
|
|
|
31
|
-
To
|
|
24
|
+
To register attendance on current day:
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
```bash
|
|
27
|
+
attend --email "your.employee@email.com" --check_in "10:00" --check_out "18:00"
|
|
28
|
+
# Successfully registered attendance from 2017-07-04T10:00:00+10:00 to 2017-07-04T18:00:00+18:00
|
|
29
|
+
```
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
You can also register attendance for a few days:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
attend --email "your.employee@email.com" --check_in "10:00" --check_out "18:00" --from "04/07/2017" --to "07/07/2017"
|
|
35
|
+
# Successfully registered attendance from 2017-07-04T10:00:00+10:00 to 2017-07-04T18:00:00+18:00
|
|
36
|
+
# Successfully registered attendance from 2017-07-05T10:00:00+10:00 to 2017-07-05T18:00:00+18:00
|
|
37
|
+
# ...
|
|
38
|
+
```
|
data/attend.gemspec
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
1
|
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
lib = File.expand_path('
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
5
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
6
5
|
require 'attend/version'
|
|
7
6
|
|
|
@@ -23,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
|
23
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
23
|
spec.require_paths = ['lib']
|
|
25
24
|
|
|
26
|
-
spec.add_dependency '
|
|
27
|
-
spec.add_dependency '
|
|
25
|
+
spec.add_dependency 'clamp', '~> 1.3'
|
|
26
|
+
spec.add_dependency 'http', '~> 4.1'
|
|
28
27
|
|
|
29
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
|
30
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
|
31
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 0.71.0'
|
|
32
31
|
end
|
data/exe/attend
CHANGED
|
@@ -1,54 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
3
4
|
require 'clamp'
|
|
4
5
|
require 'date'
|
|
5
|
-
require 'httparty'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
DATE_FORMAT = 'dd/MM/yyyy HH:mm:ss'
|
|
7
|
+
require_relative '../lib/attend'
|
|
9
8
|
|
|
10
|
-
parse_date =
|
|
9
|
+
parse_date = Date.method(:parse)
|
|
11
10
|
|
|
12
11
|
Clamp do
|
|
13
12
|
option '--email', 'EMAIL', 'employee email id', required: true
|
|
14
|
-
option '--check_in', 'CHECK_IN', 'check in time',
|
|
15
|
-
option '--check_out', 'CHECK_OUT', 'check out time',
|
|
13
|
+
option '--check_in', 'CHECK_IN', 'check in time', default: '9:00'
|
|
14
|
+
option '--check_out', 'CHECK_OUT', 'check out time', default: '17:00'
|
|
16
15
|
option '--from', 'FROM', 'date of the first work day', default: Date.today, &parse_date
|
|
17
16
|
option '--to', 'TO', 'date of the las work day', default: Date.today, &parse_date
|
|
18
17
|
option '--dry', :flag, 'enables dry run'
|
|
19
18
|
|
|
20
19
|
def execute
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
days_between.map(&:to_datetime).each do |date_time|
|
|
24
|
-
check_in_time = date_time.new_offset("+#{check_in}")
|
|
25
|
-
check_out_time = date_time.new_offset("+#{check_out}")
|
|
26
|
-
|
|
27
|
-
if dry?
|
|
28
|
-
puts "DRY RUN: Committing attendance from #{check_in_time} to #{check_out_time}"
|
|
29
|
-
next
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
response = post_attendance(check_in_time, check_out_time)
|
|
33
|
-
|
|
34
|
-
if response.ok?
|
|
35
|
-
puts "Successfully registered attendance from #{check_in_time} to #{check_out_time}"
|
|
36
|
-
elsif response
|
|
37
|
-
raise "Failed to register attendance. Error: #{response.body}"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def post_attendance(check_in_time, check_out_time)
|
|
43
|
-
parameters = {
|
|
44
|
-
'authtoken' => AUTH_TOKEN,
|
|
45
|
-
'dateFormat' => DATE_FORMAT,
|
|
46
|
-
'checkIn' => check_in_time.strftime('%d/%m/%Y %H:%M:%S'),
|
|
47
|
-
'checkOut' => check_out_time.strftime('%d/%m/%Y %H:%M:%S'),
|
|
48
|
-
'emailId' => email,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
HTTParty.post('https://people.zoho.com/people/api/attendance', query: parameters)
|
|
20
|
+
Attend.register(email: email, from: from, to: to, check_in: check_in, check_out: check_out, dry_run: dry?)
|
|
52
21
|
end
|
|
53
22
|
end
|
|
54
|
-
|
data/lib/attend.rb
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'attend/version'
|
|
4
|
+
require_relative './zoho/people/api'
|
|
5
|
+
require_relative './zoho/people/attendance'
|
|
6
|
+
require_relative './attend/get_absent_days'
|
|
7
|
+
require_relative './attend/register_attendances'
|
|
4
8
|
|
|
5
9
|
module Attend
|
|
6
|
-
|
|
10
|
+
ZOHO_API = Zoho::People::API.new
|
|
11
|
+
|
|
12
|
+
private_constant :ZOHO_API
|
|
13
|
+
|
|
14
|
+
def self.register(email:, from:, to:, check_in:, check_out:, dry_run: true)
|
|
15
|
+
absent_days = GetAbsentDays.new(zoho: ZOHO_API).call(email: email, from: from, to: to)
|
|
16
|
+
|
|
17
|
+
if absent_days.empty?
|
|
18
|
+
puts "No absent days between #{from} and #{to}"
|
|
19
|
+
return
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attendances = absent_days.map do |day|
|
|
23
|
+
day_beginning = day.to_datetime
|
|
24
|
+
|
|
25
|
+
Zoho::People::Attendance.new(email: email,
|
|
26
|
+
check_in: day_beginning.new_offset("+#{check_in}"),
|
|
27
|
+
check_out: day_beginning.new_offset("+#{check_out}"))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
RegisterAttendances.new(zoho: ZOHO_API, dry_run: dry_run).call(attendances)
|
|
31
|
+
end
|
|
7
32
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Attend
|
|
4
|
+
class GetAbsentDays
|
|
5
|
+
attr_reader :zoho
|
|
6
|
+
|
|
7
|
+
def initialize(zoho:)
|
|
8
|
+
@zoho = zoho
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def call(email:, from:, to:)
|
|
12
|
+
attendance_report = zoho.get_attendance_report(email: email, from: from, to: to)
|
|
13
|
+
|
|
14
|
+
attendance_report.records.select(&:missing_work?).map(&:date)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Attend
|
|
4
|
+
class RegisterAttendances
|
|
5
|
+
attr_reader :zoho, :dry_run
|
|
6
|
+
|
|
7
|
+
def initialize(zoho:, dry_run: true)
|
|
8
|
+
@zoho = zoho
|
|
9
|
+
@dry_run = dry_run
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def call(attendances)
|
|
13
|
+
attendances.each do |attendance|
|
|
14
|
+
if dry_run
|
|
15
|
+
puts "DRY RUN: Committing #{attendance}"
|
|
16
|
+
next
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
zoho.post_attendance(attendance)
|
|
20
|
+
|
|
21
|
+
puts "Successfully registered #{attendance}"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/attend/version.rb
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'http'
|
|
4
|
+
|
|
5
|
+
require_relative './attendance_report'
|
|
6
|
+
|
|
7
|
+
module Zoho
|
|
8
|
+
module People
|
|
9
|
+
class API
|
|
10
|
+
URL = 'https://people.zoho.com/people/api'
|
|
11
|
+
|
|
12
|
+
attr_reader :auth_token
|
|
13
|
+
|
|
14
|
+
def initialize(auth_token: ENV['ZOHO_PEOPLE_AUTH_TOKEN'])
|
|
15
|
+
raise 'You must provide Zoho People authentication token' unless auth_token
|
|
16
|
+
|
|
17
|
+
@auth_token = auth_token
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def post_attendance(attendance)
|
|
21
|
+
params = {
|
|
22
|
+
'authtoken' => auth_token,
|
|
23
|
+
'dateFormat' => 'dd/MM/yyyy HH:mm:ss',
|
|
24
|
+
'emailId' => attendance.email,
|
|
25
|
+
'checkIn' => attendance.check_in.strftime('%d/%m/%Y %H:%M:%S'),
|
|
26
|
+
'checkOut' => attendance.check_out.strftime('%d/%m/%Y %H:%M:%S')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
request(:post, 'attendance', params: params)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_attendance_report(email:, from:, to:)
|
|
33
|
+
params = {
|
|
34
|
+
'authtoken' => auth_token,
|
|
35
|
+
'dateFormat' => 'yyyy-MM-dd',
|
|
36
|
+
'emailId' => email,
|
|
37
|
+
'sdate' => from.strftime('%Y-%m-%d'),
|
|
38
|
+
'edate' => to.strftime('%Y-%m-%d')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
data = request(:get, 'attendance/getUserReport', params: params)
|
|
42
|
+
|
|
43
|
+
AttendanceReport.parse(data)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def request(method, endpoint, options)
|
|
49
|
+
response = Http.method(method).call("#{URL}/#{endpoint}", options)
|
|
50
|
+
|
|
51
|
+
if response.status.success?
|
|
52
|
+
response.parse
|
|
53
|
+
elsif response
|
|
54
|
+
raise "Failed to #{method.to_s.upcase} #{endpoint}. Error: #{response.body}"
|
|
55
|
+
else
|
|
56
|
+
raise 'Failed to request Zoho API'
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -3,14 +3,25 @@
|
|
|
3
3
|
module Zoho
|
|
4
4
|
module People
|
|
5
5
|
class Attendance
|
|
6
|
-
|
|
6
|
+
attr_reader :check_in, :check_out, :email
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
def initialize(email:, check_in:, check_out:)
|
|
9
|
+
raise ArgumentError, 'check_in must be DateTime instance' unless check_in.is_a?(DateTime)
|
|
10
|
+
raise ArgumentError, 'check_out must be DateTime instance' unless check_out.is_a?(DateTime)
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
@email = email
|
|
11
13
|
@check_in = check_in
|
|
12
14
|
@check_out = check_out
|
|
13
|
-
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def to_s
|
|
18
|
+
"attendance from #{format(check_in)} to #{format(check_out)}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def format(datetime)
|
|
24
|
+
datetime.strftime('%F@%H:%M')
|
|
14
25
|
end
|
|
15
26
|
end
|
|
16
27
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative './attendance_report/record'
|
|
4
|
+
|
|
5
|
+
module Zoho
|
|
6
|
+
module People
|
|
7
|
+
class AttendanceReport
|
|
8
|
+
attr_reader :records
|
|
9
|
+
|
|
10
|
+
def self.parse(data)
|
|
11
|
+
records = data.map do |date, entry|
|
|
12
|
+
Record.new(date: Date.parse(date), status: entry['Status'])
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
new(records)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def initialize(records)
|
|
19
|
+
@records = records.sort_by(&:date)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Zoho
|
|
4
|
+
module People
|
|
5
|
+
class AttendanceReport
|
|
6
|
+
class Record
|
|
7
|
+
attr_reader :date, :status
|
|
8
|
+
|
|
9
|
+
def initialize(date:, status:)
|
|
10
|
+
@date = date
|
|
11
|
+
@status = status
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def missing_work?
|
|
15
|
+
status.empty? || status == 'Absent'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
metadata
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: attend
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maciej Komorowski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: clamp
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '1.3'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '1.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: http
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '4.1'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '4.1'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: bundler
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '1.
|
|
47
|
+
version: '1.17'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '1.
|
|
54
|
+
version: '1.17'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '3.
|
|
61
|
+
version: '3.8'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '3.
|
|
68
|
+
version: '3.8'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rubocop
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.
|
|
75
|
+
version: 0.71.0
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.
|
|
82
|
+
version: 0.71.0
|
|
83
83
|
description: Attend is command line tool that will help you register your Zoho Poeople
|
|
84
84
|
attendance in fast and easy way
|
|
85
85
|
email:
|
|
@@ -102,11 +102,15 @@ files:
|
|
|
102
102
|
- attend.gemspec
|
|
103
103
|
- bin/console
|
|
104
104
|
- bin/setup
|
|
105
|
-
- entrypoiny.rb
|
|
106
105
|
- exe/attend
|
|
107
106
|
- lib/attend.rb
|
|
107
|
+
- lib/attend/get_absent_days.rb
|
|
108
|
+
- lib/attend/register_attendances.rb
|
|
108
109
|
- lib/attend/version.rb
|
|
110
|
+
- lib/zoho/people/api.rb
|
|
109
111
|
- lib/zoho/people/attendance.rb
|
|
112
|
+
- lib/zoho/people/attendance_report.rb
|
|
113
|
+
- lib/zoho/people/attendance_report/record.rb
|
|
110
114
|
homepage: https://github.com/mckomo/attend
|
|
111
115
|
licenses:
|
|
112
116
|
- MIT
|
|
@@ -126,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
126
130
|
- !ruby/object:Gem::Version
|
|
127
131
|
version: '0'
|
|
128
132
|
requirements: []
|
|
129
|
-
|
|
130
|
-
rubygems_version: 2.6.11
|
|
133
|
+
rubygems_version: 3.0.3
|
|
131
134
|
signing_key:
|
|
132
135
|
specification_version: 4
|
|
133
136
|
summary: Register Zoho Poeople attendance using CLI
|
data/entrypoiny.rb
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'httparty'
|
|
4
|
-
|
|
5
|
-
DATE_FORMAT = 'dd/MM/yyyy HH:mm:ss'
|
|
6
|
-
AUTH_TOKEN = '3322c84ac90c17b50ad5268795854197'
|
|
7
|
-
|
|
8
|
-
attendance_endpoint = 'https://people.zoho.com/people/api/attendance'
|
|
9
|
-
|
|
10
|
-
parameters = {
|
|
11
|
-
'authtoken' => AUTH_TOKEN,
|
|
12
|
-
'dateFormat' => DATE_FORMAT,
|
|
13
|
-
'checkIn' => '26/06/2017 10:00:00',
|
|
14
|
-
'checkOut' => '26/06/2017 18:00:00',
|
|
15
|
-
'emailId' => 'krzysztof.kucharski@codete.com'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
response = HTTParty.post(attendance_endpoint, query: parameters)
|
|
19
|
-
|
|
20
|
-
puts response.body, response.code, response.message, response.headers.inspect
|