atdis 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +0 -1
  4. data/Gemfile +1 -1
  5. data/README.md +25 -2
  6. data/Rakefile +1 -1
  7. data/docs/ATDIS-1.0.2 Application Tracking Data Interchange Specification (v1.0.2).doc +0 -0
  8. data/docs/ATDIS-1.0.2 Application Tracking Data Interchange Specification (v1.0.2).pdf +0 -0
  9. data/lib/atdis.rb +2 -7
  10. data/lib/atdis/feed.rb +80 -8
  11. data/lib/atdis/model.rb +74 -128
  12. data/lib/atdis/models/address.rb +17 -0
  13. data/lib/atdis/models/application.rb +31 -0
  14. data/lib/atdis/models/authority.rb +19 -0
  15. data/lib/atdis/models/document.rb +16 -0
  16. data/lib/atdis/models/event.rb +16 -0
  17. data/lib/atdis/models/info.rb +81 -0
  18. data/lib/atdis/models/land_title_ref.rb +26 -0
  19. data/lib/atdis/models/location.rb +23 -0
  20. data/lib/atdis/models/page.rb +56 -0
  21. data/lib/atdis/models/pagination.rb +68 -0
  22. data/lib/atdis/models/person.rb +14 -0
  23. data/lib/atdis/models/reference.rb +13 -0
  24. data/lib/atdis/models/response.rb +16 -0
  25. data/lib/atdis/models/torrens_title.rb +24 -0
  26. data/lib/atdis/validators.rb +26 -10
  27. data/lib/atdis/version.rb +1 -1
  28. data/spec/atdis/feed_spec.rb +78 -22
  29. data/spec/atdis/model_spec.rb +80 -131
  30. data/spec/atdis/models/address_spec.rb +22 -0
  31. data/spec/atdis/models/application_spec.rb +246 -0
  32. data/spec/atdis/models/authority_spec.rb +34 -0
  33. data/spec/atdis/models/document_spec.rb +19 -0
  34. data/spec/atdis/models/event_spec.rb +29 -0
  35. data/spec/atdis/models/info_spec.rb +303 -0
  36. data/spec/atdis/models/land_title_ref_spec.rb +39 -0
  37. data/spec/atdis/models/location_spec.rb +95 -0
  38. data/spec/atdis/models/page_spec.rb +296 -0
  39. data/spec/atdis/models/pagination_spec.rb +153 -0
  40. data/spec/atdis/models/person_spec.rb +19 -0
  41. data/spec/atdis/models/reference_spec.rb +55 -0
  42. data/spec/atdis/models/response_spec.rb +5 -0
  43. data/spec/atdis/models/torrens_title_spec.rb +52 -0
  44. data/spec/atdis/separated_url_spec.rb +4 -4
  45. metadata +141 -135
  46. data/docs/ATDIS-1.0.7 Application Tracking Data Interchange Specification (v1.0).doc +0 -0
  47. data/docs/ATDIS-1.0.7 Application Tracking Data Interchange Specification (v1.0).pdf +0 -0
  48. data/lib/atdis/application.rb +0 -78
  49. data/lib/atdis/document.rb +0 -14
  50. data/lib/atdis/event.rb +0 -17
  51. data/lib/atdis/location.rb +0 -21
  52. data/lib/atdis/page.rb +0 -130
  53. data/lib/atdis/person.rb +0 -12
  54. data/spec/atdis/application_spec.rb +0 -539
  55. data/spec/atdis/document_spec.rb +0 -19
  56. data/spec/atdis/event_spec.rb +0 -29
  57. data/spec/atdis/location_spec.rb +0 -148
  58. data/spec/atdis/page_spec.rb +0 -492
  59. data/spec/atdis/person_spec.rb +0 -19
