<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>init.rb</filename>
    </added>
    <added>
      <filename>lib/satisfaction/reply.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,3 @@
 tmp/*
-log/*
\ No newline at end of file
+log/*
+pkg
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -61,9 +61,10 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
   p.changes = p.paragraphs_of(&quot;History.txt&quot;, 0..1).join(&quot;\\n\\n&quot;)
   p.extra_deps = [
     ['rspec', &quot;&gt;= 1.0.8&quot;],
-    ['active_support', &quot;&gt;= 1.4.2&quot;],
+    ['activesupport', &quot;&gt;= 1.4.2&quot;],
     ['hpricot', &quot;&gt;= 0.6.0&quot;],
-    ['memcache-client', &quot;&gt;= 1.5.0&quot;]
+    ['memcache-client', &quot;&gt;= 1.5.0&quot;],
+    ['oauth', &quot;&gt;= 0.2.0&quot;],
   ]     
   #p.spec_extras = {}    # A hash of extra values to set in the gemspec.
   </diff>
      <filename>config/hoe.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,10 @@ require 'json'
 gem('memcache-client')
 require 'memcache'
 
+require 'oauth'
+require 'oauth/signature/hmac/sha1'
+require 'oauth/client/net_http'
+
 require 'satisfaction/has_satisfaction'
 require 'satisfaction/loader'
 require 'satisfaction/associations'
@@ -15,17 +19,25 @@ require 'satisfaction/person'
 require 'satisfaction/topic'
 # require 'satisfaction/tag'
 # require 'satisfaction/product'
-# require 'satisfaction/reply'
+require 'satisfaction/reply'
 
 class Satisfaction
   include Associations
   
   attr_reader :options
   attr_reader :loader
+  attr_reader :consumer
+  attr_reader :token
 
   
   def initialize(options={})
-    @options = options.reverse_merge({:root =&gt; &quot;http://api.getsatisfaction.com&quot;, :autoload =&gt; false})
+    @options = options.reverse_merge({
+      :root =&gt; &quot;http://api.getsatisfaction.com&quot;, 
+      :autoload =&gt; false,
+      :request_token_url =&gt; 'http://getsatisfaction.com/api/request_token',
+      :access_token_url =&gt; 'http://getsatisfaction.com/api/access_token',
+      :authorize_url =&gt; 'http://getsatisfaction.com/api/authorize',
+    })
     @loader = Loader.new
     
     has_many :companies, :url =&gt; '/companies'
@@ -43,12 +55,26 @@ class Satisfaction
     options[:autoload]
   end
   
-  def url(path)
-    URI.parse(&quot;#{@options[:root]}#{path}&quot;)
+  def set_consumer(key, secret)
+    @consumer = OAuth::Consumer.new(key, secret)
+  end
+  
+  def set_token(token, secret)
+    @token = OAuth::Token.new(token, secret)
+  end
+  
+  def request_token
+    @loader.get(&quot;#{options[:request_token_url]}&quot;, :force =&gt; true, :consumer =&gt; @consumer, :token =&gt; nil)
+  end
+  
+  
+  def url(path, query_string={})
+    qs = query_string.map{|kv| URI.escape(kv.first.to_s) + &quot;=&quot; + URI.escape(kv.last.to_s)}.join(&quot;&amp;&quot;)
+    URI.parse(&quot;#{@options[:root]}#{path}?#{qs}&quot;)
   end
   
-  def get(path)
-    url = self.url(path)
+  def get(path, query_string={})
+    url = self.url(path, query_string)
     @loader.get(url)
   end
   </diff>
      <filename>lib/satisfaction.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,4 +7,13 @@ module Associations
       end
     EOS
   end
+  
+  # def belongs_to(resource, options={})
+  #   class_name = options[:class_name] || resource.to_s.classify
+  #   eval &lt;&lt;-EOS
+  #     def #{resource}
+  #       @#{resource} ||= #{class_name}.new(#{resource}_id, self.satisfaction)
+  #     end
+  #   EOS
+  # end
 end
\ No newline at end of file</diff>
      <filename>lib/satisfaction/associations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 class Company &lt; Resource
   
-  attributes :domain, :name, :logo
+  attributes :domain, :name, :logo, :description
   
   def path
     &quot;/companies/#{@id}&quot;</diff>
      <filename>lib/satisfaction/company.rb</filename>
    </modified>
    <modified>
      <diff>@@ -31,14 +31,19 @@ class Loader
             raise ArgumentError, &quot;Invalid uri, please use a String or URI object&quot;
           end
     
-    path = url.path.blank? ? '/' : url.path
-    request = Net::HTTP::Get.new(path)
+    request = Net::HTTP::Get.new(url.request_uri)
     cache_record = cache.get(url)
     if cache_record &amp;&amp; !options[:force]
       request[&quot;If-None-Match&quot;] = cache_record.etag
     end
     
-    response = execute(url, request)
+    http = Net::HTTP.new(url.host, url.port)
+    
+    consumer = options[:consumer]
+    token = options[:token]
+    request.oauth!(http, consumer, token) if consumer    
+    
+    response = execute(http, request)
     
     case response
     when Net::HTTPNotModified
@@ -55,8 +60,8 @@ class Loader
   end
   
   private
-  def execute(url, request)
-    Net::HTTP.start(url.host, url.port) {|http| http.request(request) }
+  def execute(http, request)
+    http.start{|http| http.request(request) }
   end
 end
 </diff>
      <filename>lib/satisfaction/loader.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,10 @@
+require 'forwardable'
+
 class Resource &lt; HasSatisfaction
   require 'satisfaction/resource/attributes'
   include ::Associations
   include Attributes
+  attr_reader :id
   
   def initialize(id, satisfaction)
     super satisfaction
@@ -24,7 +27,7 @@ class Resource &lt; HasSatisfaction
   end
   
   def inspect
-    &quot;&lt;#{self.class.name} #{attributes.map{|k,v| &quot;#{k}: #{v}&quot;}.join(' ')}&gt;&quot;
+    &quot;&lt;#{self.class.name} #{attributes.map{|k,v| &quot;#{k}: #{v}&quot;}.join(' ') if !attributes.nil?}&gt;&quot;
   end
 end
 
@@ -37,11 +40,8 @@ class ResourceCollection &lt; HasSatisfaction
     @path = path
   end
   
-  def page(number)
-    results = satisfaction.get(&quot;#{@path}.json?page=#{number}&quot;)
-    JSON.parse(results).map do |result|
-      klass.decode_sfn(result, satisfaction)
-    end
+  def page(number, options={})
+    Page.new(@klass, number, @path, satisfaction, options)
   end
   
   def get(id, options={})
@@ -50,18 +50,51 @@ class ResourceCollection &lt; HasSatisfaction
 end
 
 class Page &lt; HasSatisfaction
-  def initialize(klass, number, url, satisfaction)
-    super(satisfaction)
-    @loaded = false
-    
-    load if satisfaction.autoload?
+  attr_reader :total
+  
+  extend Forwardable
+  def_delegator :items, :first
+  def_delegator :items, :last
+  def_delegator :items, :each
+  def_delegator :items, :each_with_index    
+  def_delegator :items, :inject    
+  def_delegator :items, :reject    
+  def_delegator :items, :select    
+  def_delegator :items, :map
+  def_delegator :items, :[]
+  def_delegator :items, :length
+  def_delegator :items, :to_a
+  def_delegator :items, :empty?
+  
+  def initialize(klass, number, path, satisfaction, options)
+    super(satisfaction)    
+    @klass = klass
+    @number = number
+    @path = path
+    @options = options
+  end
+  
+  # Retrieve the items for this page
+  # * Caches
+  def items
+    @data ||= load
   end
   
   def loaded?
-    @loaded
+    @data.nil?
+  end
+  
+  def next?
+    last_item = @number * length
+    @total &gt; last_item
   end
   
   def load
-    
+    results = satisfaction.get(&quot;#{@path}.json&quot;, @options.merge(:page =&gt; @number))
+    json = JSON.parse(results)
+    @total = json[&quot;total&quot;]
+    json[&quot;data&quot;].map do |result|
+      @klass.decode_sfn(result, satisfaction)
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/satisfaction/resource.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 class Topic &lt; Resource
   attributes :subject, :style, :content, :reply_count, :follower_count
   attribute :last_active_at, :type =&gt; Time
+  attribute :created_at, :type =&gt; Time
   attribute :author, :type =&gt; Person
   
   def path</diff>
      <filename>lib/satisfaction/topic.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,10 +2,7 @@ require 'spec_helper'
 
 describe &quot;Company loader&quot; do
   it &quot;should work&quot; do
-    p @satisfaction.companies.get(&quot;satisfaction&quot;).topics
-    t = @satisfaction.topics.get(&quot;256&quot;)
-    p t.last_active_at
-    p t.attributes
-    
+    @satisfaction.set_consumer('lmwjv4kzwi27', 'fiei6iv61jnoukaq1aylwd8vcmnkafrs')
+    p @satisfaction.request_token
   end
 end
\ No newline at end of file</diff>
      <filename>spec/company_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7aef97368ac810564dcdad78fb080a385ad9a24f</id>
    </parent>
  </parents>
  <author>
    <name>Scott Fleckenstein</name>
    <email>nullstyle@gmail.com</email>
  </author>
  <url>http://github.com/nullstyle/ruby-satisfaction/commit/750418b6b9d12f718c6ce342c1aab8d507dca07d</url>
  <id>750418b6b9d12f718c6ce342c1aab8d507dca07d</id>
  <committed-date>2008-02-15T08:21:10-08:00</committed-date>
  <authored-date>2008-02-15T08:21:10-08:00</authored-date>
  <message>Continued work on rubygem

[FIXED]   gem requirements
[ADDED]   pkg to gitignore
[ADDED]   reply support
[ADDED]   page object &amp; total record counts
[FIXED]   query strings are ignored
[ADDED]   beginnings of oauth</message>
  <tree>0b2cb7069ef2e4670760e23b21105f8c1f161524</tree>
  <committer>
    <name>Scott Fleckenstein</name>
    <email>nullstyle@gmail.com</email>
  </committer>
</commit>
