Class: Meibo::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/meibo/role.rb

Direct Known Subclasses

JapanProfile::RoleJpM0

Constant Summary collapse

TYPES =
{
  primary: "primary",
  secondary: "secondary"
}.freeze
ROLES =
{
  aide: "aide",
  counselor: "counselor",
  district_administrator: "districtAdministrator",
  guardian: "guardian",
  parent: "parent",
  principal: "principal",
  proctor: "proctor",
  relative: "relative",
  site_administrator: "siteAdministrator",
  student: "student",
  system_administrator: "systemAdministrator",
  teacher: "teacher"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(sourced_id:, user_sourced_id:, role_type:, role:, org_sourced_id:, status: nil, date_last_modified: nil, begin_date: nil, end_date: nil, user_profile_sourced_id: nil, **extension_fields) ⇒ Role

Returns a new instance of Role.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/meibo/role.rb', line 51

def initialize(sourced_id:, user_sourced_id:, role_type:, role:, org_sourced_id:, status: nil, date_last_modified: nil,
               begin_date: nil, end_date: nil, user_profile_sourced_id: nil, **extension_fields)
  @sourced_id = sourced_id
  @status = status
  @date_last_modified = date_last_modified
  @user_sourced_id = user_sourced_id
  @role_type = role_type
  @role = role
  @begin_date = begin_date
  @end_date = end_date
  @org_sourced_id = org_sourced_id
  @user_profile_sourced_id = 
  @extension_fields = extension_fields
end

Instance Method Details

#aide?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/meibo/role.rb', line 78

def aide?
  role == ROLES[:aide]
end

#collectionObject



66
67
68
# File 'lib/meibo/role.rb', line 66

def collection
  Meibo.current_roster.roles
end

#counselor?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/meibo/role.rb', line 82

def counselor?
  role == ROLES[:counselor]
end

#district_administrator?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/meibo/role.rb', line 86

def district_administrator?
  role == ROLES[:district_administrator]
end

#guardian?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/meibo/role.rb', line 90

def guardian?
  role == ROLES[:guardian]
end

#organizationObject



126
127
128
# File 'lib/meibo/role.rb', line 126

def organization
  Meibo.current_roster.organizations.find(org_sourced_id)
end

#parent?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/meibo/role.rb', line 94

def parent?
  role == ROLES[:parent]
end

#primary?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/meibo/role.rb', line 70

def primary?
  @role_type == TYPES[:primary]
end

#principal?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/meibo/role.rb', line 98

def principal?
  role == ROLES[:principal]
end

#proctor?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/meibo/role.rb', line 102

def proctor?
  role == ROLES[:proctor]
end

#relative?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/meibo/role.rb', line 106

def relative?
  role == ROLES[:relative]
end

#secondary?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/meibo/role.rb', line 74

def secondary?
  @role_type == TYPES[:secondary]
end

#site_administrator?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/meibo/role.rb', line 110

def site_administrator?
  role == ROLES[:site_administrator]
end

#student?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/meibo/role.rb', line 114

def student?
  role == ROLES[:student]
end

#system_administrator?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/meibo/role.rb', line 118

def system_administrator?
  role == ROLES[:system_administrator]
end

#teacher?Boolean

Returns:

  • (Boolean)


122
123
124
# File 'lib/meibo/role.rb', line 122

def teacher?
  role == ROLES[:teacher]
end

#userObject



130
131
132
# File 'lib/meibo/role.rb', line 130

def user
  Meibo.current_roster.users.find(user_sourced_id)
end

#user_profileObject



134
135
136
# File 'lib/meibo/role.rb', line 134

def 
   && Meibo.current_roster.user_profiles.find()
end