@@ -0,0 +1,55 @@
1
+ require "spec_helper"
2
+
3
+ describe ATDIS::Models::Reference do
4
+ let(:a) { ATDIS::Models::Reference.new(
5
+ more_info_url: URI.parse("http://foo.com/bar"),
6
+ )}
7
+
8
+ describe ".more_info_url" do
9
+ it do
10
+ a.more_info_url = nil
11
+ a.should_not be_valid
12
+ a.errors.messages.should == {more_info_url: [ATDIS::ErrorMessage["can't be blank", "4.3.2"]]}
13
+ end
14
+ it do
15
+ a.more_info_url = "This is not a valid url"
16
+ a.should_not be_valid
17
+ a.errors.messages.should == {more_info_url: [ATDIS::ErrorMessage["is not a valid URL", "4.3.2"]]}
18
+ end
19
+ it do
20
+ a.more_info_url = "foo.com"
21
+ a.should_not be_valid
22
+ a.errors.messages.should == {more_info_url: [ATDIS::ErrorMessage["is not a valid URL", "4.3.2"]]}
23
+ end
24
+ it do
25
+ a.more_info_url = "httpss://foo.com"
26
+ a.should_not be_valid
27
+ a.errors.messages.should == {more_info_url: [ATDIS::ErrorMessage["is not a valid URL", "4.3.2"]]}
28
+ end
29
+ end
30
+
31
+ describe "#more_info_url=" do
32
+ let(:a) { ATDIS::Models::Reference.new }
33
+ it "should do no type casting when it's already a URI" do
34
+ a.more_info_url = URI.parse("http://foo.com/bar")
35
+ a.more_info_url.should == URI.parse("http://foo.com/bar")
36
+ end
37
+
38
+ it "should cast a string to a URI when it's a valid url" do
39
+ a.more_info_url = "http://foo.com/bar"
40
+ a.more_info_url.should == URI.parse("http://foo.com/bar")
41
+ end
42
+
43
+ context "not a valid url" do
44
+ before :each do
45
+ a.more_info_url = "This is not a url"
46
+ end
47
+ it "should be nil" do
48
+ a.more_info_url.should be_nil
49
+ end
50
+ it "should keep the original string" do
51
+ a.more_info_url_before_type_cast.should == "This is not a url"
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ require "spec_helper"
2
+
3
+ describe ATDIS::Models::Response do
4
+
5
+ end
@@ -0,0 +1,52 @@
1
+ require "spec_helper"
2
+
3
+ describe ATDIS::Models::TorrensTitle do
4
+ let(:l) { ATDIS::Models::TorrensTitle.new(
5
+ lot: "10",
6
+ section: "ABC",
7
+ dpsp_id: "DP2013-0381"
8
+ )}
9
+
10
+ describe "dpsp_id" do
11
+ it "can not be blank" do
12
+ l.dpsp_id = ""
13
+ l.should_not be_valid
14
+ l.errors.messages.should == {dpsp_id: [ATDIS::ErrorMessage["can't be blank", "4.3.3"]]}
15
+ end
16
+
17
+ it "can be none but is not interpreted in any special way" do
18
+ l.dpsp_id = "none"
19
+ l.dpsp_id.should == "none"
20
+ l.should be_valid
21
+ end
22
+ end
23
+
24
+ describe "section" do
25
+ it "can not be blank" do
26
+ l.section = ""
27
+ l.should_not be_valid
28
+ l.errors.messages.should == {section: [ATDIS::ErrorMessage["can't be blank", "4.3.3"]]}
29
+ end
30
+
31
+ it "can be null" do
32
+ l.section = nil
33
+ l.section.should be_nil
34
+ l.should be_valid
35
+ end
36
+ end
37
+
38
+ describe "lot" do
39
+ it "can not be blank" do
40
+ l.lot = ""
41
+ l.should_not be_valid
42
+ l.errors.messages.should == {lot: [ATDIS::ErrorMessage["can't be blank", "4.3.3"]]}
43
+ end
44
+
45
+ it "can be none but is not interpreted in any special way" do
46
+ l.lot = "none"
47
+ l.lot.should == "none"
48
+ l.should be_valid
49
+ end
50
+ end
51
+
52
+ end
@@ -3,22 +3,22 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
3
  describe ATDIS::SeparatedURL do
4
4
  describe "#merge" do
5
5
  it "should add a new parameter" do
6
- ATDIS::SeparatedURL.merge("http://foo.com/bar?foo=twenty&bar=12", :page => 2).should ==
6
+ ATDIS::SeparatedURL.merge("http://foo.com/bar?foo=twenty&bar=12", page: 2).should ==
7
7
  "http://foo.com/bar?bar=12&foo=twenty&page=2"
8
8
  end
9
9
 
10
10
  it "should overwrite an existing one" do
11
- ATDIS::SeparatedURL.merge("http://foo.com/bar?foo=twenty&bar=12", :bar => 24).should ==
11
+ ATDIS::SeparatedURL.merge("http://foo.com/bar?foo=twenty&bar=12", bar: 24).should ==
12
12
  "http://foo.com/bar?bar=24&foo=twenty"
