Class: NoyoFulfillment::Employee

Inherits:
ApiResource show all
Includes:
Mixins::HasPerson
Defined in:
lib/noyo_fulfillment/models/employee.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixins::HasPerson

#name, #person=

Methods inherited from ApiResource

all, authenticate, #create, #create_hash, #create_url, find, get_body, handle_unauthenticated, headers, #initialize, perform_request_authenticated, resource_path_name, resource_url, #resource_url, single_resource_url, #single_resource_url

Methods included from NoyoApi::Client::UserAgent

included

Methods inherited from BaseModel

#==, #attributes, class_name, #excluded_attributes, #initialize, #inspect, #synced_attributes, #to_h, #update_attrs

Constructor Details

This class inherits a constructor from NoyoFulfillment::ApiResource

Instance Attribute Details

#employmentObject

Returns the value of attribute employment.



7
8
9
# File 'lib/noyo_fulfillment/models/employee.rb', line 7

def employment
  @employment
end

#group_idObject

Returns the value of attribute group_id.



7
8
9
# File 'lib/noyo_fulfillment/models/employee.rb', line 7

def group_id
  @group_id
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/noyo_fulfillment/models/employee.rb', line 7

def id
  @id
end

Instance Method Details

#check_id!Object



18
19
20
21
22
# File 'lib/noyo_fulfillment/models/employee.rb', line 18

def check_id!
  if id.nil? || id.empty?
    raise 'Must have an employee ID before creating a member request. Is this employee created?'
  end
end

#create_demographic_change_request(options = {}) ⇒ Object



90
91
92
93
94
# File 'lib/noyo_fulfillment/models/employee.rb', line 90

def create_demographic_change_request(options = {})
  member_request_attrs = demographic_change_request_attrs(options)
  member_request = MemberRequest.demographic_request(member_request_attrs)
  member_request.create
end

#create_new_hire_request(options = {}) ⇒ Object



78
79
80
81
82
# File 'lib/noyo_fulfillment/models/employee.rb', line 78

def create_new_hire_request(options = {})
  member_request_attrs = new_hire_request_attrs(options)
  member_request = MemberRequest.new_hire_request(member_request_attrs)
  member_request.create
end

#create_open_enrollment_request(options = {}) ⇒ Object



96
97
98
99
100
# File 'lib/noyo_fulfillment/models/employee.rb', line 96

def create_open_enrollment_request(options = {})
  member_request_attrs = open_enrollment_request_attrs(options)
  member_request = MemberRequest.open_enrollment_request(member_request_attrs)
  member_request.create
end

#create_qualifying_life_event_request(options = {}) ⇒ Object



102
103
104
105
106
# File 'lib/noyo_fulfillment/models/employee.rb', line 102

def create_qualifying_life_event_request(options = {})
  member_request_attrs = qualifying_life_event_request_attrs(options)
  member_request = MemberRequest.qualifying_life_event_request(member_request_attrs)
  member_request.create
end

#create_termination_request(options = {}) ⇒ Object



84
85
86
87
88
# File 'lib/noyo_fulfillment/models/employee.rb', line 84

def create_termination_request(options = {})
  member_request_attrs = termination_request_attrs(options)
  member_request = MemberRequest.termination_request(member_request_attrs)
  member_request.create
end

#demographic_change_request_attrs(options = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/noyo_fulfillment/models/employee.rb', line 45

def demographic_change_request_attrs(options = {})
  check_id!

  options.merge(employee_id: id)
  body = NoyoFulfillment::DemographicChange.new(options).attributes
  {
    employee_id: id,
    body: body,
  }
end

#individual_enrollmentsObject



14
15
16
# File 'lib/noyo_fulfillment/models/employee.rb', line 14

def individual_enrollments
  IndividualEnrollment.all(employee_id: id)
end

#new_hire_request_attrs(options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/noyo_fulfillment/models/employee.rb', line 24

def new_hire_request_attrs(options = {})
  check_id!

  body = NoyoFulfillment::NewHire.new(options).attributes
  {
    employee_id: id,
    body: body,
  }
end

#open_enrollment_request_attrs(options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/noyo_fulfillment/models/employee.rb', line 56

def open_enrollment_request_attrs(options = {})
  check_id!

  options.merge(employee_id: id)
  body = NoyoFulfillment::OpenEnrollment.new(options).attributes
  {
    employee_id: id,
    body: body,
  }
end

#qualifying_life_event_request_attrs(options = {}) ⇒ Object



67
68
69
70
71
72
73
74
75
76
# File 'lib/noyo_fulfillment/models/employee.rb', line 67

def qualifying_life_event_request_attrs(options = {})
  check_id!

  options.merge(employee_id: id)
  body = NoyoFulfillment::QualifyingLifeEvent.new(options).attributes
  {
    employee_id: id,
    body: body,
  }
end

#termination_request_attrs(options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/noyo_fulfillment/models/employee.rb', line 34

def termination_request_attrs(options = {})
  check_id!

  options.merge(employee_id: id)
  body = NoyoFulfillment::Termination.new(options).attributes
  {
    employee_id: id,
    body: body,
  }
end