mits 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/README.md +4 -4
- data/lib/mits.rb +4 -1
- data/lib/mits/base_mapper.rb +20 -0
- data/lib/mits/document.rb +16 -5
- data/lib/mits/saxerator_ext.rb +8 -1
- data/lib/mits/v3.0/address.rb +20 -0
- data/lib/mits/v3.0/amenity.rb +12 -0
- data/lib/mits/v3.0/company.rb +13 -0
- data/lib/mits/v3.0/deposit.rb +13 -0
- data/lib/mits/v3.0/fees.rb +17 -0
- data/lib/mits/v3.0/file.rb +18 -0
- data/lib/mits/v3.0/floorplan.rb +13 -0
- data/lib/mits/v3.0/mapper.rb +50 -0
- data/lib/mits/v3.0/mapper/address_mapper.rb +35 -0
- data/lib/mits/v3.0/mapper/amenities_mapper.rb +19 -0
- data/lib/mits/v3.0/mapper/company_mapper.rb +15 -0
- data/lib/mits/v3.0/mapper/deposit_mapper.rb +32 -0
- data/lib/mits/v3.0/mapper/fees_mapper.rb +19 -0
- data/lib/mits/v3.0/mapper/files_mapper.rb +25 -0
- data/lib/mits/v3.0/mapper/floorplan_mapper.rb +27 -0
- data/lib/mits/v3.0/mapper/pet_policy_mapper.rb +37 -0
- data/lib/mits/v3.0/mapper/policy_mapper.rb +12 -0
- data/lib/mits/v3.0/mapper/property_mapper.rb +57 -0
- data/lib/mits/v3.0/pet.rb +13 -0
- data/lib/mits/v3.0/pet_policy.rb +17 -0
- data/lib/mits/v3.0/policy.rb +10 -0
- data/lib/mits/v3.0/property.rb +23 -0
- data/lib/mits/v4.1/address.rb +21 -0
- data/lib/mits/v4.1/amenity.rb +21 -0
- data/lib/mits/v4.1/company.rb +8 -0
- data/lib/mits/v4.1/deposit.rb +8 -0
- data/lib/mits/v4.1/fees.rb +8 -0
- data/lib/mits/v4.1/file.rb +8 -0
- data/lib/mits/v4.1/mapper.rb +45 -0
- data/lib/mits/v4.1/mapper/address_mapper.rb +29 -0
- data/lib/mits/v4.1/mapper/company_mapper.rb +9 -0
- data/lib/mits/v4.1/mapper/property_mapper.rb +48 -0
- data/lib/mits/v4.1/mapper/units_mapper.rb +26 -0
- data/lib/mits/v4.1/pet.rb +8 -0
- data/lib/mits/v4.1/pet_policy.rb +8 -0
- data/lib/mits/v4.1/policy.rb +8 -0
- data/lib/mits/v4.1/property.rb +22 -0
- data/lib/mits/v4.1/unit.rb +13 -0
- data/lib/mits/version.rb +1 -1
- data/mits.gemspec +5 -4
- data/spec/fixtures/MITS_3.0_Property.yml +583 -0
- data/spec/fixtures/MITS_3.0_Sample.xml +589 -0
- data/spec/fixtures/{property.yml → MITS_4.1_Property.yml} +0 -0
- data/spec/fixtures/{mits.xml → MITS_4.1_Sample.xml} +0 -0
- data/spec/lib/mits/document_spec.rb +3 -3
- data/spec/lib/mits/v3.0/address_spec.rb +21 -0
- data/spec/lib/mits/v3.0/amenity_spec.rb +13 -0
- data/spec/lib/mits/{entities → v3.0}/company_spec.rb +0 -0
- data/spec/lib/mits/v3.0/deposit_spec.rb +14 -0
- data/spec/lib/mits/v3.0/fees_spec.rb +18 -0
- data/spec/lib/mits/v3.0/file_spec.rb +20 -0
- data/spec/lib/mits/v3.0/floorplan_spec.rb +14 -0
- data/spec/lib/mits/v3.0/mapper_spec.rb +198 -0
- data/spec/lib/mits/v3.0/pet_policy_spec.rb +17 -0
- data/spec/lib/mits/v3.0/pet_spec.rb +15 -0
- data/spec/lib/mits/v3.0/property_spec.rb +23 -0
- data/spec/lib/mits/v4.1/address_spec.rb +22 -0
- data/spec/lib/mits/v4.1/amenity_spec.rb +11 -0
- data/spec/lib/mits/v4.1/company_spec.rb +0 -0
- data/spec/lib/mits/v4.1/deposit_spec.rb +14 -0
- data/spec/lib/mits/v4.1/fees_spec.rb +18 -0
- data/spec/lib/mits/v4.1/file_spec.rb +20 -0
- data/spec/lib/mits/v4.1/mapper_spec.rb +194 -0
- data/spec/lib/mits/v4.1/pet_policy_spec.rb +16 -0
- data/spec/lib/mits/v4.1/pet_spec.rb +15 -0
- data/spec/lib/mits/v4.1/property_spec.rb +23 -0
- data/spec/lib/mits/v4.1/unit_spec.rb +14 -0
- metadata +112 -53
- data/lib/mits/entities/address.rb +0 -16
- data/lib/mits/entities/amenity.rb +0 -8
- data/lib/mits/entities/company.rb +0 -11
- data/lib/mits/entities/deposit.rb +0 -11
- data/lib/mits/entities/fees.rb +0 -15
- data/lib/mits/entities/file.rb +0 -16
- data/lib/mits/entities/pet.rb +0 -11
- data/lib/mits/entities/pet_policy.rb +0 -15
- data/lib/mits/entities/property.rb +0 -20
- data/lib/mits/entities/unit.rb +0 -11
- data/lib/mits/mapper.rb +0 -48
- data/lib/mits/mappers/address_mapper.rb +0 -29
- data/lib/mits/mappers/amenities_mapper.rb +0 -14
- data/lib/mits/mappers/company_mapper.rb +0 -11
- data/lib/mits/mappers/deposit_mapper.rb +0 -24
- data/lib/mits/mappers/fees_mapper.rb +0 -15
- data/lib/mits/mappers/files_mapper.rb +0 -19
- data/lib/mits/mappers/pet_policy_mapper.rb +0 -28
- data/lib/mits/mappers/property_mapper.rb +0 -41
- data/lib/mits/mappers/units_mapper.rb +0 -22
- data/spec/lib/mits/entities/address_spec.rb +0 -16
- data/spec/lib/mits/entities/amenity_spec.rb +0 -8
- data/spec/lib/mits/entities/deposit_spec.rb +0 -11
- data/spec/lib/mits/entities/fees_spec.rb +0 -15
- data/spec/lib/mits/entities/file_spec.rb +0 -17
- data/spec/lib/mits/entities/pet_policy_spec.rb +0 -14
- data/spec/lib/mits/entities/pet_spec.rb +0 -12
- data/spec/lib/mits/entities/property_spec.rb +0 -20
- data/spec/lib/mits/entities/unit_spec.rb +0 -11
- data/spec/lib/mits/mapper_spec.rb +0 -180
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module MITS
|
4
|
-
describe Deposit do
|
5
|
-
it { is_expected.to respond_to(:type) }
|
6
|
-
it { is_expected.to respond_to(:description) }
|
7
|
-
it { is_expected.to respond_to(:percent_refundable) }
|
8
|
-
it { is_expected.to respond_to(:portion_refundable) }
|
9
|
-
it { is_expected.to respond_to(:amount) }
|
10
|
-
end
|
11
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module MITS
|
4
|
-
describe Fees do
|
5
|
-
it { is_expected.to respond_to(:admin_fee) }
|
6
|
-
it { is_expected.to respond_to(:application_fee) }
|
7
|
-
it { is_expected.to respond_to(:broker_fee) }
|
8
|
-
it { is_expected.to respond_to(:late_fee_per_day) }
|
9
|
-
it { is_expected.to respond_to(:late_min_fee) }
|
10
|
-
it { is_expected.to respond_to(:late_percent) }
|
11
|
-
it { is_expected.to respond_to(:late_type) }
|
12
|
-
it { is_expected.to respond_to(:non_refundable_hold_fee) }
|
13
|
-
it { is_expected.to respond_to(:prorate_type) }
|
14
|
-
end
|
15
|
-
end
|
@@ -1,17 +0,0 @@
|
|
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
|
-
|
@@ -1,14 +0,0 @@
|
|
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
|
@@ -1,12 +0,0 @@
|
|
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
|
-
|
@@ -1,20 +0,0 @@
|
|
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
|
@@ -1,11 +0,0 @@
|
|
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
|
@@ -1,180 +0,0 @@
|
|
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
|