Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/codin_rep.rb | 87 | 87 | 0.00%
|
0.00%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
2 # -*- coding: utf-8 -*- |
3 # codinrep - Gem para acesso de REPs da Telebyte |
4 # Copyright (C) 2016 O.S. Systems Softwares Ltda. |
5 |
6 # This program is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU Affero General Public License as |
8 # published by the Free Software Foundation, either version 3 of the |
9 # License, or (at your option) any later version. |
10 |
11 # This program is distributed in the hope that it will be useful, |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 # GNU Affero General Public License for more details. |
15 |
16 # You should have received a copy of the GNU Affero General Public License |
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 |
19 # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil. |
20 # e-mail: contato@ossystems.com.br |
21 |
22 require "codin_rep/add_employee" |
23 require "codin_rep/employee_command" |
24 require "codin_rep/get_time" |
25 require "codin_rep/set_time" |
26 require "codin_rep/get_records" |
27 require "codin_rep/del_employee" |
28 |
29 module CodinRep |
30 class << self |
31 def included(base) |
32 return if base.included_modules.include?(InstanceMethods) |
33 base.send(:include, InstanceMethods) |
34 end |
35 end |
36 |
37 module InstanceMethods |
38 def get_time |
39 command = CodinRep::GetTime.new(self.ip, self.tcp_port) |
40 response = command.execute |
41 return response |
42 end |
43 |
44 # the DST parameters are just placeholders, for now. |
45 def set_time(time, dst_start=nil, dst_end=nil) |
46 command = CodinRep::SetTime.new(time, self.ip, self.tcp_port) |
47 response = command.execute |
48 return response |
49 end |
50 |
51 def get_employer |
52 command = CodinRep::GetAfdHeader.new(self.ip, self.tcp_port) |
53 response = command.execute |
54 |
55 hash = {} |
56 hash[:document_type] = response.employer_type |
57 hash[:document_number] = response.employer_document |
58 hash[:cei_document] = response.employer_cei |
59 hash[:company_name] = response.employer_name |
60 |
61 return hash |
62 end |
63 |
64 def get_serial_number |
65 command = CodinRep::GetAfdHeader.new(self.ip, self.tcp_port) |
66 response = command.execute |
67 response.rep_serial_number |
68 end |
69 |
70 def get_records(first_id=nil) |
71 command = CodinRep::GetRecords.new(first_id, self.ip, self.tcp_port) |
72 response = command.execute |
73 response |
74 end |
75 |
76 def set_employee(operation_type, registration, pis_number, name) |
77 if [:add, :edit].include? operation_type |
78 command = CodinRep::AddEmployee.new(registration, pis_number, name, self.ip, self.tcp_port) |
79 elsif operation_type == :remove |
80 command = CodinRep::DelEmployee.new(registration, self.ip, self.tcp_port) |
81 else |
82 raise EmployeeCommand::UnknownEmployeeOperation.new(operation_type) |
83 end |
84 response = command.execute |
85 response |
86 end |
87 end |
88 end |
Generated on 2017-02-21 09:19:39 -0300 with SimpleCov-RCov 0.2.3