happymapper 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +39 -0
- data/PostInstall.txt +0 -0
- data/README.txt +26 -0
- data/Rakefile +4 -0
- data/TODO.txt +1 -0
- data/config/hoe.rb +73 -0
- data/config/requirements.rb +15 -0
- data/examples/amazon.rb +29 -0
- data/examples/post.rb +19 -0
- data/examples/twitter.rb +37 -0
- data/happymapper.gemspec +35 -0
- data/lib/happymapper.rb +123 -0
- data/lib/happymapper/attribute.rb +3 -0
- data/lib/happymapper/element.rb +3 -0
- data/lib/happymapper/item.rb +86 -0
- data/lib/happymapper/version.rb +9 -0
- data/lib/libxml_ext/libxml_helper.rb +93 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/spec/fixtures/pita.xml +132 -0
- data/spec/fixtures/posts.xml +23 -0
- data/spec/fixtures/statuses.xml +422 -0
- data/spec/happymapper_attribute_spec.rb +17 -0
- data/spec/happymapper_element_spec.rb +17 -0
- data/spec/happymapper_item_spec.rb +73 -0
- data/spec/happymapper_spec.rb +213 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- data/tasks/deployment.rake +43 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- data/website/css/common.css +47 -0
- data/website/index.html +103 -0
- metadata +107 -0
data/website/index.html
ADDED
@@ -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><statuses type="array">
|
36
|
+
<status>
|
37
|
+
<created_at>Sat Aug 09 05:38:12 +0000 2008</created_at>
|
38
|
+
<id>882281424</id>
|
39
|
+
<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.</text>
|
40
|
+
<source>web</source>
|
41
|
+
<truncated>false</truncated>
|
42
|
+
<in_reply_to_status_id>1234</in_reply_to_status_id>
|
43
|
+
<in_reply_to_user_id>12345</in_reply_to_user_id>
|
44
|
+
<favorited></favorited>
|
45
|
+
<user>
|
46
|
+
<id>4243</id>
|
47
|
+
<name>John Nunemaker</name>
|
48
|
+
<screen_name>jnunemaker</screen_name>
|
49
|
+
<location>Mishawaka, IN, US</location>
|
50
|
+
<description>Loves his wife, ruby, notre dame football and iu basketball</description>
|
51
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
|
52
|
+
<url>http://addictedtonew.com</url>
|
53
|
+
<protected>false</protected>
|
54
|
+
<followers_count>486</followers_count>
|
55
|
+
</user>
|
56
|
+
</status>
|
57
|
+
</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
|
+
|