<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/.DS_Store</filename>
    </added>
    <added>
      <filename>lib/top4r/.DS_Store</filename>
    </added>
    <added>
      <filename>lib/top4r/client/shipping.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/client/suite.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/client/trade.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/client/user.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/console.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/ext.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/ext/stdlib.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/model/shipping.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/model/suite.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/model/trade.rb</filename>
    </added>
    <added>
      <filename>lib/top4r/model/user.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1.gem</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1.tgz</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1.zip</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/CHANGES</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/MIT-LICENSE</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/README</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/TODO</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/client.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/client/base.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/client/shipping.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/client/suite.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/client/trade.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/client/user.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/config.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/console.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/core.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/ext.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/ext/stdlib.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/meta.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/model.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/model/shipping.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/model/suite.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/model/trade.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/model/user.rb</filename>
    </added>
    <added>
      <filename>pkg/top4r-0.0.1/lib/top4r/version.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,15 +1,26 @@
 $:.unshift(File.dirname(__FILE__))
 
-require 'rubygems'
+module Top4R; end
 
-module TOP4R; end
+def require_local(suffix)
+  require(File.expand_path(File.join(File.dirname(__FILE__), suffix)))
+end
 
-# External requires
-require('yaml')
+require 'digest/md5'
+require 'net/http'
+require 'net/https'
+require 'uri'
+require 'cgi'
+require 'json'
+require 'yaml'
+require 'iconv'
+require 'activesupport'
 
-require 'top4r/version.rb'
-require 'top4r/meta.rb'
-require 'top4r/core.rb'
-require 'top4r/model.rb'
-require 'top4r/config.rb'
-require 'top4r/client.rb'
\ No newline at end of file
+require_local('top4r/ext')
+require_local('top4r/version')
+require_local('top4r/meta')
+require_local('top4r/core')
+require_local('top4r/model')
+require_local('top4r/config')
+require_local('top4r/client')
+require_local('top4r/console')
\ No newline at end of file</diff>
      <filename>lib/top4r.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,23 @@
-# client.rb contains the classes, methods and extends &lt;tt&gt;TOP4R&lt;/tt&gt;
-# features to define client calls to the TOP REST API.
-#
-# See:
-# * &lt;tt&gt;TOP4R::Client&lt;/tt&gt;
-
-# Used to query or post to the TOP REST API to simplify code.
-class TOP4R::Client
-  include TOP4R::ClassUtilMixin
+class Top4R::Client
+  include Top4R::ClassUtilMixin
+  
+  @@no_login_required_methods = {
+    :user =&gt; {
+      :info =&gt; 'taobao.user.get',
+      :multi_info =&gt; 'taobao.users.get'
+    },
+    :trade =&gt; {},
+    :area =&gt; {
+      :list =&gt; 'taobao.areas.get'
+    },
+    :logistic_company =&gt; {
+      :list =&gt; 'taobao.logisticcompanies.get'
+    }
+  }
 end
 
-require 'top4r/client/base'
\ No newline at end of file
+require 'top4r/client/base'
+require 'top4r/client/user'
+require 'top4r/client/shipping'
+require 'top4r/client/trade'
+require 'top4r/client/suite'
\ No newline at end of file</diff>
      <filename>lib/top4r/client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,135 @@
-class TOP4R::Client
+class Top4R::Client
   alias :old_inspect :inspect
-
+  attr_accessor :total_results
+  attr_reader :login
+  
   def inspect
     s = old_inspect
-    s.gsub!(/@password=&quot;.*?&quot;/, '@password=&quot;XXXX&quot;')
+    s.gsub!(/@app_secret=&quot;.*?&quot;/, '@app_secret=&quot;XXXX&quot;')
+  end
+  
+  def init
+    total_results = 0
+    if @parameters and @session
+      @parameters = Base64.decode64(@parameters).split('&amp;').inject({}) do |hsh, i| kv = i.split('='); hsh[kv[0]] = kv[1]; hsh end
+      @login = user(@parameters['visitor_nick'])
+      # puts &quot;login: #{@login.inspect}&quot;
+    end
   end
   
   protected
