Sha256: 567206a48c157ab18862c21678c638a20019277e56b8533d588e696250d43237
Contents?: true
Size: 982 Bytes
Versions: 1
Compression:
Stored size: 982 Bytes
Contents
class Hash def links(*args) links = fetch("link", []) links = [links] unless links.kind_of? Array links = [] unless links links = links.map do |l| Restfulie::Client::Link.new(l) end if args.empty? links else found = links.find do |link| link.rel == args[0].to_s end found end end def method_missing(sym, *args) self[sym.to_s].nil? ? super(sym, args) : self[sym.to_s] end def respond_to?(sym) include?(sym.to_s) || super(sym) end end module Restfulie::Common::Representation # Implements the interface for marshal Xml media type requests (application/xml) class XmlD cattr_reader :media_type_name @@media_type_name = 'application/xml' cattr_reader :headers @@headers = { :post => { 'Content-Type' => media_type_name } } def unmarshal(string) Hash.from_xml(string).values.first end def marshal(string, rel) string end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restfulie-0.7.1 | lib/restfulie/common/representation/xml.rb |