attend 0.1.0 → 2.0.1

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
- SHA1:
3
- metadata.gz: 471822b59755387034cbc0d793c8148d27199f8a
4
- data.tar.gz: 5551b59d7a3d781e08f14e4e557ec597a97f3492
2
+ SHA256:
3
+ metadata.gz: 3821ac26f7e464f34f20aebddf9c0ea6ec05a48e2449f7f0761241968e40d9d0
4
+ data.tar.gz: 66e6a441166ad77a8b4dbbf0d228f323480f37ed6f7b74539de7036c5455c10c
5
5
  SHA512:
6
- metadata.gz: c98e4a99fb66075256c7343d83f4977749fb1382c96d1e32143d51e5e407796760e56ee28f878e66572628b5ebb029883645609a2ef429fedb5e4c0ea4c5e9a3
7
- data.tar.gz: 28448fbbebfdb1de44fafa5c3e617bf5899b3822ff1bad9fa8f56c52fadfd5cac53b6e0f4e5646cec1ebec52297d8aaabfd6ce797fba0ec9ce5fda90bed4aae0
6
+ metadata.gz: de9de2168901829ef26ea336d63cacabea6b9239a58913df3ec77ac5ba4e4f2106157ac5c324546d177e84442e7284690f6349b745a6483c562ebebfa9542256
7
+ data.tar.gz: 18a15085d5f615e4ad42889fab043e37ee372ab233907c41069a281b8f663d813c6ef35019cda1e567523b6af4fcc92ebc7e75cc0bd8cd255f335873dd117afa
data/.rubocop.yml CHANGED
@@ -1,2 +1,7 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.7
1
4
  Documentation:
2
- Enabled: false
5
+ Enabled: false
6
+ Layout/LineLength:
7
+ Max: 120
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.1
1
+ 3.0.0
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
+ script: bundle exec rspec
3
4
  rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.15.1
5
+ - 2.7.2
6
+ - 3
data/Gemfile.lock CHANGED
@@ -1,57 +1,80 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attend (0.1.0)
5
- clamp (~> 1.1)
6
- httparty (~> 0.15)
4
+ attend (2.0.1)
5
+ clamp (~> 1.3)
6
+ http (~> 4.4)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.3.0)
12
- clamp (1.1.2)
13
- diff-lcs (1.3)
14
- httparty (0.15.5)
15
- multi_xml (>= 0.5.2)
16
- multi_xml (0.6.0)
17
- parallel (1.11.2)
18
- parser (2.4.0.0)
19
- ast (~> 2.2)
20
- powerpack (0.1.1)
21
- rainbow (2.2.2)
11
+ addressable (2.8.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ ast (2.4.2)
14
+ clamp (1.3.2)
15
+ diff-lcs (1.4.4)
16
+ domain_name (0.5.20190701)
17
+ unf (>= 0.0.5, < 1.0.0)
18
+ ffi (1.15.4)
19
+ ffi-compiler (1.0.1)
20
+ ffi (>= 1.0.0)
22
21
  rake
23
- rake (10.5.0)
24
- rspec (3.6.0)
25
- rspec-core (~> 3.6.0)
26
- rspec-expectations (~> 3.6.0)
27
- rspec-mocks (~> 3.6.0)
28
- rspec-core (3.6.0)
29
- rspec-support (~> 3.6.0)
30
- rspec-expectations (3.6.0)
22
+ http (4.4.1)
23
+ addressable (~> 2.3)
24
+ http-cookie (~> 1.0)
25
+ http-form_data (~> 2.2)
26
+ http-parser (~> 1.2.0)
27
+ http-cookie (1.0.4)
28
+ domain_name (~> 0.5)
29
+ http-form_data (2.3.0)
30
+ http-parser (1.2.3)
31
+ ffi-compiler (>= 1.0, < 2.0)
32
+ parallel (1.21.0)
33
+ parser (3.0.2.0)
34
+ ast (~> 2.4.1)
35
+ public_suffix (4.0.6)
36
+ rainbow (3.0.0)
37
+ rake (13.0.6)
38
+ regexp_parser (2.1.1)
39
+ rexml (3.2.5)
40
+ rspec (3.10.0)
41
+ rspec-core (~> 3.10.0)
42
+ rspec-expectations (~> 3.10.0)
43
+ rspec-mocks (~> 3.10.0)
44
+ rspec-core (3.10.1)
45
+ rspec-support (~> 3.10.0)
46
+ rspec-expectations (3.10.1)
31
47
  diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.6.0)
33
- rspec-mocks (3.6.0)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-mocks (3.10.2)
34
50
  diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.6.0)
36
- rspec-support (3.6.0)
37
- rubocop (0.49.1)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-support (3.10.2)
53
+ rubocop (1.22.0)
38
54
  parallel (~> 1.10)