13
13
  end
14
14
 
15
15
  it "should encode spaces for example" do
16
- ATDIS::SeparatedURL.merge("http://foo.com/bar?foo=twenty&bar=12", :bar => "hello sir").should ==
16
+ ATDIS::SeparatedURL.merge("http://foo.com/bar?foo=twenty&bar=12", bar: "hello sir").should ==
17
17
  "http://foo.com/bar?bar=hello+sir&foo=twenty"
18
18
  end
19
19
 
20
20
  it "should be fine if there are no parameters" do
21
- ATDIS::SeparatedURL.merge("http://foo.com/bar", :page => 2).should ==
21
+ ATDIS::SeparatedURL.merge("http://foo.com/bar", page: 2).should ==
22
22
  "http://foo.com/bar?page=2"
23
23
  end
24
24
 
metadata CHANGED
@@ -1,117 +1,107 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: atdis
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- version: "0.2"
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.3'
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Matthew Landauer
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2013-09-20 00:00:00 Z
18
- dependencies:
19
- - !ruby/object:Gem::Dependency
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
20
14
  name: bundler
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
24
17
  - - ~>
25
- - !ruby/object:Gem::Version
26
- hash: 9
27
- segments:
28
- - 1
29
- - 3
30
- version: "1.3"
31
- prerelease: false
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
32
20
  type: :development
33
- requirement: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rake
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
45
21
  prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
46
34
  type: :development
47
- requirement: *id002
48
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
49
42
  name: multi_json
50
- version_requirements: &id003 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
53
45
  - - ~>
54
- - !ruby/object:Gem::Version
55
- hash: 1
56
- segments:
57
- - 1
58
- - 7
59
- version: "1.7"
60
- prerelease: false
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
61
48
  type: :runtime
62
- requirement: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rest-client
65
- version_requirements: &id004 !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 3
71
- segments:
72
- - 0
73
- version: "0"
74
49
  prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rest-client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
75
62
  type: :runtime
76
- requirement: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: rgeo-geojson
79
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
63
  prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rgeo-geojson
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
89
76
  type: :runtime
90
- requirement: *id005
91
- - !ruby/object:Gem::Dependency
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
92
84
  name: activemodel
93
- version_requirements: &id006 !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
96
87
  - - ~>
97
- - !ruby/object:Gem::Version
98
- hash: 5
99
- segments:
100
- - 3
101
- version: "3"
102
- prerelease: false
88
+ - !ruby/object:Gem::Version
89
+ version: '3'
103
90
  type: :runtime
104
- requirement: *id006
105
- description: A ruby interface to the application tracking data interchange specification (ATDIS) API
106
- email:
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '3'
97
+ description: A ruby interface to the application tracking data interchange specification
98
+ (ATDIS) API
99
+ email:
107
100
  - matthew@openaustraliafoundation.org.au
108
101
  executables: []
109
-
110
102
  extensions: []
111
-
112
103
  extra_rdoc_files: []
113
-
114
- files:
104
+ files:
115
105
  - .gitignore
116
106
  - .ruby-version
117
107
  - .travis.yml
@@ -121,71 +111,87 @@ files:
121
111
  - README.md
122
112
  - Rakefile
123
113
  - atdis.gemspec
124
- - docs/ATDIS-1.0.7 Application Tracking Data Interchange Specification (v1.0).doc
125
- - docs/ATDIS-1.0.7 Application Tracking Data Interchange Specification (v1.0).pdf
114
+ - docs/ATDIS-1.0.2 Application Tracking Data Interchange Specification (v1.0.2).doc
115
+ - docs/ATDIS-1.0.2 Application Tracking Data Interchange Specification (v1.0.2).pdf
126
116
  - lib/atdis.rb
127
- - lib/atdis/application.rb
128
- - lib/atdis/document.rb
129
- - lib/atdis/event.rb
130
117
  - lib/atdis/feed.rb
131
- - lib/atdis/location.rb
132
118
  - lib/atdis/model.rb
