Sha256: 81c4eba9539f7b4dfb86e57f1b5364a39ae8fc8d9d1c8c1d7a08bf5aa4acb34d

Contents?: true

Size: 961 Bytes

Versions: 2

Compression:

Stored size: 961 Bytes

Contents

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

class User
  include OxMlk
  
  ox_tag :user
  
  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 :status
     
  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.3.2 examples/twitter.rb
oxmlk-0.3.1 examples/twitter.rb