diff options
| author | Luc Donnet | 2015-04-27 14:17:12 +0200 | 
|---|---|---|
| committer | Luc Donnet | 2015-04-27 14:17:12 +0200 | 
| commit | e470b78a10672fd927de4cd9b3ac6cae0097e12a (patch) | |
| tree | cd4231eb52ddb42099e0779f4579a7e58354e4f1 /lib/ievkit/serializer.rb | |
| parent | 8a51a1dbaede1ad6bc4e39b7c28639d43e83d7c7 (diff) | |
| download | chouette-core-e470b78a10672fd927de4cd9b3ac6cae0097e12a.tar.bz2 | |
Fix import request to IEV
Diffstat (limited to 'lib/ievkit/serializer.rb')
| -rw-r--r-- | lib/ievkit/serializer.rb | 22 | 
1 files changed, 19 insertions, 3 deletions
| diff --git a/lib/ievkit/serializer.rb b/lib/ievkit/serializer.rb index c9a0247ef..8110ab3b5 100644 --- a/lib/ievkit/serializer.rb +++ b/lib/ievkit/serializer.rb @@ -31,6 +31,21 @@ module Ievkit      rescue LoadError      end +    def self.multipart +      new(IevMultipart) +    rescue LoadError +    end + +    class IevMultipart +      def self.dump(data) +        data +      end +       +      def self.load(data) +        data +      end +    end +      # Public: Wraps a serialization format for Sawyer.  Nested objects are      # prepared for serialization (such as changing Times to ISO 8601 Strings).      # Any serialization format that responds to #dump and #load will work. @@ -46,9 +61,8 @@ module Ievkit      #      # Returns an encoded String.      def encode(data) -      data #@dump.call(encode_object(data)) +      @dump.call(encode_object(data))      end -      alias dump encode      # Public: Decodes a String into an Object (usually a Hash or Array of @@ -78,8 +92,10 @@ module Ievkit          when Date then hash[key] = value.to_time.utc.xmlschema          when Time then hash[key] = value.utc.xmlschema          when Hash then hash[key] = encode_hash(value) +        when UploadIO then hash[key] = value          end        end +      puts "hash #{hash.inspect}"        hash      end @@ -107,7 +123,7 @@ module Ievkit              value            end          elsif value.is_a?(Integer) || value.is_a?(Float) -          Time.at(value) +          Time.at(value)                    else            value          end | 
