<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,9 +21,18 @@ Your endpoint logic:
 
   class MyEndpoint &lt; WaseEndpoint
 
-    # Just return our json as it came in.
+    # This where our logic goes.
+    # A json encoded String is the only argument. You can deal with this however
+    # you want. The JSON library is already loaded should you wish to use it.
+    # Return another String, or a Hash containing the String and the program
+    # counter increment you wish to use.
     def secret_sauce(raw_json)
+    
+      # Just pass it back. Program counter increment will be 1.
       raw_json
+      
+      # Or pass it back with a custom program counter.
+      # { :data =&gt; raw_json, :increment =&gt; 2}
     end
 
   end</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -3,9 +3,18 @@ require 'wase_endpoint'
 
 class MyEndpoint &lt; WaseEndpoint
   
-  # Just return our json as it came in.
+  # This where our logic goes.
+  # A json encoded String is the only argument. You can deal with this however
+  # you want. The JSON library is already loaded should you wish to use it.
+  # Return another String, or a Hash containing the String and the program
+  # counter increment you wish to use.
   def secret_sauce(raw_json)
+  
+    # Just pass it back. Program counter increment will be 1.
     raw_json
+    
+    # Or pass it back with a custom program counter.
+    # { :data =&gt; raw_json, :increment =&gt; 2}
   end
   
 end</diff>
      <filename>example/my_endpoint.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,14 +42,14 @@ class WaseEndpoint
         messages.each do |message|
           program_listing = message.fetch_program_listing
           if message.program_counter &gt;= program_listing.size
-            throw Exception 'Program counter has gone too far'
+            raise IndexError, 'Program counter has gone too far'
           end
           
           # Here's where your magic happens.
           message.send_input(secret_sauce(message.fetch_output))
           
           # Tell the next endpoint.
-          @twitterer.send(program_listing[message.program_counter + 1], message.program_counter + 1, message.program_listing_uri, message.output_uri)
+          @twitterer.send(program_listing[message.new_program_counter], message.new_program_counter, message.program_listing_uri, message.output_uri)
         end
         
       end</diff>
      <filename>lib/wase_endpoint.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,7 @@ class WaseEndpoint
       @output_uri = output_uri.strip
       @input_uri = input_uri.strip if input_uri
       @input_uri_1 = input_uri_1.strip if input_uri_1
+      @increment = 1
     end
     
     def ==(other)
@@ -28,7 +29,17 @@ class WaseEndpoint
       RestClient.get('http://' + @output_uri)
     end
     
+    # Accepts either a String of raw data, or a Hash of data and a program
+    # counter increment.
+    # An Exception will be thrown if this increment is negative.
     def send_input(input)
+      
+      if input.is_a?(Hash)
+        @increment = input[:increment]
+        raise ArgumentError, 'You cannot have negative program counter increments' if @increment &lt; 0
+        input = input[:data]
+      end
+      
       input_uri = 'http://' + (@input_uri || @output_uri)
       
       # RestClient can't follow a redirect for put, so we'll expand it.
@@ -38,6 +49,10 @@ class WaseEndpoint
       RestClient.put(expanded_input_uri, input)
     end
     
+    def new_program_counter
+      @program_counter + @increment
+    end
+    
   end
   
-end
\ No newline at end of file
+end</diff>
      <filename>lib/wase_endpoint/message.rb</filename>
    </modified>
    <modified>
      <diff>@@ -50,15 +50,45 @@ describe WaseEndpoint::Message do
       @message.fetch_output.should == '[58, 92, 12, 18, 76]'
     end
     
-    it &quot;should send the input data using the expanded output URI&quot; do
-      mock_net_http = mock(Net::HTTP)
-      mock_net_http.should_receive(:head).with('/2uhGcl').and_return({'Location' =&gt; 'http://example.com/'})
-      Net::HTTP.should_receive(:new).with('bit.ly').and_return(mock_net_http)
-      RestClient.should_receive(:put).with('http://example.com/', '[1, 2, 3, 4]')
+    describe &quot;sending input data&quot; do
+      
+      it &quot;should send the input data using the expanded output URI&quot; do
+        mock_net_http = mock(Net::HTTP)
+        mock_net_http.should_receive(:head).with('/2uhGcl').and_return({'Location' =&gt; 'http://example.com/'})
+        Net::HTTP.should_receive(:new).with('bit.ly').and_return(mock_net_http)
+        RestClient.should_receive(:put).with('http://example.com/', '[1, 2, 3, 4]')
+
+        @message.send_input('[1, 2, 3, 4]')
+      end
+      
+      it &quot;should throw an error on negative program counter increment&quot; do
+        Net::HTTP.stub(:new).and_return(mock(Net::HTTP, :head =&gt; 'http://example.com'))
+        RestClient.stub(:put)
+        
+        lambda {
+          @message.send_input({:data =&gt; 'foo', :increment =&gt; -1})
+        }.should raise_error(ArgumentError, 'You cannot have negative program counter increments')
+      end
       
-      @message.send_input('[1, 2, 3, 4]')
     end
-    
+
+      
+    describe &quot;incrementing the program counter&quot; do
+      
+      it &quot;should be one&quot; do
+        @message.new_program_counter.should == 1
+      end
+      
+      it &quot;should should be two&quot; do
+        Net::HTTP.stub(:new).and_return(mock(Net::HTTP, :head =&gt; 'http://example.com'))
+        RestClient.stub(:put)
+        @message.send_input({:data =&gt; 'foo', :increment =&gt; 2})
+        
+        @message.new_program_counter.should == 2
+      end
+      
+    end
+      
   end
   
   describe &quot;with one input URI&quot; do
@@ -76,7 +106,7 @@ describe WaseEndpoint::Message do
       @message.input_uri_1.should be_nil
     end
 
-    it &quot;should send the input data using the expanded output URI&quot; do
+    it &quot;should send the input data using the expanded input URI&quot; do
       mock_net_http = mock(Net::HTTP)
       mock_net_http.should_receive(:head).with('/3kl0xs').and_return({'Location' =&gt; 'http://example.com/'})
       Net::HTTP.should_receive(:new).with('bit.ly').and_return(mock_net_http)</diff>
      <filename>spec/wase_endpoint_message_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>56d4434f0a3fcdbb435b3d7a780491f2455cb2ae</id>
    </parent>
  </parents>
  <author>
    <name>Douglas F Shearer</name>
    <email>dougal.s@gmail.com</email>
  </author>
  <url>http://github.com/dougal/wase_endpoint/commit/7694df3bbf63d06cac544cd445faa5b7714fbb6e</url>
  <id>7694df3bbf63d06cac544cd445faa5b7714fbb6e</id>
  <committed-date>2009-11-05T12:21:03-08:00</committed-date>
  <authored-date>2009-11-05T12:21:03-08:00</authored-date>
  <message>Can now pass back a custom counter increment.
Corrected exception mechanism for program counter out of bounds.</message>
  <tree>95362f390f968eb7ee5e1a367461619fe86b0fff</tree>
  <committer>
    <name>Douglas F Shearer</name>
    <email>dougal.s@gmail.com</email>
  </committer>
</commit>
