rtunesu 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,5 @@
1
- == 0.0.1 2008-06-27
1
+
2
+ Pre 0.2.3 2008-09-12
2
3
 
3
4
  * 1 major enhancement:
4
5
  * Initial release
data/README.txt CHANGED
@@ -1,7 +1,12 @@
1
1
  = RTunesU
2
2
 
3
3
  == DESCRIPTION:
4
- RTunesU is a ruby library for accessing Apple's iTunes U Webservices to integrate your education institutions iTunes U account into ruby applications
4
+ RTunesU is a ruby library for accessing Apple's iTunes U Webservices to integrate your education institutions iTunes U account into ruby applications. iTunes U's Webservices interface is fairly primitive by today's standards for XML based APIs. Some known flaws of iTunes U
5
+ * No arbitrary search
6
+ * Queries for missing objects return an XML document representing the entire institution instead of returning an error
7
+ * Does not follow REST principles
8
+ * Does not use HTTP status codes meaningfully
9
+ * Collections not contained in an outer element
5
10
 
6
11
  == FEATURES/PROBLEMS:
7
12
  - TODO: file uploading
@@ -14,7 +19,7 @@ http://github.com/trek/rtunesu/wikis
14
19
  RTunesU depends on the ruby-hmac, hpricot, and builder libraries. These should all install automatically as dependencies when installing RTunesU
15
20
 
16
21
  == INSTALL:
17
- RTunesU install via rubygems. wit
22
+ RTunesU install via rubygems with
18
23
  gem instal rtunesu
19
24
 
20
25
  == LICENSE:
@@ -6,12 +6,15 @@ module RTunesU
6
6
  # c = Course.find(12345, itunes_connection_object)
7
7
  # c.Name # "Exemple Course"
8
8
  # c.Name = 'Example Course'
9
- # c.save # genertes and sends a Document::Merge object with the Course data.
9
+ # c.save(itunes_connection_object) # genertes and sends a Document::Merge object with the Course data.
10
10
  module Document
11
11
  class Base
12
12
  INDENT = 2
13
13
  attr_accessor :builder, :source, :options, :xml
14
14
 
15
+ # Creates a new XML document using Builder. Includes the required XML entities of
16
+ # ITunesUDocument and Version, then calls tag_action to add in specific XML entities for
17
+ # the type of document being built. tag_action is defined in each sublcass of Document.
15
18
  def initialize(source, options = {})
16
19
  self.source, self.options = source, options
17
20
  builder = Builder::XmlMarkup.new(:indent => INDENT)
@@ -1,4 +1,5 @@
1
1
  module RTunesU
2
+ # A visual theme for iTunesU pages. Color values are in 6 digit hex (e.g. #ffffff)
2
3
  # == Attributes
3
4
  # Name
4
5
  # Handle
@@ -13,11 +13,21 @@ module RTunesU
13
13
  # DownloadURL
14
14
  # Comment
15
15
  class Track < Entity
16
- # Tracks can only be found from within their Course. There is currently no way to find a Track separete from its Course.
16
+ # Tracks can only be found from within their Course. There is currently no way to find a Track separete from its Course in iTunes U.
17
17
  def self.find(handle, course_handle, connection)
18
18
  entity = self.new(:handle => handle)
19
19
  entity.source_xml = Course.find(course_handle, connection).source_xml.at("Handle[text()=#{entity.handle}]..")
20
20
  entity
21
21
  end
22
+
23
+ # Duration in millseconds is the one attribute in plural form that is not a collection
24
+ def DurationMilliseconds
25
+ self.value_from_edits_or_store('DurationMilliseconds')
26
+ end
27
+
28
+ # Duration in millseconds is the one attribute in plural form that is not a collection
29
+ def DurationMilliseconds=(duration)
30
+ self.edits['DurationMilliseconds'] = duration
31
+ end
22
32
  end
23
33
  end
@@ -39,7 +39,7 @@ module RTunesU
39
39
  self.attributes = {}
40
40
  attrs.each {|attribute, value| self.send("#{attribute}=", value)}
41
41
  end
42
-
42
+
43
43
  # Finds a specific entity in iTunes U. To find an entity you will need to know both its type (Course, Group, etc) and handle. Handles uniquely identify entities in iTunes U and the entity type is used to search the returned XML for the specific entity you are looking for. For example,
44
44
  # Course.find(123456, rtunes_connection_object)
45
45
  def self.find(handle, connection)
@@ -71,7 +71,8 @@ module RTunesU
71
71
  end
72
72
 
73
73
  def method_missing(method_name, args = nil)
74
- # introspect the kind of method call (read one attribute, read an array of related items, write one attribute, write an array of related items)
74
+ # introspect the kind of method call (read one attribute,
75
+ # read an array of related items, write one attribute, write an array of related items)
75
76
  case method_name.to_s.match(/(s)*(=)*$/).captures
76
77
  when [nil, "="] : self.edits[method_name.to_s[0..-2]] = args
77
78
  when ["s", "="] : self.edits[method_name.to_s[0..-2]] = args
@@ -101,7 +102,7 @@ module RTunesU
101
102
  # course.class #=> 'RTunesU::Course'
102
103
  # course.class_name #=> 'Course'
103
104
  def class_name
104
- self.class.to_s.split(':').last
105
+ self.class.to_s.split('::').last
105
106
  end
106
107
 
107
108
  # Returns the handle of the entitiy's parent. This can either be set directly as a string or interger or will access the parent entity. Sometimes you know the parent_handle without the parent object (for example, stored locally from an earlier request). This allows you to add a new Entity to iTunes U without first firing a reques for a prent entity (For example, if your institution places all inside the same Section, you want to add a new Section to your Site, or a new Group to a course tied to your institution's LMS).
@@ -116,11 +117,13 @@ module RTunesU
116
117
  }
117
118
  end
118
119
 
120
+ # called when .save is called on an object that is already stored in iTunes U
119
121
  def update(connection)
120
122
  connection.process(Document::Merge.new(self).xml)
121
123
  self
122
124
  end
123
125
 
126
+ # called when .save is called on an object that has no Handle (i.e. does not already exist in iTunes U)
124
127
  def create(connection)
125
128
  response = Hpricot.XML(connection.process(Document::Add.new(self).xml))
126
129
  raise Exception, response.at('error').innerHTML if response.at('error')
@@ -2,7 +2,7 @@ module RTunesU
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtunesu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trek Glowacki
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-09 00:00:00 -04:00
12
+ date: 2008-09-12 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency