Sha256: 36565721c1c2a216ee4ecb00d7025286d893bc80445ff5c562d9f64c84ee8c20

Contents?: true

Size: 931 Bytes

Versions: 49

Compression:

Stored size: 931 Bytes

Contents

dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'happymapper')

file_contents = File.read(dir + '/../spec/fixtures/statuses.xml')

class User
  include HappyMapper
  
  element :id, Integer
  element :name, String
  element :screen_name, String
  element :location, String
  element :description, String
  element :profile_image_url, String
  element :url, String
  element :protected, Boolean
  element :followers_count, Integer
end

class Status
  include HappyMapper
  
  element :id, Integer
  element :text, String
	element :created_at, Time
	element :source, String
	element :truncated, Boolean
	element :in_reply_to_status_id, Integer
	element :in_reply_to_user_id, Integer
	element :favorited, Boolean
	has_one :user, User
end

statuses = Status.parse(file_contents)
statuses.each do |status|
  puts status.user.name, status.user.screen_name, status.text, status.source, ''
end

Version data entries

49 entries across 49 versions & 13 rubygems

Version Path
dam5s-happymapper-0.3.2 examples/twitter.rb
gotascii-happymapper-0.1.6 examples/twitter.rb
jimmyz-happymapper-0.3.1 examples/twitter.rb
jimmyz-happymapper-0.3.2 examples/twitter.rb
jimmyz-happymapper-0.3.3 examples/twitter.rb
jnunemaker-happymapper-0.1.2 examples/twitter.rb
jnunemaker-happymapper-0.1.3 examples/twitter.rb
jnunemaker-happymapper-0.1.4 examples/twitter.rb
jnunemaker-happymapper-0.1.5 examples/twitter.rb
jnunemaker-happymapper-0.1.6 examples/twitter.rb
jnunemaker-happymapper-0.1.7 examples/twitter.rb
jnunemaker-happymapper-0.2.0 examples/twitter.rb
jnunemaker-happymapper-0.2.1 examples/twitter.rb
jnunemaker-happymapper-0.2.2 examples/twitter.rb
jnunemaker-happymapper-0.2.3 examples/twitter.rb
jnunemaker-happymapper-0.2.4 examples/twitter.rb
jnunemaker-happymapper-0.2.5 examples/twitter.rb
kdonovan-happymapper-0.3.4 examples/twitter.rb
kdonovan-happymapper-0.3.5 examples/twitter.rb
lightningdb-happymapper-0.3.0 examples/twitter.rb