39
- parser (>= 2.3.3.1, < 3.0)
40
- powerpack (~> 0.1)
41
- rainbow (>= 1.99.1, < 3.0)
55
+ parser (>= 3.0.0.0)
56
+ rainbow (>= 2.2.2, < 4.0)
57
+ regexp_parser (>= 1.8, < 3.0)
58
+ rexml
59
+ rubocop-ast (>= 1.12.0, < 2.0)
42
60
  ruby-progressbar (~> 1.7)
43
- unicode-display_width (~> 1.0, >= 1.0.1)
44
- ruby-progressbar (1.8.1)
45
- unicode-display_width (1.3.0)
61
+ unicode-display_width (>= 1.4.0, < 3.0)
62
+ rubocop-ast (1.12.0)
63
+ parser (>= 3.0.1.1)
64
+ ruby-progressbar (1.11.0)
65
+ unf (0.1.4)
66
+ unf_ext
67
+ unf_ext (0.0.8)
68
+ unicode-display_width (2.1.0)
46
69
 
47
70
  PLATFORMS
48
71
  ruby
49
72
 
50
73
  DEPENDENCIES
51
74
  attend!
52
- bundler (~> 1.15)
53
- rspec (~> 3.0)
54
- rubocop (~> 0.49.1)
75
+ bundler (~> 2.1)
76
+ rspec (~> 3.9)
77
+ rubocop (~> 1.11)
55
78
 
56
79
  BUNDLED WITH
57
- 1.15.1
80
+ 2.2.13
data/README.md CHANGED
@@ -1,35 +1,37 @@
1
- # Attend
1
+ # Attend [![Build Status](https://travis-ci.org/mckomo/attend.svg?branch=master)](https://travis-ci.org/mckomo/attend)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/attend`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- Add this line to your application's Gemfile:
7
+ Install `attend` Ruby gem:
10
8
 
11
- ```ruby
12
- gem 'attend'
9
+ ```bash
10
+ gem install attend
13
11
  ```
14
12
 
15
- And then execute:
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
- TODO: Write usage instructions here
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
- ## Development
19
+ ```bash
20
+ export ZOHO_PEOPLE_ROOT_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.
23
+ To register attendance on current day:
30
24
 
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).
25
+ ```bash
26
+ attend --email "your.employee@email.com" --check_in "10:00" --check_out "18:00"
27
+ # Successfully registered attendance from 2017-07-04T10:00:00+10:00 to 2017-07-04T18:00:00+18:00
28
+ ```
32
29
 
33
- ## Contributing
30
+ You can also register attendance for a few days:
34
31
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/attend.
32
+ ```bash
33
+ attend --email "your.employee@email.com" --check_in "10:00" --check_out "18:00" --from "04/07/2017" --to "07/07/2017"
34
+ # Successfully registered attendance from 2017-07-04T10:00:00+10:00 to 2017-07-04T18:00:00+18:00
35
+ # Successfully registered attendance from 2017-07-05T10:00:00+10:00 to 2017-07-05T18:00:00+18:00
36
+ # ...
37
+ ```
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('../lib', __FILE__)
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
 
@@ -12,8 +11,10 @@ Gem::Specification.new do |spec|
12
11
  spec.email = ['mckomo@gmail.com']
13
12
  spec.license = 'MIT'
14
13
 
15
- spec.summary = 'Register Zoho Poeople attendance using CLI'
16
- spec.description = 'Attend is command line tool that will help you register your Zoho Poeople attendance in fast and easy way'
14
+ spec.required_ruby_version = '>= 2.7.2'
15
+
16
+ spec.summary = 'Register Zoho People attendance using CLI'
17
+ spec.description = 'Attend is CLI tool that will help you register your Zoho People attendance in fast and easy way'
17
18
  spec.homepage = 'https://github.com/mckomo/attend'
18
19
 
19
20
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -23,10 +24,10 @@ Gem::Specification.new do |spec|
23
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
25
  spec.require_paths = ['lib']
25
26
 
26
- spec.add_dependency 'httparty', '~> 0.15'
27
- spec.add_dependency 'clamp', '~> 1.1'
27
+ spec.add_dependency 'clamp', '~> 1.3'
28
+ spec.add_dependency 'http', '~> 4.4'
28
29
 
29
- spec.add_development_dependency 'bundler', '~> 1.15'
30
- spec.add_development_dependency 'rspec', '~> 3.0'
31
- spec.add_development_dependency 'rubocop', '~> 0.49.1'
30
+ spec.add_development_dependency 'bundler', '~> 2.1'
31
+ spec.add_development_dependency 'rspec', '~> 3.9'
32
+ spec.add_development_dependency 'rubocop', '~> 1.11'
32
33
  end
data/exe/attend CHANGED
@@ -1,54 +1,33 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ STDOUT.sync = true
2
5
 
3
6
  require 'clamp'
4
7
  require 'date'
5
- require 'httparty'
6
8
 
7
- AUTH_TOKEN = ENV['ZOHO_PEOPLE_AUTH_TOKEN']
8
- DATE_FORMAT = 'dd/MM/yyyy HH:mm:ss'
9
+ require_relative '../lib/attend'
9
10
 
