Class: Lessonly::User

Inherits:
Resource
  • Object
show all
Defined in:
lib/lessonly/resource/user.rb

Instance Method Summary collapse

Methods inherited from Resource

all, basename, client, #client, collection_path, create, define_has_many_getter, #destroy, find, find_by_href, has_many, has_one, #href, #reload, #update

Instance Method Details

#assigned_to?(course) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/lessonly/resource/user.rb', line 3

def assigned_to?(course)
  course.assignments.map(&:assignee_id).include?(id)
end

#serializeObject



7
8
9
10
11
# File 'lib/lessonly/resource/user.rb', line 7

def serialize
  blacklist = /[`!@#\$%\^&\*\+=\(\)\|\[\];]/
  attrs[:name] = name.gsub(blacklist, '').strip.squeeze(' ')
  self
end