jnunemaker-happymapper 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +1 -0
- data/happymapper.gemspec +2 -2
- data/lib/happymapper.rb +1 -1
- data/lib/happymapper/version.rb +1 -1
- data/spec/fixtures/address.xml +8 -0
- data/spec/happymapper_spec.rb +24 -0
- metadata +2 -1
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 0.1.4 2009-01-05
|
2
|
+
* 1 major enhancement:
|
3
|
+
* Fixed parsing when the object is the root node. (Garret Alfert)
|
4
|
+
|
1
5
|
== 0.1.3 2008-12-31
|
2
6
|
* 1 major enhancement:
|
3
7
|
* Added parsing of attributes of elements that are also mapped, see current_weather.rb for example (jeremyf)
|
data/Manifest.txt
CHANGED
data/happymapper.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{happymapper}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["John Nunemaker"]
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = %q{object to xml mapping library}
|
11
11
|
s.email = ["nunemaker@gmail.com"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "TODO.txt"]
|
13
|
-
s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "TODO.txt", "config/hoe.rb", "config/requirements.rb", "examples/amazon.rb", "examples/current_weather.rb", "examples/post.rb", "examples/twitter.rb", "happymapper.gemspec", "lib/happymapper.rb", "lib/happymapper/attribute.rb", "lib/happymapper/element.rb", "lib/happymapper/item.rb", "lib/happymapper/version.rb", "lib/libxml_ext/libxml_helper.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/fixtures/current_weather.xml", "spec/fixtures/pita.xml", "spec/fixtures/posts.xml", "spec/fixtures/statuses.xml", "spec/happymapper_attribute_spec.rb", "spec/happymapper_element_spec.rb", "spec/happymapper_item_spec.rb", "spec/happymapper_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake", "tasks/website.rake", "website/css/common.css", "website/index.html"]
|
13
|
+
s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "TODO.txt", "config/hoe.rb", "config/requirements.rb", "examples/amazon.rb", "examples/current_weather.rb", "examples/post.rb", "examples/twitter.rb", "happymapper.gemspec", "lib/happymapper.rb", "lib/happymapper/attribute.rb", "lib/happymapper/element.rb", "lib/happymapper/item.rb", "lib/happymapper/version.rb", "lib/libxml_ext/libxml_helper.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/fixtures/address.xml", "spec/fixtures/current_weather.xml", "spec/fixtures/pita.xml", "spec/fixtures/posts.xml", "spec/fixtures/statuses.xml", "spec/happymapper_attribute_spec.rb", "spec/happymapper_element_spec.rb", "spec/happymapper_item_spec.rb", "spec/happymapper_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake", "tasks/website.rake", "website/css/common.css", "website/index.html"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://happymapper.rubyforge.org}
|
16
16
|
s.post_install_message = %q{}
|
data/lib/happymapper.rb
CHANGED
data/lib/happymapper/version.rb
CHANGED
data/spec/happymapper_spec.rb
CHANGED
@@ -48,6 +48,15 @@ class CurrentWeather
|
|
48
48
|
element :current_condition, String, :tag => 'aws:current-condition', :attributes => {:icon => String}
|
49
49
|
end
|
50
50
|
|
51
|
+
class Address
|
52
|
+
include HappyMapper
|
53
|
+
|
54
|
+
element :street, String
|
55
|
+
element :postcode, String
|
56
|
+
element :housenumber, String
|
57
|
+
element :city, String
|
58
|
+
element :country, String
|
59
|
+
end
|
51
60
|
|
52
61
|
module PITA
|
53
62
|
class Item
|
@@ -202,6 +211,21 @@ describe HappyMapper do
|
|
202
211
|
first.user.followers_count.should == 486
|
203
212
|
end
|
204
213
|
end
|
214
|
+
|
215
|
+
describe "#parse (with xml containing the desired element as root node)" do
|
216
|
+
before do
|
217
|
+
file_contents = File.read(File.dirname(__FILE__) + '/fixtures/address.xml')
|
218
|
+
@address = Address.parse(file_contents, :single => true)
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should properly create objects" do
|
222
|
+
@address.street.should == 'Milchstrasse'
|
223
|
+
@address.postcode.should == '26131'
|
224
|
+
@address.housenumber.should == '23'
|
225
|
+
@address.city.should == 'Oldenburg'
|
226
|
+
@address.country.should == 'Germany'
|
227
|
+
end
|
228
|
+
end
|
205
229
|
|
206
230
|
# TODO: someone please get xml with namespaces working, kthxbai
|
207
231
|
describe "#parse (with xml that has namespace)" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jnunemaker-happymapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- script/generate
|
62
62
|
- script/txt2html
|
63
63
|
- setup.rb
|
64
|
+
- spec/fixtures/address.xml
|
64
65
|
- spec/fixtures/current_weather.xml
|
65
66
|
- spec/fixtures/pita.xml
|
66
67
|
- spec/fixtures/posts.xml
|