mits 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -0
  3. data/{LICENSE.txt → LICENSE} +0 -0
  4. data/README.md +34 -16
  5. data/lib/mits/document.rb +35 -0
  6. data/lib/mits/entities/address.rb +16 -0
  7. data/lib/mits/entities/amenity.rb +8 -0
  8. data/lib/mits/entities/company.rb +11 -0
  9. data/lib/mits/entities/deposit.rb +11 -0
  10. data/lib/mits/entities/fees.rb +15 -0
  11. data/lib/mits/entities/file.rb +16 -0
  12. data/lib/mits/entities/pet.rb +11 -0
  13. data/lib/mits/entities/pet_policy.rb +15 -0
  14. data/lib/mits/entities/property.rb +20 -0
  15. data/lib/mits/entities/unit.rb +11 -0
  16. data/lib/mits/mapper.rb +48 -0
  17. data/lib/mits/mappers/address_mapper.rb +29 -0
  18. data/lib/mits/mappers/amenities_mapper.rb +14 -0
  19. data/lib/mits/mappers/company_mapper.rb +11 -0
  20. data/lib/mits/mappers/deposit_mapper.rb +24 -0
  21. data/lib/mits/mappers/fees_mapper.rb +15 -0
  22. data/lib/mits/mappers/files_mapper.rb +19 -0
  23. data/lib/mits/mappers/pet_policy_mapper.rb +28 -0
  24. data/lib/mits/mappers/property_mapper.rb +41 -0
  25. data/lib/mits/mappers/units_mapper.rb +22 -0
  26. data/lib/mits/saxerator_ext.rb +29 -0
  27. data/lib/mits/version.rb +2 -2
  28. data/lib/mits.rb +9 -3
  29. data/mits.gemspec +13 -6
  30. data/spec/fixtures/mits.xml +396 -0
  31. data/spec/fixtures/property.yml +205 -0
  32. data/spec/lib/mits/document_spec.rb +23 -0
  33. data/spec/lib/mits/entities/address_spec.rb +16 -0
  34. data/spec/lib/mits/entities/amenity_spec.rb +8 -0
  35. data/spec/lib/mits/entities/company_spec.rb +0 -0
  36. data/spec/lib/mits/entities/deposit_spec.rb +11 -0
  37. data/spec/lib/mits/entities/fees_spec.rb +15 -0
  38. data/spec/lib/mits/entities/file_spec.rb +17 -0
  39. data/spec/lib/mits/entities/pet_policy_spec.rb +14 -0
  40. data/spec/lib/mits/entities/pet_spec.rb +12 -0
  41. data/spec/lib/mits/entities/property_spec.rb +20 -0
  42. data/spec/lib/mits/entities/unit_spec.rb +11 -0
  43. data/spec/lib/mits/mapper_spec.rb +180 -0
  44. data/spec/spec_helper.rb +22 -0
  45. metadata +147 -8
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ module MITS
4
+ describe File do
5
+ it { is_expected.to respond_to(:active) }
6
+ it { is_expected.to respond_to(:caption) }
7
+ it { is_expected.to respond_to(:description) }
8
+ it { is_expected.to respond_to(:format) }
9
+ it { is_expected.to respond_to(:height) }
10
+ it { is_expected.to respond_to(:id) }
11
+ it { is_expected.to respond_to(:name) }
12
+ it { is_expected.to respond_to(:rank) }
13
+ it { is_expected.to respond_to(:source) }
14
+ it { is_expected.to respond_to(:width) }
15
+ end
16
+ end
17
+
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ module MITS
4
+ describe PetPolicy do
5
+ it { is_expected.to respond_to(:allowed) }
6
+ it { is_expected.to respond_to(:allowed?) }
7
+ it { is_expected.to respond_to(:care) }
8
+ it { is_expected.to respond_to(:deposit) }
9
+ it { is_expected.to respond_to(:fee) }
10
+ it { is_expected.to respond_to(:pets) }
11
+ it { is_expected.to respond_to(:rent) }
12
+ it { is_expected.to respond_to(:restrictions) }
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ module MITS
4
+ describe Pet do
5
+ it { is_expected.to respond_to(:count) }
6
+ it { is_expected.to respond_to(:description) }
7
+ it { is_expected.to respond_to(:size) }
8
+ it { is_expected.to respond_to(:type) }
9
+ it { is_expected.to respond_to(:weight) }
10
+ end
11
+ end
12
+
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ module MITS
4
+ describe Property do
5
+ it { is_expected.to respond_to(:address) }
6
+ it { is_expected.to respond_to(:amenities) }
7
+ it { is_expected.to respond_to(:company_id) }
8
+ it { is_expected.to respond_to(:deposit) }
9
+ it { is_expected.to respond_to(:description) }
10
+ it { is_expected.to respond_to(:fees) }
11
+ it { is_expected.to respond_to(:files) }
12
+ it { is_expected.to respond_to(:id) }
13
+ it { is_expected.to respond_to(:name) }
14
+ it { is_expected.to respond_to(:pet_policy) }
15
+ it { is_expected.to respond_to(:summary) }
16
+ it { is_expected.to respond_to(:type) }
17
+ it { is_expected.to respond_to(:units) }
18
+ it { is_expected.to respond_to(:website) }
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ module MITS
4
+ describe Unit do
5
+ it { is_expected.to respond_to(:bathrooms) }
6
+ it { is_expected.to respond_to(:bedrooms) }
7
+ it { is_expected.to respond_to(:name) }
8
+ it { is_expected.to respond_to(:rent) }
9
+ it { is_expected.to respond_to(:sqft) }
10
+ end
11
+ end
@@ -0,0 +1,180 @@
1
+ require 'spec_helper'
2
+
3
+ module MITS
4
+ describe Mapper do
5
+ let(:fixture) { YAML.load_file('./spec/fixtures/property.yml') }
6
+
7
+ describe '.address' do
8
+ subject { Mapper.address(fixture[:PropertyID][:Address], fixture[:ILS_Identification]) }
9
+
10
+ it { is_expected.to be_a Address }
11
+
12
+ it 'include various amenities' do
13
+ expect(subject.address1).to eq '123 Main St'
14
+ expect(subject.latitude).to eq 44.0
15
+ expect(subject.longitude).to eq 45.55
16
+ end
17
+ end
18
+
19
+ describe '.amenities' do
20
+ subject { Mapper.amenities(fixture[:ILS_Unit][:Amenity]) }
21
+
22
+ it { is_expected.to be_a Array }
23
+
24
+ it 'include various amenities' do
25
+ first = subject.first
26
+ expect(first).to be_a Amenity
27
+ expect(first.description).to eq 'Refrigerator'
28
+ expect(first.type).to eq 'Refrigerator'
29
+ end
30
+ end
31
+
32
+ describe '.company' do
33
+ let(:tag) do
34
+ {
35
+ Identification: {
36
+ IDValue: 'id value',
37
+ IDType: 'id type'
38
+ },
39
+ CompanyName: 'name',
40
+ Address: fixture[:PropertyID][:Address],
41
+ Website: 'http://...',
42
+ Logo: 'http://...',
43
+ }
44
+ end
45
+
46
+ subject { Mapper.company(tag) }
47
+
48
+ it { is_expected.to be_a Company }
49
+ end
50
+
51
+ describe '.deposit' do
52
+ subject { Mapper.deposit(fixture[:Deposit]) }
53
+
54
+ it { is_expected.to be_a Deposit }
55
+
56
+ it 'include deposit details' do
57
+ expect(subject.amount).to eq 3000.00
58
+ expect(subject.description).to be_nil
59
+ expect(subject.type).to eq 'Security Deposit'
60
+ end
61
+
62
+ context 'when a range' do
63
+ let(:ranged_deposit) do
64
+ { Amount: { ValueRange: { Min: 100, Max: 1000 } } }
65
+ end
66
+
67
+ subject { Mapper.deposit(ranged_deposit) }
68
+
69
+ it 'include deposit details' do
70
+ expect(subject.amount).to eq 100..1000
71
+ end
72
+ end
73
+ end
74
+
75
+ describe '.fees' do
76
+ subject { Mapper.fees(fixture[:Fee]) }
77
+
78
+ it { is_expected.to be_a Fees }
79
+
80
+ it 'include individual fee amounts' do
81
+ expect(subject.admin_fee).to eq 0.0
82
+ expect(subject.application_fee).to eq 50.0
83
+ expect(subject.broker_fee).to eq 0.0
84
+ expect(subject.late_fee_per_day).to eq 0.0
85
+ expect(subject.late_min_fee).to eq 0.0
86
+ expect(subject.late_percent).to eq 0.0
87
+ expect(subject.late_type).to eq 'Standard'
88
+ expect(subject.non_refundable_hold_fee).to eq 0.0
89
+ expect(subject.prorate_type).to eq 'Standard'
90
+ end
91
+ end
92
+
93
+ describe '.files' do
94
+ subject { Mapper.files(fixture[:File]) }
95
+
96
+ it { is_expected.to be_a Array }
97
+
98
+ it 'includes each file' do
99
+ first = subject.first
100
+ expect(first).to be_a File
101
+ expect(first.source).to eq 'http://douglaslebsack.name/triston_botsford'
102
+ end
103
+ end
104
+
105
+ describe '.pets' do
106
+ subject { Mapper.pets(fixture[:Policy][:Pet][:Pets]) }
107
+
108
+ it { is_expected.to be_a Array }
109
+
110
+ it 'includes each allowed pet' do
111
+ first = subject.first
112
+ expect(first).to be_a Pet
113
+ expect(first.count).to eq 1
114
+ expect(first.size).to eq 'Large'
115
+ expect(first.type).to eq 'Dog'
116
+ expect(first.weight).to eq '60lbs'
117
+ end
118
+ end
119
+
120
+ describe '.pet_policy' do
121
+ subject { Mapper.pet_policy(fixture[:Policy][:Pet]) }
122
+
123
+ it { is_expected.to be_a PetPolicy }
124
+
125
+ it 'includes details' do
126
+ expect(subject.allowed).to be_truthy
127
+ expect(subject.care).to be_truthy
128
+ expect(subject.fee).to eq 25.00
129
+ expect(subject.pets).to be_a Array
130
+ expect(subject.rent).to eq 100.00
131
+ end
132
+
133
+ context 'when no pets allowed' do
134
+ before { fixture[:Policy][:Pet][:Allowed] = 'false' }
135
+
136
+ it 'will reflect that' do
137
+ expect(subject.allowed).to be_falsey
138
+ end
139
+ end
140
+ end
141
+
142
+ describe '.property' do
143
+ subject { Mapper.property(fixture) }
144
+
145
+ it { is_expected.to be_a Property }
146
+
147
+ it 'includes details' do
148
+ expect(subject.address).to be_a Address
149
+ expect(subject.amenities.size).to eq 14
150
+ expect(subject.company_id).to eq 'guid: 1'
151
+ expect(subject.deposit).to be_a Deposit
152
+ expect(subject.description).to eq 'hello. this is a description'
153
+ expect(subject.fees).to be_a Fees
154
+ expect(subject.files).to be_a Array
155
+ expect(subject.id).to eq 'SomethingRandom1'
156
+ expect(subject.name).to eq 'Cool New Apartment!!!!'
157
+ expect(subject.pet_policy).to be_a PetPolicy
158
+ expect(subject.summary).to eq 'Cool New Apartment!!!!'
159
+ expect(subject.units).to be_a Array
160
+ expect(subject.website).to eq 'http://harris.net/juwan'
161
+ end
162
+ end
163
+
164
+ describe '.units' do
165
+ subject { Mapper.units(fixture[:ILS_Unit][:Units][:Unit]) }
166
+
167
+ it { is_expected.to be_a Array }
168
+
169
+ it 'includes individual units' do
170
+ first = subject.first
171
+ expect(first).to be_a Unit
172
+ expect(first.bathrooms).to eq 4.0
173
+ expect(first.bedrooms).to eq 4.0
174
+ expect(first.name).to eq 'Cool New Apartment!!!!'
175
+ expect(first.rent).to eq 3400.0
176
+ expect(first.sqft).to eq 3400..3400
177
+ end
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,22 @@
1
+ ENV['RACK_ENV'] = 'test'
2
+
3
+ require 'coveralls'
4
+ require 'simplecov'
5
+ require 'pry'
6
+
7
+ SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
8
+
9
+ SimpleCov.start do
10
+ add_filter 'spec'
11
+ add_filter 'lib/mits/saxerator_ext'
12
+ coverage_dir 'docs/coverage'
13
+ end
14
+
15
+ require 'mits'
16
+
17
+ Dir['spec/support/**/*.rb'].each { |f| require f }
18
+
19
+ RSpec.configure do |config|
20
+ config.pattern = '**/*_spec.rb'
21
+ config.mock_framework = :rspec
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Callan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-11 00:00:00.000000000 Z
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_objects
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: saxerator
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.5
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,48 @@ dependencies:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.0'
41
97
  - !ruby/object:Gem::Dependency
