happymapper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,103 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5
+ <title>HappyMapper by John Nunemaker</title>
6
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
7
+ </head>
8
+ <body>
9
+
10
+ <div id="wrapper">
11
+ <div id="header">
12
+ <h1>HappyMapper</h1>
13
+ <p>Object to xml mapping library.</p>
14
+
15
+ <ul id="nav">
16
+ <li><a href="rdoc/">Docs</a></li>
17
+ <li><a href="http://github.com/jnunemaker/happymapper">Github</a></li>
18
+ <li><a href="http://jnunemaker.lighthouseapp.com/projects/20014-happy-mapper/overview">Lighthouse</a></li>
19
+ <li><a href="http://rubyforge.org/projects/happymapper/">Rubyforge</a></li>
20
+ </ul>
21
+ </div>
22
+
23
+ <div id="content">
24
+ <h2>Install</h2>
25
+ <pre><code># add github to your sources if you haven't
26
+ $ gem sources -a http://gems.github.com
27
+ $ sudo gem install jnunemaker-happymapper
28
+
29
+ # (when rubyforge approves and I release there, you can do this)
30
+ $ sudo gem install happymapper</code></pre>
31
+
32
+ <h2>Examples</h2>
33
+
34
+ <h3>Given the following xml:</h3>
35
+ <pre><code>&lt;statuses type="array">
36
+ &lt;status>
37
+ &lt;created_at>Sat Aug 09 05:38:12 +0000 2008&lt;/created_at>
38
+ &lt;id>882281424&lt;/id>
39
+ &lt;text>I so just thought the guy lighting the Olympic torch was falling when he began to run on the wall. Wow that would have been catastrophic.&lt;/text>
40
+ &lt;source>web&lt;/source>
41
+ &lt;truncated>false&lt;/truncated>
42
+ &lt;in_reply_to_status_id>1234&lt;/in_reply_to_status_id>
43
+ &lt;in_reply_to_user_id>12345&lt;/in_reply_to_user_id>
44
+ &lt;favorited>&lt;/favorited>
45
+ &lt;user>
46
+ &lt;id>4243&lt;/id>
47
+ &lt;name>John Nunemaker&lt;/name>
48
+ &lt;screen_name>jnunemaker&lt;/screen_name>
49
+ &lt;location>Mishawaka, IN, US&lt;/location>
50
+ &lt;description>Loves his wife, ruby, notre dame football and iu basketball&lt;/description>
51
+ &lt;profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg&lt;/profile_image_url>
52
+ &lt;url>http://addictedtonew.com&lt;/url>
53
+ &lt;protected>false&lt;/protected>
54
+ &lt;followers_count>486&lt;/followers_count>
55
+ &lt;/user>
56
+ &lt;/status>
57
+ &lt;/statuses></code></pre>
58
+
59
+ <h3>You could have the following objects:</h3>
60
+
61
+ <pre><code>class User
62
+ include HappyMapper
63
+
64
+ element :id, Integer
65
+ element :name, String
66
+ element :screen_name, String
67
+ element :location, String
68
+ element :description, String
69
+ element :profile_image_url, String
70
+ element :url, String
71
+ element :protected, Boolean
72
+ element :followers_count, Integer
73
+ end
74
+
75
+ class Status
76
+ include HappyMapper
77
+
78
+ element :id, Integer
79
+ element :text, String
80
+ element :created_at, Time
81
+ element :source, String
82
+ element :truncated, Boolean
83
+ element :in_reply_to_status_id, Integer
84
+ element :in_reply_to_user_id, Integer
85
+ element :favorited, Boolean
86
+ has_one :user, User
87
+ end
88
+
89
+ statuses = Status.parse(file_contents)
90
+ statuses.each do |status|
91
+ puts status.user.name, status.user.screen_name, status.text, status.source, ''
92
+ end</code></pre>
93
+
94
+ <h2>Support</h2>
95
+ <p>Conversations welcome in the <a href="http://groups.google.com/group/happymapper">google group</a> and bugs/features over at <a href="http://jnunemaker.lighthouseapp.com/projects/20014-happy-mapper/overview">Lightouse</a>.</p>
96
+ </div>
97
+
98
+ <div id="footer">
99
+ <p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a></p>
100
+ </div>
101
+ </div>
102
+ </body>
103
+ </html>
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: happymapper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - John Nunemaker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-17 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.0
24
+ version:
25
+ description: object to xml mapping library
26
+ email:
27
+ - nunemaker@gmail.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - History.txt
34
+ - License.txt
35
+ - Manifest.txt
36
+ - PostInstall.txt
37
+ - README.txt
38
+ - TODO.txt
39
+ files:
40
+ - History.txt
41
+ - License.txt
42
+ - Manifest.txt
43
+ - PostInstall.txt
44
+ - README.txt
45
+ - Rakefile
46
+ - TODO.txt
47
+ - config/hoe.rb
48
+ - config/requirements.rb
49
+ - examples/amazon.rb
50
+ - examples/post.rb
51
+ - examples/twitter.rb
52
+ - happymapper.gemspec
53
+ - lib/happymapper.rb
54
+ - lib/happymapper/attribute.rb
55
+ - lib/happymapper/element.rb
56
+ - lib/happymapper/item.rb
57
+ - lib/happymapper/version.rb
58
+ - lib/libxml_ext/libxml_helper.rb
59
+ - script/console
60
+ - script/destroy
61
+ - script/generate
62
+ - script/txt2html
63
+ - setup.rb
64
+ - spec/fixtures/pita.xml
65
+ - spec/fixtures/posts.xml
66
+ - spec/fixtures/statuses.xml
67
+ - spec/happymapper_attribute_spec.rb
68
+ - spec/happymapper_element_spec.rb
69
+ - spec/happymapper_item_spec.rb
70
+ - spec/happymapper_spec.rb
71
+ - spec/spec.opts
72
+ - spec/spec_helper.rb
73
+ - tasks/deployment.rake
74
+ - tasks/environment.rake
75
+ - tasks/rspec.rake
76
+ - tasks/website.rake
77
+ - website/css/common.css
78
+ - website/index.html
79
+ has_rdoc: true
80
+ homepage: http://happymapper.rubyforge.org
81
+ post_install_message: ""
82
+ rdoc_options:
83
+ - --main
84
+ - README.txt
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ version:
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ requirements: []
100
+
101
+ rubyforge_project: happymapper
102
+ rubygems_version: 1.3.1
103
+ signing_key:
104
+ specification_version: 2
105
+ summary: object to xml mapping library
106
+ test_files: []
107
+