Class: RTunesU::User
- Inherits:
-
Object
- Object
- RTunesU::User
- 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
-
#credentials ⇒ Object
Returns the value of attribute credentials.
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(id, username, name, email) ⇒ User
constructor
A new instance of User.
- #to_credential_string ⇒ Object
- #to_identity_string ⇒ Object
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
#credentials ⇒ Object
Returns the value of attribute credentials.
14 15 16 |
# File 'lib/rtunesu/user.rb', line 14 def credentials @credentials end |
#email ⇒ Object
Returns the value of attribute email.
14 15 16 |
# File 'lib/rtunesu/user.rb', line 14 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
14 15 16 |
# File 'lib/rtunesu/user.rb', line 14 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
14 15 16 |
# File 'lib/rtunesu/user.rb', line 14 def name @name end |
#username ⇒ Object
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_string ⇒ Object
24 25 26 |
# File 'lib/rtunesu/user.rb', line 24 def to_credential_string self.credentials.join(';') end |
#to_identity_string ⇒ Object
20 21 22 |
# File 'lib/rtunesu/user.rb', line 20 def to_identity_string '"%s" <%s> (%s) [%s]' % [name, email, username, id] end |