Module: CodinRep::InstanceMethods

Defined in:
lib/codin_rep.rb

Instance Method Summary collapse

Instance Method Details

#get_employerObject



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/codin_rep.rb', line 50

def get_employer
  command = CodinRep::GetAfdHeader.new(self.ip, self.tcp_port)
  response = command.execute

  hash = {}
  hash[:document_type] = response.employer_type
  hash[:document_number] = response.employer_document
  hash[:cei_document] = response.employer_cei
  hash[:company_name] = response.employer_name

  return hash
end

#get_records(first_id = nil) ⇒ Object



69
70
71
72
73
# File 'lib/codin_rep.rb', line 69

def get_records(first_id=nil)
  command = CodinRep::GetRecords.new(first_id, self.ip, self.tcp_port)
  response = command.execute
  response
end

#get_serial_numberObject



63
64
65
66
67
# File 'lib/codin_rep.rb', line 63

def get_serial_number
  command = CodinRep::GetAfdHeader.new(self.ip, self.tcp_port)
  response = command.execute
  response.rep_serial_number
end

#get_timeObject



37
38
39
40
41
# File 'lib/codin_rep.rb', line 37

def get_time
  command = CodinRep::GetTime.new(self.ip, self.tcp_port)
  response = command.execute
  return response
end

#set_employee(operation_type, registration, pis_number, name) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/codin_rep.rb', line 75

def set_employee(operation_type, registration, pis_number, name)
  if [:add, :edit].include? operation_type
    command = CodinRep::AddEmployee.new(registration, pis_number, name, self.ip, self.tcp_port)
  elsif operation_type == :remove
    command = CodinRep::DelEmployee.new(registration, self.ip, self.tcp_port)
  else
    raise EmployeeCommand::UnknownEmployeeOperation.new(operation_type)
  end
  response = command.execute
  response
end

#set_time(time, dst_start = nil, dst_end = nil) ⇒ Object

the DST parameters are just placeholders, for now.



44
45
46
47
48
# File 'lib/codin_rep.rb', line 44

def set_time(time, dst_start=nil, dst_end=nil)
  command = CodinRep::SetTime.new(time, self.ip, self.tcp_port)
  response = command.execute
  return response
end