Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
integration:ruby:xml_decode [2010/11/23 22:26] – [Gotchas] 199.19.145.179integration:ruby:xml_decode [2017/04/26 07:02] (current) – external edit 127.0.0.1
Line 4: Line 4:
 name          : Datafeed Decryption Example name          : Datafeed Decryption Example
 description   : A basic example of how to decrypt a foxycart v060 datafeed description   : A basic example of how to decrypt a foxycart v060 datafeed
-tags_tags     : datafeed,encryption+tags          : datafeed,encryption
 date_dt       : 2010-06-25 date_dt       : 2010-06-25
 version       : 1.0 version       : 1.0
Line 12: Line 12:
  
 ====== Datafeed Decryption Example ====== ====== Datafeed Decryption Example ======
 +
 +<WRAP important round>
 +//**Please note:**//
 +The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please [[http://forum.foxycart.com/|post in our forum]], but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.
 +</WRAP>
 +
 ===== Description ===== ===== Description =====
 A simple example of how to implement a datafeed listener in Ruby on Rails. It especially focuses on decrypting the RC4 encryption. A simple example of how to implement a datafeed listener in Ruby on Rails. It especially focuses on decrypting the RC4 encryption.
Line 20: Line 26:
  
 ===== Requirements ===== ===== Requirements =====
-  * You must have [[http://github.com/juggler/ruby-rc4|ruby-rc4]] installed.+  * You must have [[https://github.com/caiges/Ruby-RC4|ruby-rc4]] installed.
   * You must have [[http://nokogiri.org|Nokogiri]] installed.   * You must have [[http://nokogiri.org|Nokogiri]] installed.
   * This example is for a v060 datafeed. It may have to be adapted for any other version.   * This example is for a v060 datafeed. It may have to be adapted for any other version.
- 
 ===== Gotchas ===== ===== Gotchas =====
   * Be sure to use **CGI::unescape** instead of URI::unescape or URI::decode. The URI methods will screw up the decoding and you'll get weird artifacts in your XML.   * Be sure to use **CGI::unescape** instead of URI::unescape or URI::decode. The URI methods will screw up the decoding and you'll get weird artifacts in your XML.
Line 38: Line 43:
   def create   def create
      
-    require 'ruby/rc4'+    require 'rc4'
     require 'nokogiri'     require 'nokogiri'
          
-    decryptor = RubyRc4.new(API_KEY)  +    decryptor = RC4.new(API_KEY)  
-    xml = decryptor.encrypt(CGI::unescape(params['FoxyData']))+    xml = decryptor.decrypt(CGI::unescape(params['FoxyData']))
          
     feed = Nokogiri::XML(xml)     feed = Nokogiri::XML(xml)

Site Tools