+    attr_accessor :app_key, :app_secret, :parameters, :session
+    
+    def login_required(model, method)
+      return if logged_in?
+      raise Top4R::LoginRequiredError.new({:model =&gt; model, :method =&gt; method})
+    end
+  
+    def http_connect(body=nil, &amp;block)
+      require_block(block_given?)
+      connection = create_http_connection
+      connection.start do |connection|
+        request = yield connection if block_given?
+        # puts &quot;conn: #{connection.inspect}&quot;
+        # puts &quot;request: #{request.inspect}&quot;
+        response = connection.request(request, body)
+        puts &quot;response: #{response.body}&quot;
+        handle_rest_response(response)
+        response
+      end
+    end
+    
+    # &quot;Blesses&quot; model object with client information
+    def bless_model(model)
+    	model.bless(self) if model
+    end
+
+    def bless_models(list)
+      return bless_model(list) if list.respond_to?(:client=)
+    	list.collect { |model| bless_model(model) } if list.respond_to?(:collect)
+    end
+    
+  private
+    @@http_header = nil
     
+    def valid_method(method, methods, model, force_login = false)
+      login_required(model, method) if (@@no_login_required_methods[model].is_a?(Hash) and !@@no_login_required_methods[model].keys.member?(method)) or force_login
+      raise ArgumentError, &quot;Invalid #{model} method: #{method}&quot; unless methods.keys.member?(method)
+    end
+    
+    def raise_rest_error(response, uri = nil)
+      map = JSON.parse(response.body)
+      raise Top4R::RESTError.new(:code =&gt; response.code,
+                                   :message =&gt; response.message,
+                                   :error =&gt; map[&quot;error_rsp&quot;],
+                                   :uri =&gt; uri)
+    end
+  
+    def handle_rest_response(response, uri = nil)
+      unless response.is_a?(Net::HTTPSuccess)
+        raise_rest_error(response, uri)
+      end
+      
+      map = JSON.parse(response.body)
+      raise Top4R::RESTError.new(:code =&gt; map[&quot;error_rsp&quot;][&quot;code&quot;],
+                                    :message =&gt; map[&quot;error_rsp&quot;][&quot;msg&quot;],
+                                    :error =&gt; map[&quot;error_rsp&quot;],
+                                    :uri =&gt; uri) if map[&quot;error_rsp&quot;].is_a?(Hash)
+    end
+  
+    def create_http_connection
+      protocol, host, port = (@@config.env == :production ? @@config.protocol : @@config.test_protocol), (@@config.env == :production ? @@config.host : @@config.test_host), (@@config.env == :production ? @@config.port : @@config.test_port)
+      conn = Net::HTTP.new(host, port,
+                            @@config.proxy_host, @@config.proxy_port,
+                            @@config.proxy_user, @@config.proxy_pass)
+      if protocol == :ssl
+        conn.use_ssl = true
+        conn.verify_mode = OpenSSL::SSL::VERIFY_NONE
+      end
+      conn
+    end
+    
+    def http_header
+      # can cache this in class variable since all &quot;variables&quot; used to
+      # create the contents of the HTTP header are determined by other
+      # class variables that are not designed to change after instantiation.
+      @@http_header ||= {
+       'User-Agent' =&gt; &quot;Top4R v#{Top4R::Version.to_version} [#{@@config.user_agent}]&quot;,
+       'Accept' =&gt; 'text/x-json',
+       'X-TOP-Client' =&gt; @@config.application_name,
+       'X-TOP-Client-Version' =&gt; @@config.application_version,
+       'X-TOP-Client-URL' =&gt; @@config.application_url,
+      }
+      @@http_header
+    end
+    
+    def append_top_params(params)
+      params = params.merge({
+        :session =&gt; @session,
+        :timestamp =&gt; Time.now.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;),
+        :format =&gt; &quot;#{@@config.format}&quot;,
+        :app_key =&gt; @app_key,
+        :v =&gt; &quot;1.0&quot;
+      })
+      params = params.merge({
+        :sign =&gt; Digest::MD5.hexdigest(params.sort {|a,b| &quot;#{a[0]}&quot;&lt;=&gt;&quot;#{b[0]}&quot;}.flatten.unshift(@app_secret).join).upcase
+      })
+    end
+
+    def create_http_get_request(method, params = {})
+      uri = @@config.env == :production ? @@config.rest_uri : @@config.test_rest_uri
+      params = append_top_params(params.merge({:method =&gt; method}))
+      path = (params.size &gt; 0) ? &quot;#{uri}?#{params.to_http_str}&quot; : uri
+      puts &quot;path: #{path}&quot;
+      Net::HTTP::Get.new(path, http_header)
+    end
+
+    def create_http_post_request(uri)
+      Net::HTTP::Post.new(uri, http_header)
+    end
+
+    def create_http_delete_request(uri, params = {})
+      path = (params.size &gt; 0) ? &quot;#{uri}?#{params.to_http_str}&quot; : uri
+      Net::HTTP::Delete.new(path, http_header)
+    end
 end
\ No newline at end of file</diff>
      <filename>lib/top4r/client/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,29 @@
-# config.rb contains classes, methods and extends existing TOP4R classes 
-# to provide easy configuration facilities.
-
-module TOP4R
+module Top4R
+  # A rails like config object
   class Config
     include ClassUtilMixin
     @@ATTRIBUTES = [
-      :host,
-      :user_agent,
-      :app_key
+        :env,
+        :host,
+        :rest_uri,
+        :port,
+        :protocol,
+        :test_host,
+        :test_rest_uri,
+        :test_port,
+        :test_protocol,
+        :proxy_host,
+        :proxy_port,
+        :proxy_user,
+        :proxy_pass,
+        :format,
+        :application_name,
+        :application_key,
+        :application_secret,
+        :application_version,
+        :application_url,
+        :user_agent,
+        :source
     ]
     attr_accessor *@@ATTRIBUTES
     
@@ -20,23 +36,39 @@ module TOP4R
       end
       true
     end
-  end
+  end # Config class
   
   class Client
     @@defaults = {
-      :host =&gt; 'http://gw.sandbox.taobao.com/router/rest',
-      :user_agent =&gt; &quot;TOP4R&quot;,
-      :app_key =&gt; &quot;12000224&quot;
+      :env =&gt; :test,
+      :host =&gt; 'gw.api.taobao.com',
+      :rest_uri =&gt; '/router/rest',
+      :port =&gt; 80,
+      :protocol =&gt; :http,
+      :test_host =&gt; 'gw.sandbox.taobao.com',
+      :test_rest_uri =&gt; '/router/rest',
+      :test_port =&gt; 80,
+      :test_protocol =&gt; :http,
+      :proxy_host =&gt; nil,
+      :proxy_port =&gt; nil,
+      :format =&gt; :json,
+      :application_name =&gt; 'Top4R',
+      :application_key =&gt; '12000224',
+      :application_secret =&gt; '2f26cb1a99570aa72daee12a1db88e63',
+      :application_version =&gt; Top4R::Version.to_version,
+      :application_url =&gt; 'http://top4r.nowa.me',
+      :user_agent =&gt; 'default',
+      :source =&gt; 'top4r'
     }
-    @@config = TOP4R::Config.new(@@defaults)
+    @@config = Top4R::Config.new(@@defaults)
     
-    # TOP4R::Client class methods
+    # Top4R::Client class methods
     class &lt;&lt; self
-      # Yields to given &lt;tt&gt;block&lt;/tt&gt; to configure the TOP4R API.
+      # Yields to given &lt;tt&gt;block&lt;/tt&gt; to configure the Twitter4R API.
       def configure(&amp;block)
         raise ArgumentError, &quot;Block must be provided to configure&quot; unless block_given?
         yield @@config
       end # configure
     end # class &lt;&lt; self
   end # Client class
-end # TOP4R module
\ No newline at end of file
+end
\ No newline at end of file</diff>
      <filename>lib/top4r/config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,91 +1,57 @@
-# The TOP4R API provides a nicer Ruby object API to work with 
-# instead of coding around the open.taobao.com API.
-
-# Module to encapsule the TOP4R API.
-module TOP4R
-  # Mixin module for classes that need to have a constructor similar to
-  # Rails' models, where a &lt;tt&gt;Hash&lt;/tt&gt; is provided to set attributes
-  # appropriately.
-  # 
-  # To define a class that uses this mixin, use the following code:
-  #  class FilmActor
-  #    include ClassUtilMixin
-  #  end
+module Top4R
+  # Core
   module ClassUtilMixin
     module ClassMethods
       
     end
     
-    # Instance methods defined for &lt;tt&gt;TOP4R::ModelMixin&lt;/tt&gt; module.
     module InstanceMethods
-      # Constructor/initializer that takes a hash of parameters that 
-      # will initialize *members* or instance attributes to the 
-      # values given.  For example,
-      # 
-      #  class FilmActor
-      #    include TOP4R::ClassUtilMixin
-      #    attr_accessor :name
-      #  end
-      #  
-      #  class Production
-      #    include TOP4R::ClassUtilMixin
-      #    attr_accessor :title, :year, :actors
-      #  end
-      #  
-      #  # Favorite actress...
-      #  jodhi = FilmActor.new(:name =&gt; &quot;Jodhi May&quot;)
-      #  jodhi.name # =&gt; &quot;Jodhi May&quot;
-      #  
-      #  # Favorite actor...
-      #  robert = FilmActor.new(:name =&gt; &quot;Robert Lindsay&quot;)
-      #  robert.name # =&gt; &quot;Robert Lindsay&quot;
-      #  
-      #  # Jane is also an excellent pick...gotta love her accent!
-      #  jane = FilmActor.new(name =&gt; &quot;Jane Horrocks&quot;)
-      #  jane.name # =&gt; &quot;Jane Horrocks&quot;
-      #  
-      #  # Witty BBC series...
-      #  mrs_pritchard = Production.new(:title =&gt; &quot;The Amazing Mrs. Pritchard&quot;, 
-      #                                 :year =&gt; 2005, 
-      #                                 :actors =&gt; [jodhi, jane])
-      #  mrs_pritchard.title  # =&gt; &quot;The Amazing Mrs. Pritchard&quot;
-      #  mrs_pritchard.year   # =&gt; 2005
-      #  mrs_pritchard.actors # =&gt; [#&lt;FilmActor:0xb79d6bbc @name=&quot;Jodhi May&quot;&gt;, 
-      #  &lt;FilmActor:0xb79d319c @name=&quot;Jane Horrocks&quot;&gt;]
-      #  # Any Ros Pritchard's out there to save us from the Tony Blair
-      #  # and Gordon Brown *New Labour* debacle?  You've got my vote! 
-      #  
-      #  jericho = Production.new(:title =&gt; &quot;Jericho&quot;, 
-      #                           :year =&gt; 2005, 
-      #                           :actors =&gt; [robert])
-      #  jericho.title   # =&gt; &quot;Jericho&quot;
-      #  jericho.year    # =&gt; 2005
-      #  jericho.actors  # =&gt; [#&lt;FilmActor:0xc95d3eec @name=&quot;Robert Lindsay&quot;&gt;]
-      # 
-      # Assuming class &lt;tt&gt;FilmActor&lt;/tt&gt; includes 
-      # &lt;tt&gt;TOP4R::ClassUtilMixin&lt;/tt&gt; in the class definition 
-      # and has an attribute of &lt;tt&gt;name&lt;/tt&gt;, then that instance 
-      # attribute will be set to &quot;Jodhi May&quot; for the &lt;tt&gt;actress&lt;/tt&gt; 
-      # object during object initialization (aka construction for 
-      # you Java heads).
       def initialize(params = {})
+        others = {}
         params.each do |key,val|
-          self.send(&quot;#{key}=&quot;, val) if self.respond_to? key
+          if self.respond_to? key
+            self.send(&quot;#{key}=&quot;, val)
+          else
+            others[key] = val
+          end
         end
+        self.send(&quot;#{:other_attrs}=&quot;, others) if self.respond_to? :other_attrs and others.size &gt; 0
         self.send(:init) if self.respond_to? :init
       end
       
       protected
-        # Helper method to provide an easy and terse way to require 
-        # a block is provided to a method.
         def require_block(block_given)
           raise ArgumentError, &quot;Must provide a block&quot; unless block_given
         end
     end
     
-    def self.included(base)
-      base.extend         ClassMethods
-      base.send :include, InstanceMethods
+    def self.included(receiver)
+      receiver.extend         ClassMethods
+      receiver.send :include, InstanceMethods
+    end
+  end # ClassUtilMixin module
+  
+  class RESTError &lt; RuntimeError
+    include ClassUtilMixin
+    @@ATTRIBUTES = [:code, :message, :uri, :error]
+    attr_accessor *@@ATTRIBUTES
+
+    # Returns string in following format:
+    # &quot;HTTP #{@code}: #{@message} at #{@uri}&quot;
+    # For example,
+    # &quot;HTTP 404: Resource Not Found at /i_am_crap.json&quot;
+    def to_s
+      &quot;HTTP #{@code}: #{@message} at #{@uri}&quot;
+    end
+  end # RESTError
+  
+  class LoginRequiredError &lt; RuntimeError
+    include ClassUtilMixin
+    @@ATTRIBUTES = [:model, :method]
+    attr_accessor *@@ATTRIBUTES
+    
+    def to_s
+      &quot;#{@method} method at model #{@model} requires you to be logged in first&quot;
     end
-  end
+  end # LoginRequiredError
 end
\ No newline at end of file</diff>
      <filename>lib/top4r/core.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,14 @@
-# meta.rb contains &lt;tt&gt;TOP4R::Meta&lt;/tt&gt; and related classes that
-# help define the metadata of the &lt;tt&gt;TOP4R&lt;/tt&gt; project.
+# meta.rb contains &lt;tt&gt;Twitter::Meta&lt;/tt&gt; and related classes that
+# help define the metadata of the &lt;tt&gt;Twitter4R&lt;/tt&gt; project.
 
-require 'rubygems'
-require 'erb'
+require('rubygems')
+require('erb')
 
-class TOP4R::Meta #:nodoc:
+class Top4R::Meta #:nodoc:
   attr_accessor :root_dir
   attr_reader :gem_spec, :project_files, :spec_files
 
-  # Initializer for TOP4R::Meta class.  Takes &lt;tt&gt;root_dir&lt;/tt&gt; as parameter.
+  # Initializer for Twitter::Meta class.  Takes &lt;tt&gt;root_dir&lt;/tt&gt; as parameter.
   def initialize(root_dir)
     @root_dir = root_dir
   end
@@ -38,7 +38,7 @@ class TOP4R::Meta #:nodoc:
     @spec_files
   end
   
-  # Returns RubyGem specification for TOP4R project
+  # Returns RubyGem specification for Twitter4R project
   def gem_spec
     @gem_spec ||= Gem::Specification.new do |spec|
       self.spec_info.each do |key, val|</diff>
      <filename>lib/top4r/meta.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,27 +1,39 @@
-# Define TOP4R model module
-
-module TOP4R
-  # Mixin module for model classes. Includes generic class methods.
-  #
-  # To create a new model that includes this mixin's features simply:
-  # class NewModel
-  # include TOP4R::ModelMixin
-  # end
-  #
-  # This mixin module automatically includes &lt;tt&gt;TOP4R::ClassUtilMixin&lt;/tt&gt;
-  # features.
-  # The contract for models to use this mixin correctly is that the class
-  # including this mixin must provide an class method named &lt;tt&gt;attributes&lt;/tt&gt;
-  # that will return an Array of attribute symbols that will be checked
-  # in #eql? override method. The following would be sufficient:
-  # def self.attributes; @@ATTRIBUTES; end
+module Top4R
   module ModelMixin
     module ClassMethods
+      def default_public_fields; []; end
+      
+      def default_private_fields; []; end
+      
+      # Unmarshal object singular or plural array of model objects
+      # from JSON serialization. Currently JSON is only supported.
+      def unmarshal(raw)
+        # input = JSON.parse(raw)
+        input = raw
+        # puts &quot;\ninput: #{input.inspect}&quot;
+        def unmarshal_model(hash)
+          mine = self.new(hash)
+          # puts &quot;\n mine: #{mine.inspect}&quot;
+          mine.unmarshal_other_attrs if mine.respond_to? :unmarshal_other_attrs
+          mine
+        end
+        return unmarshal_model(input) if input.is_a?(Hash) # singular case
+        result = []
+        input.each do |hash|
+          model = unmarshal_model(hash) if hash.is_a?(Hash)
+          result &lt;&lt; model
+        end if input.is_a?(Array)
+        result # plural case
+      end
       
+      def fields
+        (self.default_public_fields + self.default_private_fields).uniq.join(',')
+      end
     end
     
     module InstanceMethods
       attr_accessor :client
+      
       # Equality method override of Object#eql? default.
       #
       # Relies on the class using this mixin to provide a &lt;tt&gt;attributes&lt;/tt&gt;
@@ -40,27 +52,60 @@ module TOP4R
         true
       end
       
+      # Returns integer representation of model object instance.
+      #
+      # For example,
+      # product = Top4R::Product.new(:id =&gt; 234343)
+      # product.to_i #=&gt; 234343
+      def to_i
+        @id
+      end
+      
+      # Returns hash representation of model object instance.
+      #
+      # For example,
+      # u = Top4R::User.new(:id =&gt; 2342342, :screen_name =&gt; 'tony_blair_is_the_devil')
+      # u.to_hash #=&gt; {:id =&gt; 2342342, :screen_name =&gt; 'tony_blair_is_the_devil'}
+      #
+      # This method also requires that the class method &lt;tt&gt;attributes&lt;/tt&gt; be
+      # defined to return an Array of attributes for the class.
+      def to_hash
+        attrs = self.class.attributes
+        result = {}
+        attrs.each do |att|
+          value = self.send(att)
+          value = value.to_hash if value.respond_to?(:to_hash)
+          result[att] = value if value
+        end
+        result
+      end
+      
       # &quot;Blesses&quot; model object.
-      # 
+      #
       # Should be overridden by model class if special behavior is expected
-      # 
+      #
       # Expected to return blessed object (usually &lt;tt&gt;self&lt;/tt&gt;)
       def bless(client)
         self.basic_bless(client)
       end
       
       protected
-        # Basic &quot;blessing&quot; of model object 
+        # Basic &quot;blessing&quot; of model object
         def basic_bless(client)
           self.client = client
           self
         end
     end
     
-    def self.included(base)
-      base.extend         ClassMethods
-      base.send :include, TOP4R::ClassUtilMixin
-      base.send :include, InstanceMethods
+    def self.included(receiver)
+      receiver.extend         ClassMethods
+      receiver.send :include, Top4R::ClassUtilMixin
+      receiver.send :include, InstanceMethods
     end
-  end
-end
\ No newline at end of file
+  end # ModelMixin module
+end
+
+require 'top4r/model/user'
+require 'top4r/model/shipping'
+require 'top4r/model/trade'
+require 'top4r/model/suite'
\ No newline at end of file</diff>
      <filename>lib/top4r/model.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,19 +1,17 @@
-# version.rb contains &lt;tt&gt;TOP4R::Version&lt;/tt&gt; that provides helper
-# methods related to versioning of the &lt;tt&gt;TOP4R&lt;/tt&gt; project.
-
-module TOP4R::Version #:nodoc:
+module Top4R::Version
   MAJOR = 0
-  MINOR = 1
-  REVISION = 0
+  MINOR = 0
+  REVISION = 1
+  
   class &lt;&lt; self
     # Returns X.Y.Z formatted version string
     def to_version
       &quot;#{MAJOR}.#{MINOR}.#{REVISION}&quot;
     end
-    
+
     # Returns X-Y-Z formatted version name
     def to_name
       &quot;#{MAJOR}_#{MINOR}_#{REVISION}&quot;
     end
   end
-end
+end
\ No newline at end of file</diff>
      <filename>lib/top4r/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 &lt;% require('pathname') %&gt;
 spec:
   name: top4r
-  version: &lt;%= TOP4R::Version.to_version %&gt;
+  version: &lt;%= Top4R::Version.to_version %&gt;
   summary: TOP4R is a library that can help you build plugin for TaoBao.com quickly in pure Ruby.
   require_path: lib
   has_rdoc: true</diff>
      <filename>pkg-info.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require 'rake/gempackagetask'
 
-meta = TOP4R::Meta.new(ROOT_DIR)
+meta = Top4R::Meta.new(ROOT_DIR)
 namespace :package do
   desc &quot;Create Gem Packages&quot;
   Rake::GemPackageTask.new(meta.gem_spec) do |pkg|</diff>
      <filename>tasks/pkg.rake</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
-# Generated: Tue Jun 30 14:24:37 UTC 2009
+# Generated: Tue Sep 22 03:19:47 UTC 2009
 Gem::Specification.new do |s|
   s.name = &quot;top4r&quot;
-  s.version = &quot;0.1.0&quot;
+  s.version = &quot;0.0.1&quot;
   s.platform = Gem::Platform::RUBY
   s.has_rdoc = true
   s.extra_rdoc_files = [&quot;README&quot;,&quot;CHANGES&quot;,&quot;TODO&quot;,&quot;MIT-LICENSE&quot;,]
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
   s.rubyforge_project = &quot;top4r&quot;
   s.add_dependency(&quot;json&quot;, &quot;&gt;=1.1.1&quot;)
 #  s.require_path = &quot;lib&quot;
-  s.files = [&quot;lib/top4r/meta.rb&quot;,&quot;lib/top4r/model.rb&quot;,&quot;lib/top4r/version.rb&quot;,&quot;lib/top4r.rb&quot;,]
+  s.files = [&quot;lib/top4r/client/base.rb&quot;,&quot;lib/top4r/client/shipping.rb&quot;,&quot;lib/top4r/client/suite.rb&quot;,&quot;lib/top4r/client/trade.rb&quot;,&quot;lib/top4r/client/user.rb&quot;,&quot;lib/top4r/client.rb&quot;,&quot;lib/top4r/config.rb&quot;,&quot;lib/top4r/console.rb&quot;,&quot;lib/top4r/core.rb&quot;,&quot;lib/top4r/ext/stdlib.rb&quot;,&quot;lib/top4r/ext.rb&quot;,&quot;lib/top4r/meta.rb&quot;,&quot;lib/top4r/model/shipping.rb&quot;,&quot;lib/top4r/model/suite.rb&quot;,&quot;lib/top4r/model/trade.rb&quot;,&quot;lib/top4r/model/user.rb&quot;,&quot;lib/top4r/model.rb&quot;,&quot;lib/top4r/version.rb&quot;,&quot;lib/top4r.rb&quot;,]
   s.bindir = 'bin'
   s.executables = ['top4rsh']
 end</diff>
      <filename>top4r.gemspec</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ba7d635675f1e91de14b2b500a0169741b271f87</id>
    </parent>
  </parents>
  <author>
    <name>nowa</name>
    <email>nowazhu@gmail.com</email>
  </author>
  <url>http://github.com/nowa/top4r/commit/fc01dab86624c1f1515d7f6b25a40ca0cac2b574</url>
  <id>fc01dab86624c1f1515d7f6b25a40ca0cac2b574</id>
  <committed-date>2009-09-21T20:21:25-07:00</committed-date>
  <authored-date>2009-09-21T20:21:25-07:00</authored-date>
  <message>0.0.1</message>
  <tree>885e2765ef7cb3be894e277cb48c938984d4a21d</tree>
  <committer>
    <name>nowa</name>
    <email>nowazhu@gmail.com</email>
  </committer>
</commit>