42
98
  name: rake
43
99
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +108,36 @@ dependencies:
52
108
  - - "~>"
53
109
  - !ruby/object:Gem::Version
54
110
  version: '10.0'
55
- description: ''
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.9'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.9'
139
+ description: A SAX powered Multifamily Information and Transactions Standard (MITS)
140
+ reader for Ruby.
56
141
  email:
57
142
  - seancallan@gmail.com
58
143
  executables: []
@@ -60,13 +145,51 @@ extensions: []
60
145
  extra_rdoc_files: []
61
146
  files:
62
147
  - ".gitignore"
148
+ - ".travis.yml"
63
149
  - Gemfile
64
- - LICENSE.txt
150
+ - LICENSE
65
151
  - README.md
66
152
  - Rakefile
67
153
  - lib/mits.rb
154
+ - lib/mits/document.rb
155
+ - lib/mits/entities/address.rb
156
+ - lib/mits/entities/amenity.rb
157
+ - lib/mits/entities/company.rb
158
+ - lib/mits/entities/deposit.rb
159
+ - lib/mits/entities/fees.rb
160
+ - lib/mits/entities/file.rb
161
+ - lib/mits/entities/pet.rb
162
+ - lib/mits/entities/pet_policy.rb
163
+ - lib/mits/entities/property.rb
164
+ - lib/mits/entities/unit.rb
165
+ - lib/mits/mapper.rb
166
+ - lib/mits/mappers/address_mapper.rb
167
+ - lib/mits/mappers/amenities_mapper.rb
168
+ - lib/mits/mappers/company_mapper.rb
169
+ - lib/mits/mappers/deposit_mapper.rb
170
+ - lib/mits/mappers/fees_mapper.rb
171
+ - lib/mits/mappers/files_mapper.rb
172
+ - lib/mits/mappers/pet_policy_mapper.rb
173
+ - lib/mits/mappers/property_mapper.rb
174
+ - lib/mits/mappers/units_mapper.rb
175
+ - lib/mits/saxerator_ext.rb
68
176
  - lib/mits/version.rb
