Sha256: 4add73943fa309e4c4f5a5a5309d6eec6a2f6bc52dda8ab5a9081dce403b9fef

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../spec/spec_helper')

class Post
  include OxMlk
  
  ox_tag :post
  
  ox_attr :href
  ox_attr :hash
  ox_attr :description
  ox_attr :tag
  ox_attr :created_at, :from => 'time', :as => Time
  ox_attr :other, :as => Integer
  ox_attr :extended
end

class Response
  include OxMlk
  
  ox_tag :posts
  
  ox_attr :user
  ox_attr :tag
  
  ox_elem :posts, :as => [Post]
end

response = Response.from_xml(xml_for(:posts))

puts response.user

response.posts.each do |post|
  puts post.description, post.href, post.extended, ''
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oxmlk-0.3.2 examples/posts.rb
oxmlk-0.3.1 examples/posts.rb