Sha256: bbf07b3dccc03c6f703c57fbd293a590335ed6ea434c015d5dac682e98c02abc

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

module Restfulie
  module Common
    module Representation
      module Atom
        class Source < XML    
          def initialize(options_or_obj)
            if options_or_obj.kind_of?(Hash)
              @doc = Nokogiri::XML::Document.new()
              node = @doc.create_element("source")
              node.add_namespace_definition(nil, "http://www.w3.org/2005/Atom")
              node.parent = @doc
              super(node)
              options_or_obj.each do |key,value|
                self.send("#{key}=".to_sym, value)
              end
            else
              super(options_or_obj)
            end
          end
          
          def id
            text("id")
          end
      
          def id=(value)
            set_text("id", value)
          end
      
          # text
          def title
            text("title")
          end
        
          def title=(value)
            set_text("title", value)
          end
      
          def updated
            value = text("updated")
            Time.parse(value) unless value.nil?
          end
        
          def updated=(value)
            set_text("updated", value)
          end
      
          # text
          def rights
            text("rights")
          end
      
          def rights=(value)
            set_text("rights", value)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
restfulie-1.0.0.beta1 lib/restfulie/common/representation/atom/source.rb
restfulie-0.1.0.beta1 lib/restfulie/common/representation/atom/source.rb
restfulie-0.9.3 lib/restfulie/common/representation/atom/source.rb
restfulie-0.9.1 lib/restfulie/common/representation/atom/source.rb
restfulie-0.8.1 lib/restfulie/common/representation/atom/source.rb