Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 121 lines (96 sloc) 3.452 kB
276643a Initial version, extracted from ruby-picasa and reorganized.
Darrick Wiebe authored
1 = Objectify::Xml
2
3 * http://github.com/pangloss/objectify_xml
4
5 == DESCRIPTION:
6
7 Provides an easy to use DSL resembling ActiveRecord for defining objects
b43900d Fixed gem names and improved the description.
Darrick Wiebe authored
8 representing any XML document, including deeply nested ones. This project was
9 extracted from my ruby-picasa gem. You can find ruby-picasa at
c627190 Fixed link to ruby_picasa
Darrick Wiebe authored
10 http://github.com/pangloss/ruby_picasa or available as a gem.
276643a Initial version, extracted from ruby-picasa and reorganized.
Darrick Wiebe authored
11
b43900d Fixed gem names and improved the description.
Darrick Wiebe authored
12 The project also has significant (if not complete) Atom support.
276643a Initial version, extracted from ruby-picasa and reorganized.
Darrick Wiebe authored
13
14 == FEATURES:
15
16 * Capture and typecast standard attributes
17 * Define both has_one and has_many nested element 'associations'
18 * Significant (if not full) namespace support
19 * Cleanly ignore unknown attributes and namespaces
20 * Support documents that nest data unnecessarily without creating bogus
21 associated objects.
22 * Inheritable object definitions
23
24 == PROBLEMS:
25
26 * None known.
27
28 == SYNOPSIS:
29
30 The following are functioning early definitions for some of the objects used in
31 ruby-picasa in their entirety:
32
b43900d Fixed gem names and improved the description.
Darrick Wiebe authored
33 require 'objectify_xml'
34 require 'objectify_xml/atom'
276643a Initial version, extracted from ruby-picasa and reorganized.
Darrick Wiebe authored
35 module RubyPicasa
36 class PhotoUrl < Objectify::Xml::ElementParser
37 attr_accessor :url, :height, :width
38 end
39
40 class Album < Objectify::Xml::DocumentParser
41 attributes :id,
42 :published,
43 :updated,
44 :title,
45 :summary,
46 :rights,
47 :gphoto_id,
48 :name,
49 :access,
50 :numphotos,
51 :total_results,
52 :start_index,
53 :items_per_page,
54 :allow_downloads
55 has_many :links, Objectify::Atom::Link, 'link'
56 has_many :entries, :Photo, 'entry'
57 has_one :content, PhotoUrl, 'media:content'
58 has_many :thumbnails, PhotoUrl, 'media:thumbnail'
59 flatten 'media:group'
60 namespaces %w[openSearch gphoto media]
61 end
62
63 class Photo < Objectify::Xml::DocumentParser
64 attributes :id,
65 :published,
66 :updated,
67 :title,
68 :summary,
69 :gphoto_id,
70 :version,
71 :position,
72 :albumid,
73 :width,
74 :height,
75 :description,
76 :keywords
77 has_many :links, Objectify::Atom::Link, 'link'
78 has_one :content, PhotoUrl, 'media:content'
79 has_many :thumbnails, PhotoUrl, 'media:thumbnail'
80 namespaces %w[gphoto media]
81 flatten 'media:group'
82 end
83 end
84
85
86 == REQUIREMENTS:
87
88 * nokogiri
89 * activeresource
90
91 == INSTALL:
92
93 * Installable either as a gem or vendored into a project.
b43900d Fixed gem names and improved the description.
Darrick Wiebe authored
94 * gem install objectify-xml
95 * gem install pangloss-objectify-xml --source http://gems.github.com
276643a Initial version, extracted from ruby-picasa and reorganized.
Darrick Wiebe authored
96
97 == LICENSE:
98
99 (The MIT License)
100
6d55d7c Version 0.2.0
Darrick Wiebe authored
101 Copyright (c) 2009 Darrick Wiebe
276643a Initial version, extracted from ruby-picasa and reorganized.
Darrick Wiebe authored
102
103 Permission is hereby granted, free of charge, to any person obtaining
104 a copy of this software and associated documentation files (the
105 'Software'), to deal in the Software without restriction, including
106 without limitation the rights to use, copy, modify, merge, publish,
107 distribute, sublicense, and/or sell copies of the Software, and to
108 permit persons to whom the Software is furnished to do so, subject to
109 the following conditions:
110
111 The above copyright notice and this permission notice shall be
112 included in all copies or substantial portions of the Software.
113
114 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
115 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
116 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
117 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
118 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
119 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
120 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.