133
- - lib/atdis/page.rb
134
- - lib/atdis/person.rb
119
+ - lib/atdis/models/address.rb
120
+ - lib/atdis/models/application.rb
121
+ - lib/atdis/models/authority.rb
122
+ - lib/atdis/models/document.rb
123
+ - lib/atdis/models/event.rb
124
+ - lib/atdis/models/info.rb
125
+ - lib/atdis/models/land_title_ref.rb
126
+ - lib/atdis/models/location.rb
127
+ - lib/atdis/models/page.rb
128
+ - lib/atdis/models/pagination.rb
129
+ - lib/atdis/models/person.rb
130
+ - lib/atdis/models/reference.rb
131
+ - lib/atdis/models/response.rb
132
+ - lib/atdis/models/torrens_title.rb
135
133
  - lib/atdis/separated_url.rb
136
134
  - lib/atdis/validators.rb
137
135
  - lib/atdis/version.rb
138
- - spec/atdis/application_spec.rb
139
- - spec/atdis/document_spec.rb
140
- - spec/atdis/event_spec.rb
141
136
  - spec/atdis/feed_spec.rb
142
- - spec/atdis/location_spec.rb
143
137
  - spec/atdis/model_spec.rb
144
- - spec/atdis/page_spec.rb
145
- - spec/atdis/person_spec.rb
138
+ - spec/atdis/models/address_spec.rb
139
+ - spec/atdis/models/application_spec.rb
140
+ - spec/atdis/models/authority_spec.rb
141
+ - spec/atdis/models/document_spec.rb
142
+ - spec/atdis/models/event_spec.rb
143
+ - spec/atdis/models/info_spec.rb
144
+ - spec/atdis/models/land_title_ref_spec.rb
145
+ - spec/atdis/models/location_spec.rb
146
+ - spec/atdis/models/page_spec.rb
147
+ - spec/atdis/models/pagination_spec.rb
148
+ - spec/atdis/models/person_spec.rb
149
+ - spec/atdis/models/reference_spec.rb
150
+ - spec/atdis/models/response_spec.rb
151
+ - spec/atdis/models/torrens_title_spec.rb
146
152
  - spec/atdis/separated_url_spec.rb
147
153
  - spec/spec_helper.rb
148
154
  homepage: http://github.com/openaustralia/atdis
149
- licenses:
155
+ licenses:
150
156
  - MIT
157
+ metadata: {}
151
158
  post_install_message:
152
159
  rdoc_options: []
153
-
154
- require_paths:
160
+ require_paths:
155
161
  - lib
156
- required_ruby_version: !ruby/object:Gem::Requirement
157
- none: false
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- hash: 3
162
- segments:
163
- - 0
164
- version: "0"
165
- required_rubygems_version: !ruby/object:Gem::Requirement
166
- none: false
167
- requirements:
168
- - - ">="
169
- - !ruby/object:Gem::Version
170
- hash: 3
171
- segments:
172
- - 0
173
- version: "0"
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
174
172
  requirements: []
175
-
176
173
  rubyforge_project:
177
- rubygems_version: 1.8.25
174
+ rubygems_version: 2.2.0
178
175
  signing_key:
179
- specification_version: 3
180
- summary: A ruby interface to the application tracking data interchange specification (ATDIS) API
181
- test_files:
182
- - spec/atdis/application_spec.rb
183
- - spec/atdis/document_spec.rb
184
- - spec/atdis/event_spec.rb
176
+ specification_version: 4
177
+ summary: A ruby interface to the application tracking data interchange specification
178
+ (ATDIS) API
179
+ test_files:
185
180
  - spec/atdis/feed_spec.rb
186
- - spec/atdis/location_spec.rb
187
181
  - spec/atdis/model_spec.rb
188
- - spec/atdis/page_spec.rb
189
- - spec/atdis/person_spec.rb
182
+ - spec/atdis/models/address_spec.rb
183
+ - spec/atdis/models/application_spec.rb
184
+ - spec/atdis/models/authority_spec.rb
185
+ - spec/atdis/models/document_spec.rb
186
+ - spec/atdis/models/event_spec.rb
187
+ - spec/atdis/models/info_spec.rb
188
+ - spec/atdis/models/land_title_ref_spec.rb
189
+ - spec/atdis/models/location_spec.rb
190
+ - spec/atdis/models/page_spec.rb
191
+ - spec/atdis/models/pagination_spec.rb
192
+ - spec/atdis/models/person_spec.rb
193
+ - spec/atdis/models/reference_spec.rb
194
+ - spec/atdis/models/response_spec.rb
195
+ - spec/atdis/models/torrens_title_spec.rb
190
196
  - spec/atdis/separated_url_spec.rb
191
197
  - spec/spec_helper.rb