Sha256: 87bbfdf59cf0f0c39c315351945380bccb2a06609487c8bd4162c5ea0de4828f

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 Bytes

Contents

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

class User
  include OxMlk
  
  ox_tag :downcase
  
  ox_elem :id, :as => Integer
  ox_elem :name
  ox_elem :screen_name
  ox_elem :location
  ox_elem :description
  ox_elem :profile_image_url
  ox_elem :url
  ox_elem :protected?
  ox_elem :followers_count, :as => Integer
end
 
class Status
  include OxMlk
  
  ox_tag :downcase
     
  ox_elem :id, :as => Integer
  ox_elem :text
  ox_elem :created_at, :as => Time
  ox_elem :source
  ox_elem :truncated?
  ox_elem :in_reply_to_status_id, :as => Integer
  ox_elem :in_reply_to_user_id, :as => Integer
  ox_elem :favorited?
  ox_elem :user, :as => User
end
 
class Response
  include OxMlk
  
  ox_tag :statuses
  
  ox_elem :statuses, :as => [Status]
end

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

response.statuses.each do |status|
  puts "#{status.user.screen_name} - #{status.created_at}", status.text, ''
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oxmlk-0.4.0 examples/twitter.rb
oxmlk-0.3.3 examples/twitter.rb