allhomes_xml 0.1.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.
@@ -0,0 +1,7 @@
1
+ module AllhomesXml
2
+
3
+ # Storage container for photos
4
+ class Photos < Array
5
+ end
6
+
7
+ end
@@ -0,0 +1,11 @@
1
+ module AllhomesXml
2
+
3
+ module Price
4
+
5
+ class Auction < BasicPrice
6
+ attr_accessor :date, :start, :estimate
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module AllhomesXml
2
+
3
+ module Price
4
+
5
+ class EOI < BasicPrice
6
+ attr_accessor :date
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module AllhomesXml
2
+
3
+ module Price
4
+
5
+ class Fixed < BasicPrice
6
+ attr_accessor :price
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module AllhomesXml
2
+
3
+ module Price
4
+
5
+ class Range < BasicPrice
6
+ attr_accessor :low, :high
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module AllhomesXml
2
+
3
+ module Price
4
+
5
+ class Tender < BasicPrice
6
+ attr_accessor :date
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,10 @@
1
+ module AllhomesXml
2
+
3
+ class RentalListing < BasicListing
4
+
5
+ # Attributes for a rental listing
6
+ attr_accessor :available_from, :available_to, :pets_allowed, :short_term_lease, :rented, :rented_date, :rented_price, :withdrawn, :under_application
7
+
8
+ end
9
+
10
+ end
@@ -0,0 +1,11 @@
1
+ module AllhomesXml
2
+
3
+ # Creates a sale listing that is then parsed by AllhomesXML::XML to generate the XML
4
+ class SaleListing < BasicListing
5
+
6
+ # Attributes for a sale listing
7
+ attr_accessor :exchange_date, :sale_price, :offers_over, :floor_area, :block_size, :core_area, :body_corporate, :plans_approved, :block, :section, :under_offer, :sold, :uv, :withdrawn
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,36 @@
1
+ module AllhomesXml
2
+
3
+ class Validator
4
+
5
+ # Validates the XML
6
+ def self.validate xml_string
7
+
8
+ # Include LibXML for parsing the XML
9
+ require 'xml'
10
+
11
+ # This tells LibXML to store any errors encoutered in the ERRORS variable
12
+ errors = []
13
+ LibXML::XML::Error.set_handler { |error| errors.push error.to_s }
14
+
15
+ document = LibXML::XML::Document.string xml_string
16
+ schema = LibXML::XML::Schema.new(File.dirname(__FILE__) + '/../allhomes.xsd')
17
+
18
+ begin
19
+
20
+ # Validate the XML
21
+ document.validate_schema schema
22
+ return []
23
+
24
+ # If rescue is triggered, then there were errors and we need to deliver the email
25
+ rescue LibXML::XML::Error => e
26
+
27
+ puts "--Errors Encountered:"
28
+ return errors
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'allhomes_xml'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestAllhomesXml < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: allhomes_xml
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Daniel Cox
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-11 00:00:00 +11:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ name: libxml-ruby
24
+ type: :runtime
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ prerelease: false
37
+ name: bundler
38
+ type: :development
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 23
45
+ segments:
46
+ - 1
47
+ - 0
48
+ - 0
49
+ version: 1.0.0
50
+ requirement: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ prerelease: false
53
+ name: jeweler
54
+ type: :development
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 7
61
+ segments:
62
+ - 1
63
+ - 5
64
+ - 2
65
+ version: 1.5.2
66
+ requirement: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ prerelease: false
69
+ name: libxml-ruby
70
+ type: :runtime
71
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ requirement: *id004
81
+ description: Allows easy generation of the allhomes.com.au XML feed by passing in property attributes. Also allows validation of XML
82
+ email: dtc@independent.com.au
83
+ executables: []
84
+
85
+ extensions: []
86
+
87
+ extra_rdoc_files:
88
+ - LICENSE.txt
89
+ - README.rdoc
90
+ files:
91
+ - .document
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.rdoc
95
+ - Rakefile
96
+ - VERSION
97
+ - allhomes_xml.gemspec
98
+ - lib/allhomes.xsd
99
+ - lib/allhomes_xml.rb
100
+ - lib/allhomes_xml/agents.rb
101
+ - lib/allhomes_xml/array.rb
102
+ - lib/allhomes_xml/attributes.rb
103
+ - lib/allhomes_xml/basic_listing.rb
104
+ - lib/allhomes_xml/basic_price.rb
105
+ - lib/allhomes_xml/exhibitions.rb
106
+ - lib/allhomes_xml/generator.rb
107
+ - lib/allhomes_xml/photos.rb
108
+ - lib/allhomes_xml/price/auction.rb
109
+ - lib/allhomes_xml/price/eoi.rb
110
+ - lib/allhomes_xml/price/fixed.rb
111
+ - lib/allhomes_xml/price/range.rb
112
+ - lib/allhomes_xml/price/tender.rb
113
+ - lib/allhomes_xml/rental_listing.rb
114
+ - lib/allhomes_xml/sale_listing.rb
115
+ - lib/allhomes_xml/validator.rb
116
+ - test/helper.rb
117
+ - test/test_allhomes_xml.rb
118
+ has_rdoc: true
119
+ homepage: http://github.com/Averenix/allhomes_xml
120
+ licenses:
121
+ - MIT
122
+ post_install_message:
123
+ rdoc_options: []
124
+
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
144
+ version: "0"
145
+ requirements: []
146
+
147
+ rubyforge_project:
148
+ rubygems_version: 1.4.2
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: A ruby based generator for the allhomes.com.au XML feed
152
+ test_files:
153
+ - test/helper.rb
154
+ - test/test_allhomes_xml.rb