Class: RTunesU::User

Inherits:
Object
  • Object
show all
Defined in:
lib/rtunesu/user.rb

Overview

Represents a User for iTunes U authentication. Requests to iTunes U require User information in a specific format. This class exists to access data in that specific format. Best combined with a User object from your own authentication or LMS system. Webservices requests to iTunes U require your institutions administrator credentials

User

u = RTunesU::User.new(‘191912121’, ‘jsmith’, ‘John Smith’, ‘[email protected]’) u.credentials = [‘Instructor@urn:mace:example.edu’, ‘Learner@urn:mace:example.edu’] u.to_identity_string #=> ‘“John Smith” <[email protected]> (jsmith) [191912121]’ u.to_credential_string #=> ‘Instructor@urn:mace:example.edu;Learner@urn:mace:example.edu’

Interaction with other classes

a User object is required for creating a Connection object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, username, name, email) ⇒ User

Returns a new instance of User.



16
17
18
# File 'lib/rtunesu/user.rb', line 16

def initialize(id, username, name, email)
  self.id, self.username, self.name, self.email = id, username, name, email
end

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



14
15
16
# File 'lib/rtunesu/user.rb', line 14

def credentials
  @credentials
end

#emailObject

Returns the value of attribute email.



14
15
16
# File 'lib/rtunesu/user.rb', line 14

def email
  @email
end

#idObject

Returns the value of attribute id.



14
15
16
# File 'lib/rtunesu/user.rb', line 14

def id
  @id
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/rtunesu/user.rb', line 14

def name
  @name
end

#usernameObject

Returns the value of attribute username.



14
15
16
# File 'lib/rtunesu/user.rb', line 14

def username
  @username
end

Instance Method Details

#to_credential_stringObject



24
25
26
# File 'lib/rtunesu/user.rb', line 24

def to_credential_string
  self.credentials.join(';')
end

#to_identity_stringObject



20
21
22
# File 'lib/rtunesu/user.rb', line 20

def to_identity_string
  '"%s" <%s> (%s) [%s]' % [name, email, username, id]
end