10
- parse_date = ->(v) { Date.parse(v) }
11
+ parse_date = Date.method(:parse)
11
12
 
12
13
  Clamp do
13
14
  option '--email', 'EMAIL', 'employee email id', required: true
14
- option '--check_in', 'CHECK_IN', 'check in time', required: true
15
- option '--check_out', 'CHECK_OUT', 'check out time', required: true
15
+ option '--check_in', 'CHECK_IN', 'check in time', default: '9:00'
16
+ option '--check_out', 'CHECK_OUT', 'check out time', default: '17:00'
16
17
  option '--from', 'FROM', 'date of the first work day', default: Date.today, &parse_date
17
18
  option '--to', 'TO', 'date of the las work day', default: Date.today, &parse_date
18
19
  option '--dry', :flag, 'enables dry run'
20
+ option '--verbose', :flag, 'print verbose error message'
19
21
 
20
22
  def execute
21
- days_between = from.step(to).reject(&:sunday?).reject(&:saturday?)
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
23
+ Attend.register(email: email, from: from, to: to, check_in: check_in, check_out: check_out, dry_run: dry?)
24
+ rescue StandardError => e
25
+ if verbose?
26
+ puts e.full_message
27
+ else
28
+ puts e.message
39
29
  end
40
- end
41
30
 
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)
31
+ exit 1
52
32
  end
53
33
  end
54
-
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Attend
4
- VERSION = '0.1.0'
4
+ VERSION = '2.0.1'
5
5
  end
data/lib/attend.rb CHANGED
@@ -1,7 +1,34 @@
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
- # Your code goes here...
10
+ def self.register(email:, from:, to:, check_in:, check_out:, dry_run: true)
11
+ absent_days = GetAbsentDays.new(zoho: zoho_api).call(email: email, from: from, to: to)
12
+
13
+ if absent_days.empty?
14
+ puts "No absent days between #{from} and #{to}"
15
+ return
16
+ end
17
+
18
+ attendances = absent_days.map do |day|
19
+ day_beginning = day.to_datetime
20
+
21
+ Zoho::People::Attendance.new(email: email,
22
+ check_in: day_beginning.new_offset("+#{check_in}"),
23
+ check_out: day_beginning.new_offset("+#{check_out}"))
24
+ end
25
+
26
+ RegisterAttendances.new(zoho: zoho_api, dry_run: dry_run).call(attendances)
27
+ end
28
+
29
+ def self.zoho_api
30
+ Zoho::People::API.new
31
+ end
32
+
33
+ private_class_method :zoho_api
7
34
  end
@@ -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_ROOT_TOKEN'])
15
+ raise 'You must provide Zoho People authorization 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
- DATE_FORMAT = 'dd/MM/yyyy HH:mm:ss'
6
+ attr_reader :check_in, :check_out, :email
7
7
 
8
- attr_reader :check_in, :check_out, :email_id
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
- def initialize(check_in:, check_out:, email_id:)
12
+ @email = email
11
13
  @check_in = check_in
12
14
  @check_out = check_out
13
- @email_id = email_id
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,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
@@ -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
metadata CHANGED
@@ -1,87 +1,87 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Komorowski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-01 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: httparty
14
+ name: clamp
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.15'
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: '0.15'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: clamp
28
+ name: http
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.1'
33
+ version: '4.4'
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: '1.1'
40
+ version: '4.4'
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.15'
47
+ version: '2.1'
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.15'
54
+ version: '2.1'
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.0'
61
+ version: '3.9'
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.0'
68
+ version: '3.9'
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.49.1
75
+ version: '1.11'
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.49.1
83
- description: Attend is command line tool that will help you register your Zoho Poeople
84
- attendance in fast and easy way
82
+ version: '1.11'
83
+ description: Attend is CLI tool that will help you register your Zoho People attendance
84
+ in fast and easy way
85
85
  email:
86
86
  - mckomo@gmail.com
87
87
  executables:
@@ -102,16 +102,20 @@ 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
113
117
  metadata: {}
114
- post_install_message:
118
+ post_install_message:
115
119
  rdoc_options: []
116
120
  require_paths:
117
121
  - lib
@@ -119,16 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
123
  requirements:
120
124
  - - ">="
121
125
  - !ruby/object:Gem::Version
122
- version: '0'
126
+ version: 2.7.2
123
127
  required_rubygems_version: !ruby/object:Gem::Requirement
124
128
  requirements:
125
129
  - - ">="
126
130
  - !ruby/object:Gem::Version
127
131
  version: '0'
128
132
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.6.11
131
- signing_key:
133
+ rubygems_version: 3.2.13
134
+ signing_key:
132
135
  specification_version: 4
133
- summary: Register Zoho Poeople attendance using CLI
136
+ summary: Register Zoho People attendance using CLI
134
137
  test_files: []
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