Sha256: d4924371c49019a97126e7e7dcada93f691f7201cb5cfdf7d027f98e651eca34
Contents?: true
Size: 825 Bytes
Versions: 2
Compression:
Stored size: 825 Bytes
Contents
module ActiveResource # Overridden methods to suit SalesKing. # Some changes might be kicked when AR 3.0 is out class Base # override encode because json is also returned nested by SalesKing def encode(options={}) case self.class.format when ActiveResource::Formats[:xml] self.class.format.encode(attributes, {:root => self.class.element_name}.merge(options)) else # json also nested self.class.format.encode( {self.class.element_name => attributes}, options) end end # override ARes method to parse only the client part def load_attributes_from_response(response) if response['Content-Length'] != "0" && response.body.strip.size > 0 load( self.class.format.decode(response.body)[self.class.element_name] ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sk-api-1.0.1 | lib/activeresource_patches/base.rb |
sk-api-1.0.0 | lib/activeresource_patches/base.rb |