69
177
  - mits.gemspec
178
+ - spec/fixtures/mits.xml
179
+ - spec/fixtures/property.yml
180
+ - spec/lib/mits/document_spec.rb
181
+ - spec/lib/mits/entities/address_spec.rb
182
+ - spec/lib/mits/entities/amenity_spec.rb
183
+ - spec/lib/mits/entities/company_spec.rb
184
+ - spec/lib/mits/entities/deposit_spec.rb
185
+ - spec/lib/mits/entities/fees_spec.rb
186
+ - spec/lib/mits/entities/file_spec.rb
187
+ - spec/lib/mits/entities/pet_policy_spec.rb
188
+ - spec/lib/mits/entities/pet_spec.rb
189
+ - spec/lib/mits/entities/property_spec.rb
190
+ - spec/lib/mits/entities/unit_spec.rb
191
+ - spec/lib/mits/mapper_spec.rb
192
+ - spec/spec_helper.rb
70
193
  homepage: https://github.com/doomspork/mits
71
194
  licenses:
72
195
  - MIT
@@ -90,5 +213,21 @@ rubyforge_project:
90
213
  rubygems_version: 2.4.5
91
214
  signing_key:
92
215
  specification_version: 4
93
- summary: A SAX powered MITS reader.
94
- test_files: []
216
+ summary: A SAX powered MITS reader for Ruby.
217
+ test_files:
218
+ - spec/fixtures/mits.xml
219
+ - spec/fixtures/property.yml
220
+ - spec/lib/mits/document_spec.rb
221
+ - spec/lib/mits/entities/address_spec.rb
222
+ - spec/lib/mits/entities/amenity_spec.rb
223
+ - spec/lib/mits/entities/company_spec.rb
224
+ - spec/lib/mits/entities/deposit_spec.rb
225
+ - spec/lib/mits/entities/fees_spec.rb
226
+ - spec/lib/mits/entities/file_spec.rb
227
+ - spec/lib/mits/entities/pet_policy_spec.rb
228
+ - spec/lib/mits/entities/pet_spec.rb
229
+ - spec/lib/mits/entities/property_spec.rb
230
+ - spec/lib/mits/entities/unit_spec.rb
231
+ - spec/lib/mits/mapper_spec.rb
232
+ - spec/spec_helper.rb
233
+ has_rdoc: