nokogiri-happymapper 0.8.1 → 0.10.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +1 -4
  4. data/lib/happymapper/anonymous_mapper.rb +6 -5
  5. data/lib/happymapper/class_methods.rb +466 -0
  6. data/lib/happymapper/element.rb +3 -3
  7. data/lib/happymapper/item.rb +19 -13
  8. data/lib/happymapper/supported_types.rb +4 -6
  9. data/lib/happymapper/syntax_error.rb +6 -0
  10. data/lib/happymapper/version.rb +1 -1
  11. data/lib/happymapper.rb +54 -505
  12. data/lib/nokogiri-happymapper.rb +1 -1
  13. metadata +100 -107
  14. data/spec/features/after_parse_callbacks_spec.rb +0 -32
  15. data/spec/features/attribute_default_value_spec.rb +0 -48
  16. data/spec/features/attributes_spec.rb +0 -35
  17. data/spec/features/has_many_empty_array_spec.rb +0 -44
  18. data/spec/features/ignay_spec.rb +0 -92
  19. data/spec/features/inheritance_spec.rb +0 -121
  20. data/spec/features/mixed_namespaces_spec.rb +0 -60
  21. data/spec/features/parse_with_object_to_update_spec.rb +0 -116
  22. data/spec/features/same_tag_different_meaning_spec.rb +0 -44
  23. data/spec/features/to_xml_spec.rb +0 -205
  24. data/spec/features/to_xml_with_namespaces_spec.rb +0 -237
  25. data/spec/features/wildcard_tag_name_spec.rb +0 -110
  26. data/spec/features/wrap_spec.rb +0 -87
  27. data/spec/features/xpath_spec.rb +0 -84
  28. data/spec/fixtures/address.xml +0 -9
  29. data/spec/fixtures/ambigous_items.xml +0 -22
  30. data/spec/fixtures/analytics.xml +0 -61
  31. data/spec/fixtures/analytics_profile.xml +0 -127
  32. data/spec/fixtures/atom.xml +0 -19
  33. data/spec/fixtures/commit.xml +0 -52
  34. data/spec/fixtures/current_weather.xml +0 -89
  35. data/spec/fixtures/current_weather_missing_elements.xml +0 -18
  36. data/spec/fixtures/default_namespace_combi.xml +0 -6
  37. data/spec/fixtures/dictionary.xml +0 -20
  38. data/spec/fixtures/family_tree.xml +0 -21
  39. data/spec/fixtures/inagy.xml +0 -85
  40. data/spec/fixtures/lastfm.xml +0 -355
  41. data/spec/fixtures/multiple_namespaces.xml +0 -170
  42. data/spec/fixtures/multiple_primitives.xml +0 -5
  43. data/spec/fixtures/optional_attributes.xml +0 -6
  44. data/spec/fixtures/pita.xml +0 -133
  45. data/spec/fixtures/posts.xml +0 -23
  46. data/spec/fixtures/product_default_namespace.xml +0 -18
  47. data/spec/fixtures/product_no_namespace.xml +0 -10
  48. data/spec/fixtures/product_single_namespace.xml +0 -10
  49. data/spec/fixtures/quarters.xml +0 -19
  50. data/spec/fixtures/radar.xml +0 -21
  51. data/spec/fixtures/set_config_options.xml +0 -3
  52. data/spec/fixtures/statuses.xml +0 -422
  53. data/spec/fixtures/subclass_namespace.xml +0 -50
  54. data/spec/fixtures/unformatted_address.xml +0 -1
  55. data/spec/fixtures/wrapper.xml +0 -11
  56. data/spec/happymapper/anonymous_mapper_spec.rb +0 -158
  57. data/spec/happymapper/attribute_spec.rb +0 -12
  58. data/spec/happymapper/item_spec.rb +0 -177
  59. data/spec/happymapper_spec.rb +0 -1208
  60. data/spec/spec_helper.rb +0 -25
@@ -1,422 +0,0 @@
1
- <statuses type="array">
2
- <status>
3
- <created_at>Sat Aug 09 05:38:12 +0000 2008</created_at>
4
- <id>882281424</id>
5
- <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>
6
- <source>web</source>
7
- <truncated>false</truncated>
8
- <in_reply_to_status_id>1234</in_reply_to_status_id>
9
- <in_reply_to_user_id>12345</in_reply_to_user_id>
10
- <favorited></favorited>
11
- <user>
12
- <id>4243</id>
13
- <name>John Nunemaker</name>
14
- <screen_name>jnunemaker</screen_name>
15
- <location>Mishawaka, IN, US</location>
16
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
17
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
18
- <url>http://addictedtonew.com</url>
19
- <protected>false</protected>
20
- <followers_count>486</followers_count>
21
- </user>
22
- </status>
23
- <status>
24
- <created_at>Sat Aug 09 02:04:56 +0000 2008</created_at>
25
- <id>882145663</id>
26
- <text>@ijonas - wow that stuff sounds sweet</text>
27
- <source>web</source>
28
- <truncated>false</truncated>
29
- <in_reply_to_status_id>882005142</in_reply_to_status_id>
30
- <in_reply_to_user_id>1000471</in_reply_to_user_id>
31
- <favorited></favorited>
32
- <user>
33
- <id>4243</id>
34
- <name>John Nunemaker</name>
35
- <screen_name>jnunemaker</screen_name>
36
- <location>Mishawaka, IN, US</location>
37
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
38
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
39
- <url>http://addictedtonew.com</url>
40
- <protected>false</protected>
41
- <followers_count>486</followers_count>
42
- </user>
43
- </status>
44
- <status>
45
- <created_at>Sat Aug 09 01:36:41 +0000 2008</created_at>
46
- <id>882126691</id>
47
- <text>Steph is driving Sally for the first time. I'm proud of her.</text>
48
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
49
- <truncated>false</truncated>
50
- <in_reply_to_status_id></in_reply_to_status_id>
51
- <in_reply_to_user_id></in_reply_to_user_id>
52
- <favorited></favorited>
53
- <user>
54
- <id>4243</id>
55
- <name>John Nunemaker</name>
56
- <screen_name>jnunemaker</screen_name>
57
- <location>Mishawaka, IN, US</location>
58
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
59
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
60
- <url>http://addictedtonew.com</url>
61
- <protected>false</protected>
62
- <followers_count>486</followers_count>
63
- </user>
64
- </status>
65
- <status>
66
- <created_at>Fri Aug 08 22:21:21 +0000 2008</created_at>
67
- <id>881987762</id>
68
- <text>@ijonas - what are you making with couchdb, ruby and httparty?</text>
69
- <source>web</source>
70
- <truncated>false</truncated>
71
- <in_reply_to_status_id>881947237</in_reply_to_status_id>
72
- <in_reply_to_user_id>1000471</in_reply_to_user_id>
73
- <favorited></favorited>
74
- <user>
75
- <id>4243</id>
76
- <name>John Nunemaker</name>
77
- <screen_name>jnunemaker</screen_name>
78
- <location>Mishawaka, IN, US</location>
79
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
80
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
81
- <url>http://addictedtonew.com</url>
82
- <protected>false</protected>
83
- <followers_count>486</followers_count>
84
- </user>
85
- </status>
86
- <status>
87
- <created_at>Fri Aug 08 14:20:14 +0000 2008</created_at>
88
- <id>881535796</id>
89
- <text>@oaknd1 - delete it off phone and iTunes.</text>
90
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
91
- <truncated>false</truncated>
92
- <in_reply_to_status_id>881526234</in_reply_to_status_id>
93
- <in_reply_to_user_id>3038211</in_reply_to_user_id>
94
- <favorited></favorited>
95
- <user>
96
- <id>4243</id>
97
- <name>John Nunemaker</name>
98
- <screen_name>jnunemaker</screen_name>
99
- <location>Mishawaka, IN, US</location>
100
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
101
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
102
- <url>http://addictedtonew.com</url>
103
- <protected>false</protected>
104
- <followers_count>486</followers_count>
105
- </user>
106
- </status>
107
- <status>
108
- <created_at>Fri Aug 08 14:07:29 +0000 2008</created_at>
109
- <id>881522394</id>
110
- <text>Listening to U2 "beautiful day" in honor of it being such a beautiful day.</text>
111
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
112
- <truncated>false</truncated>
113
- <in_reply_to_status_id></in_reply_to_status_id>
114
- <in_reply_to_user_id></in_reply_to_user_id>
115
- <favorited></favorited>
116
- <user>
117
- <id>4243</id>
118
- <name>John Nunemaker</name>
119
- <screen_name>jnunemaker</screen_name>
120
- <location>Mishawaka, IN, US</location>
121
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
122
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
123
- <url>http://addictedtonew.com</url>
124
- <protected>false</protected>
125
- <followers_count>486</followers_count>
126
- </user>
127
- </status>
128
- <status>
129
- <created_at>Fri Aug 08 14:06:44 +0000 2008</created_at>
130
- <id>881521592</id>
131
- <text>@lizsmc1 - hi! (just passed her on the road)</text>
132
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
133
- <truncated>false</truncated>
134
- <in_reply_to_status_id>881519558</in_reply_to_status_id>
135
- <in_reply_to_user_id>11485452</in_reply_to_user_id>
136
- <favorited></favorited>
137
- <user>
138
- <id>4243</id>
139
- <name>John Nunemaker</name>
140
- <screen_name>jnunemaker</screen_name>
141
- <location>Mishawaka, IN, US</location>
142
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
143
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
144
- <url>http://addictedtonew.com</url>
145
- <protected>false</protected>
146
- <followers_count>486</followers_count>
147
- </user>
148
- </status>
149
- <status>
150
- <created_at>Fri Aug 08 13:59:35 +0000 2008</created_at>
151
- <id>881514030</id>
152
- <text>Beautiful day for a motorcycle ride.</text>
153
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
154
- <truncated>false</truncated>
155
- <in_reply_to_status_id></in_reply_to_status_id>
156
- <in_reply_to_user_id></in_reply_to_user_id>
157
- <favorited></favorited>
158
- <user>
159
- <id>4243</id>
160
- <name>John Nunemaker</name>
161
- <screen_name>jnunemaker</screen_name>
162
- <location>Mishawaka, IN, US</location>
163
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
164
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
165
- <url>http://addictedtonew.com</url>
166
- <protected>false</protected>
167
- <followers_count>486</followers_count>
168
- </user>
169
- </status>
170
- <status>
171
- <created_at>Fri Aug 08 13:45:21 +0000 2008</created_at>
172
- <id>881499439</id>
173
- <text>@lizamc1 - no way! Politos will be missed. I remember eating a whole garlic pizza there with Joe.</text>
174
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
175
- <truncated>false</truncated>
176
- <in_reply_to_status_id></in_reply_to_status_id>
177
- <in_reply_to_user_id></in_reply_to_user_id>
178
- <favorited></favorited>
179
- <user>
180
- <id>4243</id>
181
- <name>John Nunemaker</name>
182
- <screen_name>jnunemaker</screen_name>
183
- <location>Mishawaka, IN, US</location>
184
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
185
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
186
- <url>http://addictedtonew.com</url>
187
- <protected>false</protected>
188
- <followers_count>486</followers_count>
189
- </user>
190
- </status>
191
- <status>
192
- <created_at>Fri Aug 08 13:41:50 +0000 2008</created_at>
193
- <id>881496024</id>
194
- <text>Riding my motorcyle to campus. Using the library basement for a meeting.</text>
195
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
196
- <truncated>false</truncated>
197
- <in_reply_to_status_id></in_reply_to_status_id>
198
- <in_reply_to_user_id></in_reply_to_user_id>
199
- <favorited></favorited>
200
- <user>
201
- <id>4243</id>
202
- <name>John Nunemaker</name>
203
- <screen_name>jnunemaker</screen_name>
204
- <location>Mishawaka, IN, US</location>
205
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
206
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
207
- <url>http://addictedtonew.com</url>
208
- <protected>false</protected>
209
- <followers_count>486</followers_count>
210
- </user>
211
- </status>
212
- <status>
213
- <created_at>Thu Aug 07 22:52:20 +0000 2008</created_at>
214
- <id>880896190</id>
215
- <text>Scraping super glue off my finger with a knife.</text>
216
- <source>web</source>
217
- <truncated>false</truncated>
218
- <in_reply_to_status_id></in_reply_to_status_id>
219
- <in_reply_to_user_id></in_reply_to_user_id>
220
- <favorited></favorited>
221
- <user>
222
- <id>4243</id>
223
- <name>John Nunemaker</name>
224
- <screen_name>jnunemaker</screen_name>
225
- <location>Mishawaka, IN, US</location>
226
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
227
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
228
- <url>http://addictedtonew.com</url>
229
- <protected>false</protected>
230
- <followers_count>486</followers_count>
231
- </user>
232
- </status>
233
- <status>
234
- <created_at>Thu Aug 07 22:14:35 +0000 2008</created_at>
235
- <id>880866160</id>
236
- <text>So cold...Starbucks north side, you win the day, but I shall bring a sweatshirt to our next battle!</text>
237
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
238
- <truncated>false</truncated>
239
- <in_reply_to_status_id></in_reply_to_status_id>
240
- <in_reply_to_user_id></in_reply_to_user_id>
241
- <favorited></favorited>
242
- <user>
243
- <id>4243</id>
244
- <name>John Nunemaker</name>
245
- <screen_name>jnunemaker</screen_name>
246
- <location>Mishawaka, IN, US</location>
247
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
248
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
249
- <url>http://addictedtonew.com</url>
250
- <protected>false</protected>
251
- <followers_count>486</followers_count>
252
- </user>
253
- </status>
254
- <status>
255
- <created_at>Thu Aug 07 17:25:40 +0000 2008</created_at>
256
- <id>880610064</id>
257
- <text>Headed home for a bit to get my headphones and then to the north side to meet @orderedlist.</text>
258
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
259
- <truncated>false</truncated>
260
- <in_reply_to_status_id></in_reply_to_status_id>
261
- <in_reply_to_user_id></in_reply_to_user_id>
262
- <favorited></favorited>
263
- <user>
264
- <id>4243</id>
265
- <name>John Nunemaker</name>
266
- <screen_name>jnunemaker</screen_name>
267
- <location>Mishawaka, IN, US</location>
268
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
269
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
270
- <url>http://addictedtonew.com</url>
271
- <protected>false</protected>
272
- <followers_count>485</followers_count>
273
- </user>
274
- </status>
275
- <status>
276
- <created_at>Thu Aug 07 17:15:59 +0000 2008</created_at>
277
- <id>880600278</id>
278
- <text>Panera wifi, why do you hate me?</text>
279
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
280
- <truncated>false</truncated>
281
- <in_reply_to_status_id></in_reply_to_status_id>
282
- <in_reply_to_user_id></in_reply_to_user_id>
283
- <favorited></favorited>
284
- <user>
285
- <id>4243</id>
286
- <name>John Nunemaker</name>
287
- <screen_name>jnunemaker</screen_name>
288
- <location>Mishawaka, IN, US</location>
289
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
290
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
291
- <url>http://addictedtonew.com</url>
292
- <protected>false</protected>
293
- <followers_count>485</followers_count>
294
- </user>
295
- </status>
296
- <status>
297
- <created_at>Thu Aug 07 15:46:25 +0000 2008</created_at>
298
- <id>880509577</id>
299
- <text>At panera. Turned my alarm off this morning and woke up late. Oh well.</text>
300
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
301
- <truncated>false</truncated>
302
- <in_reply_to_status_id></in_reply_to_status_id>
303
- <in_reply_to_user_id></in_reply_to_user_id>
304
- <favorited></favorited>
305
- <user>
306
- <id>4243</id>
307
- <name>John Nunemaker</name>
308
- <screen_name>jnunemaker</screen_name>
309
- <location>Mishawaka, IN, US</location>
310
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
311
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
312
- <url>http://addictedtonew.com</url>
313
- <protected>false</protected>
314
- <followers_count>485</followers_count>
315
- </user>
316
- </status>
317
- <status>
318
- <created_at>Thu Aug 07 15:01:35 +0000 2008</created_at>
319
- <id>880463746</id>
320
- <text>@kloh I remember days like that. Exhausting. Also, NullRiver said to sync again, uninstall app from phone and then resync app. Evidently ...</text>
321
- <source>web</source>
322
- <truncated>true</truncated>
323
- <in_reply_to_status_id>880432701</in_reply_to_status_id>
324
- <in_reply_to_user_id>10193732</in_reply_to_user_id>
325
- <favorited></favorited>
326
- <user>
327
- <id>4243</id>
328
- <name>John Nunemaker</name>
329
- <screen_name>jnunemaker</screen_name>
330
- <location>Mishawaka, IN, US</location>
331
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
332
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
333
- <url>http://addictedtonew.com</url>
334
- <protected>false</protected>
335
- <followers_count>485</followers_count>
336
- </user>
337
- </status>
338
- <status>
339
- <created_at>Thu Aug 07 02:52:38 +0000 2008</created_at>
340
- <id>879986739</id>
341
- <text>@kloh - I haven't updated my OS so I'm wondering how apple could have made the app stop working. I did contact NullRiver support just no ...</text>
342
- <source>web</source>
343
- <truncated>true</truncated>
344
- <in_reply_to_status_id>879980813</in_reply_to_status_id>
345
- <in_reply_to_user_id>10193732</in_reply_to_user_id>
346
- <favorited></favorited>
347
- <user>
348
- <id>4243</id>
349
- <name>John Nunemaker</name>
350
- <screen_name>jnunemaker</screen_name>
351
- <location>Mishawaka, IN, US</location>
352
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
353
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
354
- <url>http://addictedtonew.com</url>
355
- <protected>false</protected>
356
- <followers_count>486</followers_count>
357
- </user>
358
- </status>
359
- <status>
360
- <created_at>Thu Aug 07 02:38:58 +0000 2008</created_at>
361
- <id>879976045</id>
362
- <text>@jerry - i went with the pdf download.</text>
363
- <source>web</source>
364
- <truncated>false</truncated>
365
- <in_reply_to_status_id>879878196</in_reply_to_status_id>
366
- <in_reply_to_user_id>613</in_reply_to_user_id>
367
- <favorited></favorited>
368
- <user>
369
- <id>4243</id>
370
- <name>John Nunemaker</name>
371
- <screen_name>jnunemaker</screen_name>
372
- <location>Mishawaka, IN, US</location>
373
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
374
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
375
- <url>http://addictedtonew.com</url>
376
- <protected>false</protected>
377
- <followers_count>486</followers_count>
378
- </user>
379
- </status>
380
- <status>
381
- <created_at>Thu Aug 07 02:31:26 +0000 2008</created_at>
382
- <id>879969851</id>
383
- <text>@kloh - it worked at home for multiple tests and just stopped when I acyltually needed it.</text>
384
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
385
- <truncated>false</truncated>
386
- <in_reply_to_status_id>879968483</in_reply_to_status_id>
387
- <in_reply_to_user_id>10193732</in_reply_to_user_id>
388
- <favorited></favorited>
389
- <user>
390
- <id>4243</id>
391
- <name>John Nunemaker</name>
392
- <screen_name>jnunemaker</screen_name>
393
- <location>Mishawaka, IN, US</location>
394
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
395
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
396
- <url>http://addictedtonew.com</url>
397
- <protected>false</protected>
398
- <followers_count>486</followers_count>
399
- </user>
400
- </status>
401
- <status>
402
- <created_at>Thu Aug 07 01:18:28 +0000 2008</created_at>
403
- <id>879913748</id>
404
- <text>Netshare will no longer start up for me. Of course it borks the first time I actually want to use it.</text>
405
- <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
406
- <truncated>false</truncated>
407
- <in_reply_to_status_id></in_reply_to_status_id>
408
- <in_reply_to_user_id></in_reply_to_user_id>
409
- <favorited></favorited>
410
- <user>
411
- <id>4243</id>
412
- <name>John Nunemaker</name>
413
- <screen_name>jnunemaker</screen_name>
414
- <location>Mishawaka, IN, US</location>
415
- <description>Loves his wife, ruby, notre dame football and iu basketball</description>
416
- <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
417
- <url>http://addictedtonew.com</url>
418
- <protected>false</protected>
419
- <followers_count>486</followers_count>
420
- </user>
421
- </status>
422
- </statuses>
@@ -1,50 +0,0 @@
1
- <article:Article xmlns:article="http://www.wetpaint.com/alfresco/article"
2
- xmlns:photo="http://www.wetpaint.com/alfresco/photo"
3
- xmlns:gallery="http://www.wetpaint.com/alfresco/gallery"
4
- xmlns:alf="http://www.alfresco.org"
5
- alf:name="title">
6
- <article:title>article title</article:title>
7
- <article:text>article text</article:text>
8
- <article:publishOptions>
9
- <article:author>Nathan</article:author>
10
- <article:draft>false</article:draft>
11
- <article:scheduledDay>2011-01-14</article:scheduledDay>
12
- <article:scheduledTime>11:31:45.0</article:scheduledTime>
13
- <article:publishDisplayDay>2011-01-14</article:publishDisplayDay>
14
- <article:publishDisplayTime>11:31:45.0</article:publishDisplayTime>
15
- <article:createdDay>2011-01-14</article:createdDay>
16
- <article:createdTime>11:52:24.0</article:createdTime>
17
- </article:publishOptions>
18
-
19
- <photo:Photo>
20
- <photo:title>photo title</photo:title>
21
- <photo:publishOptions>
22
- <photo:author>Stephanie</photo:author>
23
- <photo:draft>false</photo:draft>
24
- <photo:scheduledDay>2011-01-13</photo:scheduledDay>
25
- <photo:scheduledTime>15:47:30.0</photo:scheduledTime>
26
- <photo:publishDisplayDay>2011-01-13</photo:publishDisplayDay>
27
- <photo:publishDisplayTime>15:47:30.0</photo:publishDisplayTime>
28
- <photo:createdDay>2011-01-13</photo:createdDay>
29
- <photo:createdTime>15:51:47.0</photo:createdTime>
30
- </photo:publishOptions>
31
- </photo:Photo>
32
-
33
- <gallery:Gallery>
34
- <gallery:title>gallery title</gallery:title>
35
- <photo:Photo>
36
- <photo:title>photo title</photo:title>
37
- <photo:publishOptions>
38
- <photo:author>Stephanie</photo:author>
39
- <photo:draft>false</photo:draft>
40
- <photo:scheduledDay>2011-01-13</photo:scheduledDay>
41
- <photo:scheduledTime>15:47:30.0</photo:scheduledTime>
42
- <photo:publishDisplayDay>2011-01-13</photo:publishDisplayDay>
43
- <photo:publishDisplayTime>15:47:30.0</photo:publishDisplayTime>
44
- <photo:createdDay>2011-01-13</photo:createdDay>
45
- <photo:createdTime>15:51:47.0</photo:createdTime>
46
- </photo:publishOptions>
47
- </photo:Photo>
48
- </gallery:Gallery>
49
-
50
- </article:Article>
@@ -1 +0,0 @@
1
- <address><street>Milchstrasse</street><housenumber>23</housenumber></address>
@@ -1,11 +0,0 @@
1
- <root attr1="somevalue">
2
- <name>myname</name>
3
- <mywraptag>
4
- <description>some description</description>
5
- <subclass myattr='attrvalue'>
6
- <item>item1</item>
7
- <item>item2</item>
8
- </subclass>
9
- </mywraptag>
10
- <number>12345</number>
11
- </root>
@@ -1,158 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe HappyMapper::AnonymousMapper do
6
- let(:anonymous_mapper) { described_class.new }
7
-
8
- describe '#parse' do
9
- context 'when parsing a single root node' do
10
- let(:parsed_result) { anonymous_mapper.parse fixture_file('address.xml') }
11
-
12
- it 'creates the correct set of child elements on the element class' do
13
- elements = parsed_result.class.elements
14
- expect(elements.map(&:tag)).to eq %w(street housenumber postcode city country state)
15
- end
16
-
17
- it 'parses child elements' do
18
- aggregate_failures do
19
- expect(parsed_result.street).to eq('Milchstrasse')
20
- expect(parsed_result.housenumber).to eq('23')
21
- expect(parsed_result.postcode).to eq('26131')
22
- expect(parsed_result.city).to eq('Oldenburg')
23
- end
24
- end
25
-
26
- it 'does not create a content entry when the xml contents no text content' do
27
- expect(parsed_result).not_to respond_to :content
28
- end
29
-
30
- it 'parses both the attributes and content when present' do
31
- aggregate_failures do
32
- expect(parsed_result.country.code).to eq('de')
33
- expect(parsed_result.country.content).to eq('Germany')
34
- end
35
- end
36
- end
37
-
38
- context 'with element names with special characters' do
39
- let(:parsed_result) { anonymous_mapper.parse fixture_file('ambigous_items.xml') }
40
-
41
- it 'creates accessor methods with similar names' do
42
- expect(parsed_result.my_items.item).to be_kind_of Array
43
- end
44
- end
45
-
46
- context 'with element names with camelCased elements and Capital Letters' do
47
- let(:parsed_result) { anonymous_mapper.parse fixture_file('subclass_namespace.xml') }
48
-
49
- it 'parses camel-cased child elements correctly' do
50
- aggregate_failures do
51
- expect(parsed_result.photo.publish_options.author).to eq('Stephanie')
52
- expect(parsed_result.gallery.photo.title).to eq('photo title')
53
- end
54
- end
55
-
56
- it 'parses camel-cased child properties correctly' do
57
- expect(parsed_result.publish_options.created_day).to eq('2011-01-14')
58
- end
59
- end
60
-
61
- context 'with repeated elements with camel-cased names' do
62
- let(:xml) do
63
- <<~XML
64
- <foo>
65
- <fooBar>
66
- <baz>Hello</baz>
67
- </fooBar>
68
- <fooBar>
69
- <baz>Hi</baz>
70
- </fooBar>
71
- </foo>
72
- XML
73
- end
74
- let(:parsed_result) { anonymous_mapper.parse xml }
75
-
76
- it 'parses the repeated elements correctly' do
77
- expect(parsed_result.foo_bar.map(&:baz)).to eq %w(Hello Hi)
78
- end
79
- end
80
-
81
- context 'with elements with camelCased attribute names' do
82
- let(:parsed_result) { anonymous_mapper.parse '<foo barBaz="quuz"/>' }
83
-
84
- it 'parses attributes correctly' do
85
- expect(parsed_result.bar_baz).to eq('quuz')
86
- end
87
- end
88
-
89
- context 'with several elements nested deeply' do
90
- let(:parsed_result) { anonymous_mapper.parse fixture_file('ambigous_items.xml') }
91
-
92
- it 'parses the entire relationship' do
93
- expect(parsed_result.my_items.item.first.item.name).to eq('My first internal item')
94
- end
95
- end
96
-
97
- context 'when parsing an that contains multiple elements with the same tag' do
98
- let(:parsed_result) { anonymous_mapper.parse fixture_file('multiple_primitives.xml') }
99
-
100
- it "parses the elements as it would a 'has_many'" do
101
- aggregate_failures do
102
- expect(parsed_result.name).to eq('value')
103
- expect(parsed_result.image).to eq(%w(image1 image2))
104
- end
105
- end
106
- end
107
-
108
- context 'when parsing xml with multiple namespaces' do
109
- let(:parsed_result) { anonymous_mapper.parse fixture_file('subclass_namespace.xml') }
110
-
111
- it 'parses the elements an values correctly' do
112
- expect(parsed_result.title).to eq('article title')
113
- end
114
-
115
- it 'parses attribute names correctly' do
116
- expect(parsed_result.name).to eq 'title'
117
- end
118
- end
119
-
120
- context 'when parsing an element with a nested value element with a different namespace' do
121
- let(:xml) do
122
- <<~XML
123
- <a:foo xmlns:a="http://foo.org/a" xmlns:b="http://foo.org/b">
124
- <b:bar>Hello</b:bar>
125
- </a:foo>
126
- XML
127
- end
128
- let(:result) { anonymous_mapper.parse xml }
129
-
130
- it 'parses the value elements correctly' do
131
- expect(result.bar).to eq 'Hello'
132
- end
133
- end
134
-
135
- context 'when parsing xml that uses the same tag for string and other elements' do
136
- let(:xml) do
137
- <<~XML
138
- <foo>
139
- <bar>
140
- <baz>Hello</baz>
141
- </bar>
142
- <baz>
143
- <qux>Hi</qux>
144
- </baz>
145
- </foo>
146
- XML
147
- end
148
- let(:result) { anonymous_mapper.parse xml }
149
-
150
- it 'parses both occurences of the tag correctly' do
151
- aggregate_failures do
152
- expect(result.bar.baz).to eq 'Hello'
153
- expect(result.baz.qux).to eq 'Hi'
154
- end
155
- end
156
- end
157
- end
158
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe HappyMapper::Attribute do
6
- describe 'initialization' do
7
- it 'accepts :default option' do
8
- attr = described_class.new(:foo, String, default: 'foobar')
9
- expect(attr.default).to eq('foobar')
10
- end
11
- end
12
- end