<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,6 @@
+= 0.0.3 2008-10-08
+ * support attachment resource
+
 = 0.0.2 2008-06-10
 * gem published
 </diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,7 @@ EXTRA_DEPENDENCIES = [
 
 @config_file = &quot;~/.rubyforge/user-config.yml&quot;
 @config = nil
-RUBYFORGE_USERNAME = &quot;unknown&quot;
+RUBYFORGE_USERNAME = &quot;deepblue&quot;
 def rubyforge_username
   unless @config
     begin</diff>
      <filename>config/hoe.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,11 +12,12 @@ module Springnote
     attr_accessor :name, :config
     
     # config should have app_key, user_openid, user_key
-    def initialize(name, config)
+    def initialize(name, config = {})
       @name, @config = name, config
     end
   
     def pages
+      raise ConfigurationMissing unless @config[:app_key]
       CallProxy.new(Page, self)
     end
         
@@ -28,7 +29,7 @@ module Springnote
       @config[:user_key] ? &quot;#{@config[:user_key]}.#{@config[:app_key]}&quot; : @config[:app_key]
     end
     
-    def url(path = '/', params = {})
+    def make_url(path = '/', params = {})
       query = params.map{|k,v| &quot;#{k}=#{CGI.escape(v.to_s)}&quot;}.join('&amp;')
       &quot;http://api.springnote.com#{path}?domain=#{@name}&amp;#{query}&quot;
     end
@@ -36,12 +37,30 @@ module Springnote
   
 
   class Page &lt; Resource    
-    def self.singular_name
-      'page'
+    def self.singular_name;   'page'  end
+    def self.collection_name; 'pages' end
+    
+    def attachments
+      CallProxy.new(Attachment, self)
     end
     
-    def self.collection_name
-      'pages'
-    end    
+    def make_url(path = '/', params = {})
+      if self.hash
+        holder.make_url(&quot;/pages/#{self.hash['identifier']}#{path}&quot;, params)
+      else
+        holder.make_url(path, params)        
+      end
+    end
+  end
+  
+  class Attachment &lt; Resource
+    def self.singular_name;   'attachment'  end
+    def self.collection_name; 'attachments' end    
   end
+  
+  def make_url(path = '/', params = {})
+    holder.make_url(path, params)
+  end
+    
+  class ConfigurationMissing &lt; RuntimeError; end
 end</diff>
      <filename>lib/springnote_client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,8 +23,8 @@ module Springnote
     class &lt;&lt; self
       def build(hsh, holder)
         new_resource(collection_url(holder), holder, hsh)
-      end      
-      
+      end
+            
       def new_resource(url, holder, hash = nil)
         ret = new(url, holder.username, holder.password)
         ret.holder = holder
@@ -32,18 +32,20 @@ module Springnote
         if block_given?
           ret.hash = yield(ret)
         elsif hash
+          identifier = hash.delete('identifier')
           ret.hash = hash
+          ret.identifier = identifier if identifier
         end
 
         ret
       end
       
       def element_url(holder, id, params = {})
-        holder.url(&quot;/#{collection_name}/#{id}&quot;, params)
+        holder.make_url(&quot;/#{collection_name}/#{id}&quot;, params)
       end
 
       def collection_url(holder, params = {})
-        holder.url(&quot;/#{collection_name}&quot;, params)
+        holder.make_url(&quot;/#{collection_name}&quot;, params)
       end      
       
       def find(*args)
@@ -59,20 +61,34 @@ module Springnote
           Hash.from_xml(ret.get(:accept =&gt; XML))[ret.singular_name]
         end
       end
+      
+      def find_all(holder)
+        find_multi(holder)
+      end
 
       def find_some(ids, holder)
-        ret = new_resource(collection_url(holder, :identifiers =&gt; ids.join(','), :detail =&gt; true), holder).get(:accept =&gt; 'application/xml')
+        find_multi(holder, :identifiers =&gt; ids.join(','), :detail =&gt; true)
+      end
+      
+      def find_multi(holder, params = {})
+        target = collection_url(holder, params)
+        ret = new_resource(target, holder).get(:accept =&gt; 'application/xml')
+
         Hash.from_xml(ret)[collection_name].map do |item|
           new_resource(element_url(holder, item['identifier']), holder, item)
         end
       rescue RuntimeError
         []  
       end
+      
+      def search(query, holder)
+        find_multi(holder, :q =&gt; query)
+      end
     end 
-    
+
     def method_missing(method, *args)
       str = method.to_s
-      str[-1] == ?= ?
+      (str[-1].to_s == &quot;=&quot;) ?
         @hash[str[0..-2]] = args[0] : 
         @hash[str]
     end
@@ -91,6 +107,17 @@ module Springnote
       self
     end
     
+    def delete
+      super
+      self.identifier = nil
+    end
+    
+    def identifier=(newval)
+      @hash['identifier'] = newval
+      self.url = element_url
+      newval
+    end
+    
     def element_url
       self.class.element_url(holder, @hash['identifier'])
     end</diff>
      <filename>lib/springnote_client/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ module SpringnoteClient #:nodoc:
   module VERSION #:nodoc:
     MAJOR = 0
     MINOR = 0
-    TINY  = 2
+    TINY  = 3
 
     STRING = [MAJOR, MINOR, TINY].join('.')
   end</diff>
      <filename>lib/springnote_client/version.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fdff940e002743e60ff27fdc27daa9d4d302cb9f</id>
    </parent>
  </parents>
  <author>
    <name>Bryan Kang</name>
    <email>deepblue@deepblue.local</email>
  </author>
  <url>http://github.com/deepblue/springnote_client/commit/b9820c1134923cc6c73fcb7a73bdfaa6a874c7b2</url>
  <id>b9820c1134923cc6c73fcb7a73bdfaa6a874c7b2</id>
  <committed-date>2008-10-07T17:29:02-07:00</committed-date>
  <authored-date>2008-10-07T17:29:02-07:00</authored-date>
  <message>0.0.3 attachment resource</message>
  <tree>b6d15da52c63fd00b6cf912150f66860a4d60aa2</tree>
  <committer>
    <name>Bryan Kang</name>
    <email>deepblue@deepblue.local</email>
  </committer>
</commit>
