legolin-happymapper 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/HOW_TO_RELEASE +5 -0
  2. data/History +59 -0
  3. data/License +20 -0
  4. data/Manifest +42 -0
  5. data/README +61 -0
  6. data/Rakefile +43 -0
  7. data/TODO +0 -0
  8. data/examples/amazon.rb +34 -0
  9. data/examples/current_weather.rb +21 -0
  10. data/examples/dashed_elements.rb +20 -0
  11. data/examples/multi_street_address.rb +15 -0
  12. data/examples/post.rb +19 -0
  13. data/examples/twitter.rb +37 -0
  14. data/happymapper.gemspec +0 -0
  15. data/legolin-happymapper.gemspec +34 -0
  16. data/lib/happymapper.rb +161 -0
  17. data/lib/happymapper/attribute.rb +3 -0
  18. data/lib/happymapper/element.rb +3 -0
  19. data/lib/happymapper/item.rb +192 -0
  20. data/lib/happymapper/version.rb +3 -0
  21. data/spec/fixtures/address.xml +8 -0
  22. data/spec/fixtures/analytics.xml +61 -0
  23. data/spec/fixtures/commit.xml +52 -0
  24. data/spec/fixtures/current_weather.xml +89 -0
  25. data/spec/fixtures/family_tree.xml +7 -0
  26. data/spec/fixtures/multi_street_address.xml +9 -0
  27. data/spec/fixtures/multiple_namespaces.xml +170 -0
  28. data/spec/fixtures/nested_namespaces.xml +17 -0
  29. data/spec/fixtures/pita.xml +133 -0
  30. data/spec/fixtures/posts.xml +23 -0
  31. data/spec/fixtures/product_default_namespace.xml +10 -0
  32. data/spec/fixtures/product_no_namespace.xml +10 -0
  33. data/spec/fixtures/product_single_namespace.xml +10 -0
  34. data/spec/fixtures/radar.xml +21 -0
  35. data/spec/fixtures/statuses.xml +422 -0
  36. data/spec/happymapper_attribute_spec.rb +17 -0
  37. data/spec/happymapper_element_spec.rb +17 -0
  38. data/spec/happymapper_item_spec.rb +115 -0
  39. data/spec/happymapper_spec.rb +719 -0
  40. data/spec/spec.opts +1 -0
  41. data/spec/spec_helper.rb +13 -0
  42. data/website/css/common.css +47 -0
  43. data/website/index.html +98 -0
  44. metadata +129 -0
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,13 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'happymapper')
10
+
11
+ def fixture_file(filename)
12
+ File.read(File.dirname(__FILE__) + "/fixtures/#{filename}")
13
+ end
@@ -0,0 +1,47 @@
1
+ @media screen, projection {
2
+ /*
3
+ Copyright (c) 2007, Yahoo! Inc. All rights reserved.
4
+ Code licensed under the BSD License:
5
+ http://developer.yahoo.net/yui/license.txt
6
+ version: 2.2.0
7
+ */
8
+ body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
9
+ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}/*ol,ul {list-style:none;}*/caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
10
+ /* end of yahoo reset and fonts */
11
+
12
+ body {color:#333; background:#4b1a1a; line-height:1.3;}
13
+ p {margin:0 0 20px;}
14
+ a {color:#4b1a1a;}
15
+ a:hover {text-decoration:none;}
16
+ strong {font-weight:bold;}
17
+ em {font-style:italics;}
18
+ h1,h2,h3,h4,h5,h6 {font-weight:bold;}
19
+ h1 {font-size:197%; margin:30px 0; color:#4b1a1a;}
20
+ h2 {font-size:174%; margin:20px 0; color:#b8111a;}
21
+ h3 {font-size:152%; margin:10px 0;}
22
+ h4 {font-size:129%; margin:10px 0;}
23
+ pre {background:#eee; margin:0 0 20px; padding:20px; border:1px solid #ccc; font-size:100%; overflow:auto;}
24
+ code {font-size:100%; margin:0; padding:0;}
25
+ ul, ol {margin:10px 0 10px 25px;}
26
+ ol li {margin:0 0 10px;}
27
+
28
+
29
+
30
+
31
+
32
+ div#wrapper {background:#fff; width:560px; margin:0 auto; padding:20px; border:10px solid #bc8c46; border-width:0 10px;}
33
+ div#header {position:relative; border-bottom:1px dotted; margin:0 0 10px; padding:0 0 10px;}
34
+ div#header p {margin:0; padding:0;}
35
+ div#header h1 {margin:0; padding:0;}
36
+ ul#nav {position:absolute; top:0; right:0; list-style:none; margin:0; padding:0;}
37
+ ul#nav li {display:inline; padding:0 0 0 5px;}
38
+ ul#nav li a {}
39
+ div#content {}
40
+ div#footer {margin:40px 0 0; border-top:1px dotted; padding:10px 0 0;}
41
+
42
+
43
+
44
+
45
+
46
+
47
+ }
@@ -0,0 +1,98 @@
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>$ sudo gem install happymapper</code></pre>
26
+
27
+ <h2>Examples</h2>
28
+
29
+ <h3>Given the following xml:</h3>
30
+ <pre><code>&lt;statuses type="array">
31
+ &lt;status>
32
+ &lt;created_at>Sat Aug 09 05:38:12 +0000 2008&lt;/created_at>
33
+ &lt;id>882281424&lt;/id>
34
+ &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>
35
+ &lt;source>web&lt;/source>
36
+ &lt;truncated>false&lt;/truncated>
37
+ &lt;in_reply_to_status_id>1234&lt;/in_reply_to_status_id>
38
+ &lt;in_reply_to_user_id>12345&lt;/in_reply_to_user_id>
39
+ &lt;favorited>&lt;/favorited>
40
+ &lt;user>
41
+ &lt;id>4243&lt;/id>
42
+ &lt;name>John Nunemaker&lt;/name>
43
+ &lt;screen_name>jnunemaker&lt;/screen_name>
44
+ &lt;location>Mishawaka, IN, US&lt;/location>
45
+ &lt;description>Loves his wife, ruby, notre dame football and iu basketball&lt;/description>
46
+ &lt;profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg&lt;/profile_image_url>
47
+ &lt;url>http://addictedtonew.com&lt;/url>
48
+ &lt;protected>false&lt;/protected>
49
+ &lt;followers_count>486&lt;/followers_count>
50
+ &lt;/user>
51
+ &lt;/status>
52
+ &lt;/statuses></code></pre>
53
+
54
+ <h3>You could have the following objects:</h3>
55
+
56
+ <pre><code>class User
57
+ include HappyMapper
58
+
59
+ element :id, Integer
60
+ element :name, String
61
+ element :screen_name, String
62
+ element :location, String
63
+ element :description, String
64
+ element :profile_image_url, String
65
+ element :url, String
66
+ element :protected, Boolean
67
+ element :followers_count, Integer
68
+ end
69
+
70
+ class Status
71
+ include HappyMapper
72
+
73
+ element :id, Integer
74
+ element :text, String
75
+ element :created_at, Time
76
+ element :source, String
77
+ element :truncated, Boolean
78
+ element :in_reply_to_status_id, Integer
79
+ element :in_reply_to_user_id, Integer
80
+ element :favorited, Boolean
81
+ has_one :user, User
82
+ end
83
+
84
+ statuses = Status.parse(file_contents)
85
+ statuses.each do |status|
86
+ puts status.user.name, status.user.screen_name, status.text, status.source, ''
87
+ end</code></pre>
88
+
89
+ <h2>Support</h2>
90
+ <p>Conversations welcome in the <a href="http://groups.google.com/group/happymapper">google group</a> and bugs/features over at <a href="http://github.com/jnunemaker/happymapper/issues/">Github</a>.</p>
91
+ </div>
92
+
93
+ <div id="footer">
94
+ <p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a></p>
95
+ </div>
96
+ </div>
97
+ </body>
98
+ </html>
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: legolin-happymapper
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
+ platform: ruby
11
+ authors:
12
+ - John Nunemaker
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-25 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: libxml-ruby
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 1
30
+ - 3
31
+ version: 1.1.3
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: object to xml mapping library
35
+ email: nunemaker@gmail.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - lib/happymapper/attribute.rb
42
+ - lib/happymapper/element.rb
43
+ - lib/happymapper/item.rb
44
+ - lib/happymapper/version.rb
45
+ - lib/happymapper.rb
46
+ - README
47
+ - TODO
48
+ files:
49
+ - examples/amazon.rb
50
+ - examples/current_weather.rb
51
+ - examples/dashed_elements.rb
52
+ - examples/multi_street_address.rb
53
+ - examples/post.rb
54
+ - examples/twitter.rb
55
+ - happymapper.gemspec
56
+ - History
57
+ - HOW_TO_RELEASE
58
+ - lib/happymapper/attribute.rb
59
+ - lib/happymapper/element.rb
60
+ - lib/happymapper/item.rb
61
+ - lib/happymapper/version.rb
62
+ - lib/happymapper.rb
63
+ - License
64
+ - Manifest
65
+ - Rakefile
66
+ - README
67
+ - spec/fixtures/address.xml
68
+ - spec/fixtures/analytics.xml
69
+ - spec/fixtures/commit.xml
70
+ - spec/fixtures/current_weather.xml
71
+ - spec/fixtures/family_tree.xml
72
+ - spec/fixtures/multi_street_address.xml
73
+ - spec/fixtures/multiple_namespaces.xml
74
+ - spec/fixtures/nested_namespaces.xml
75
+ - spec/fixtures/pita.xml
76
+ - spec/fixtures/posts.xml
77
+ - spec/fixtures/product_default_namespace.xml
78
+ - spec/fixtures/product_no_namespace.xml
79
+ - spec/fixtures/product_single_namespace.xml
80
+ - spec/fixtures/radar.xml
81
+ - spec/fixtures/statuses.xml
82
+ - spec/happymapper_attribute_spec.rb
83
+ - spec/happymapper_element_spec.rb
84
+ - spec/happymapper_item_spec.rb
85
+ - spec/happymapper_spec.rb
86
+ - spec/spec.opts
87
+ - spec/spec_helper.rb
88
+ - TODO
89
+ - website/css/common.css
90
+ - website/index.html
91
+ - legolin-happymapper.gemspec
92
+ has_rdoc: true
93
+ homepage: http://legolin-happymapper.rubyforge.org
94
+ licenses: []
95
+
96
+ post_install_message: May you have many happy mappings!
97
+ rdoc_options:
98
+ - --line-numbers
99
+ - --inline-source
100
+ - --title
101
+ - Legolin-happymapper
102
+ - --main
103
+ - README
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 1
119
+ - 2
120
+ version: "1.2"
121
+ requirements: []
122
+
123
+ rubyforge_project: legolin-happymapper
124
+ rubygems_version: 1.3.6
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: object to xml mapping library
128
+ test_files: []
129
+