Module: CodinRep::InstanceMethods

Defined in:
lib/codin_rep.rb

Instance Method Summary collapse

Instance Method Details

#get_employerObject



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

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



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

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



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

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



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

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) ⇒ Object



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

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