justimmo_client 0.6.3 → 0.6.4
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.
- checksums.yaml +4 -4
- data/.simplecov +10 -0
- data/lib/justimmo_client/api/v1/interfaces/justimmo_interface.rb +1 -0
- data/lib/justimmo_client/api/v1/interfaces/realty_interface.rb +6 -5
- data/lib/justimmo_client/api/v1/models/attachment.rb +38 -0
- data/lib/justimmo_client/api/v1/models/city.rb +1 -1
- data/lib/justimmo_client/api/v1/models/country.rb +19 -10
- data/lib/justimmo_client/api/v1/models/employee.rb +26 -19
- data/lib/justimmo_client/api/v1/models/geo_location.rb +3 -5
- data/lib/justimmo_client/api/v1/models/justimmo_base.rb +1 -0
- data/lib/justimmo_client/api/v1/models/realty.rb +33 -36
- data/lib/justimmo_client/api/v1/models/realty_cost.rb +68 -0
- data/lib/justimmo_client/api/v1/models/realty_marketing.rb +1 -4
- data/lib/justimmo_client/api/v1/models/realty_price.rb +33 -57
- data/lib/justimmo_client/api/v1/models/realty_usage.rb +1 -5
- data/lib/justimmo_client/api/v1/representers/json/attachment_representer.rb +14 -0
- data/lib/justimmo_client/api/v1/representers/json/employee_representer.rb +3 -7
- data/lib/justimmo_client/api/v1/representers/json/realty_representer.rb +92 -37
- data/lib/justimmo_client/api/v1/representers/xml/attachment_representer.rb +31 -0
- data/lib/justimmo_client/api/v1/representers/xml/employee_representer.rb +11 -22
- data/lib/justimmo_client/api/v1/representers/xml/justimmo_representer.rb +1 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_price_representer.rb +4 -1
- data/lib/justimmo_client/api/v1/representers/xml/realty_representer.rb +192 -1
- data/lib/justimmo_client/api/v1/representers/xml/realty_type_representer.rb +2 -0
- data/lib/justimmo_client/autoload.rb +1 -0
- data/lib/justimmo_client/core/api_helpers.rb +29 -0
- data/lib/justimmo_client/core/config.rb +7 -1
- data/lib/justimmo_client/core/utils.rb +1 -25
- data/lib/justimmo_client/interface.rb +1 -0
- data/lib/justimmo_client/version.rb +1 -1
- data/locales/de.yml +3 -0
- metadata +8 -14
- data/lib/justimmo_client/api/v1/models/file.rb +0 -64
- data/lib/justimmo_client/api/v1/models/image.rb +0 -10
- data/lib/justimmo_client/api/v1/representers/json/contact_representer.rb +0 -15
- data/lib/justimmo_client/api/v1/representers/json/geo_location_representer.rb +0 -15
- data/lib/justimmo_client/api/v1/representers/json/realty_area_representer.rb +0 -27
- data/lib/justimmo_client/api/v1/representers/json/realty_price_representer.rb +0 -43
- data/lib/justimmo_client/api/v1/representers/json/realty_room_count_representer.rb +0 -21
- data/lib/justimmo_client/api/v1/representers/xml/contact_representer.rb +0 -15
- data/lib/justimmo_client/api/v1/representers/xml/realty_area_representer.rb +0 -28
- data/lib/justimmo_client/api/v1/representers/xml/realty_detail_representer.rb +0 -96
- data/lib/justimmo_client/api/v1/representers/xml/realty_list_representer.rb +0 -85
- data/lib/justimmo_client/api/v1/representers/xml/realty_room_count_representer.rb +0 -22
@@ -1,50 +1,55 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "monetize"
|
4
|
-
|
5
3
|
module JustimmoClient::V1
|
6
4
|
class RealtyPrice < JustimmoBase
|
7
5
|
# @!group Attributes
|
8
6
|
|
9
7
|
# @!macro [attach] attribute
|
10
8
|
# @return [$2]
|
11
|
-
attribute :currency,
|
9
|
+
attribute :currency, Symbol, default: :EUR
|
12
10
|
attribute :provision, Boolean
|
13
11
|
attribute :including_vat, Boolean
|
14
12
|
attribute :on_demand, Boolean
|
15
13
|
attribute :real_estate_taxes, Float
|
16
14
|
attribute :land_registry, Float
|
17
|
-
attribute :commission,
|
18
|
-
attribute :purcase, Money
|
19
|
-
attribute :purcase_net, Money
|
15
|
+
attribute :commission, String
|
20
16
|
attribute :rent_vat, Integer
|
21
|
-
attribute :rent, Money
|
22
|
-
attribute :rent_net, Money
|
23
|
-
attribute :rent_cold, Money
|
24
|
-
attribute :rent_including_heating, Money
|
25
|
-
attribute :rent_per_sqm, Money
|
26
|
-
attribute :deposit, Money
|
27
17
|
attribute :operating_cost_vat, Integer
|
28
|
-
attribute :
|
29
|
-
attribute :
|
30
|
-
attribute :
|
18
|
+
attribute :purcase, RealtyCost
|
19
|
+
attribute :purcase_net, RealtyCost
|
20
|
+
attribute :rent, RealtyCost
|
21
|
+
attribute :rent_net, RealtyCost
|
22
|
+
attribute :rent_cold, RealtyCost
|
23
|
+
attribute :rent_cold_net, RealtyCost
|
24
|
+
attribute :rent_including_heating, RealtyCost
|
25
|
+
attribute :rent_per_sqm, RealtyCost
|
26
|
+
attribute :operating_cost, RealtyCost
|
27
|
+
attribute :operating_cost_net, RealtyCost
|
28
|
+
attribute :operating_cost_per_sqm, RealtyCost
|
29
|
+
attribute :deposit, RealtyCost
|
31
30
|
|
32
31
|
# @!group Instance Method Summary
|
33
32
|
|
34
|
-
%
|
35
|
-
|
36
|
-
|
33
|
+
%i[
|
34
|
+
purcase purcase_net deposit
|
35
|
+
rent rent_net rent_cold rent_cold_net rent_including_heating rent_per_sqm
|
36
|
+
operating_cost operating_cost_net operating_cost_per_sqm
|
37
37
|
].each do |meth|
|
38
|
-
define_method("#{meth}=") do |
|
39
|
-
|
40
|
-
|
38
|
+
define_method("#{meth}=") do |args|
|
39
|
+
options =
|
40
|
+
case args
|
41
|
+
when Hash then args.deep_symbolize_keys
|
42
|
+
when String then { amount: args, currency: @currency }
|
43
|
+
else return
|
44
|
+
end
|
45
|
+
instance_variable_set("@#{meth}", RealtyCost.new(options))
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|
44
49
|
def on_demand?
|
45
|
-
return on_demand
|
46
|
-
return purcase.zero?
|
47
|
-
return rent.zero?
|
50
|
+
return on_demand if on_demand
|
51
|
+
return purcase.zero? if purcase
|
52
|
+
return rent.zero? if rent
|
48
53
|
true
|
49
54
|
end
|
50
55
|
|
@@ -56,30 +61,9 @@ module JustimmoClient::V1
|
|
56
61
|
!purcase.nil?
|
57
62
|
end
|
58
63
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
log.debug("Set currency to #{currency.name}")
|
63
|
-
end
|
64
|
-
|
65
|
-
# FIXME: this needs some proper analysis of the input string
|
66
|
-
def commission=(text)
|
67
|
-
@commission = text.to_i
|
68
|
-
end
|
69
|
-
|
70
|
-
def commission
|
71
|
-
return nil unless @commission
|
72
|
-
|
73
|
-
if purcase?
|
74
|
-
(get / 100 * @commission) * 1.20
|
75
|
-
else
|
76
|
-
(get * @commission) * 1.20
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def rent_vat
|
81
|
-
return nil unless rent? && rent_net && @rent_vat
|
82
|
-
rent_net / 100 * @rent_vat
|
64
|
+
# TODO: add more additional costs
|
65
|
+
def additional
|
66
|
+
[operating_cost].map(&:to_f).sum
|
83
67
|
end
|
84
68
|
|
85
69
|
def get
|
@@ -91,15 +75,7 @@ module JustimmoClient::V1
|
|
91
75
|
end
|
92
76
|
|
93
77
|
def to_s
|
94
|
-
on_demand? ? "
|
95
|
-
end
|
96
|
-
|
97
|
-
def as_json
|
98
|
-
@attributes.to_s
|
99
|
-
end
|
100
|
-
|
101
|
-
def inspect
|
102
|
-
"#<#{self.class} #{self}>"
|
78
|
+
on_demand? ? translate("price.on_demand") : get.to_s
|
103
79
|
end
|
104
80
|
end
|
105
81
|
end
|
@@ -24,11 +24,7 @@ module JustimmoClient::V1
|
|
24
24
|
# @!group Instance Method Summary
|
25
25
|
|
26
26
|
def to_a
|
27
|
-
|
28
|
-
tmp << :living if living?
|
29
|
-
tmp << :business if business?
|
30
|
-
tmp << :investment if investment?
|
31
|
-
tmp
|
27
|
+
attributes.select { |_k, v| v }.keys
|
32
28
|
end
|
33
29
|
|
34
30
|
def map(&block)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module JSON
|
5
|
+
class AttachmentRepresenter < JustimmoRepresenter
|
6
|
+
property :category
|
7
|
+
property :origin
|
8
|
+
property :title
|
9
|
+
property :url
|
10
|
+
|
11
|
+
collection_representer class: Attachment
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -18,13 +18,9 @@ module JustimmoClient::V1
|
|
18
18
|
property :location
|
19
19
|
property :website
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
setter: ->(represented:, fragment:, **) { represented.add_url(fragment, default: :user_big) },
|
25
|
-
getter: ->(represented:, **) { represented[size] }
|
26
|
-
end
|
27
|
-
end
|
21
|
+
collection :attachments,
|
22
|
+
decorator: AttachmentRepresenter,
|
23
|
+
class: Attachment
|
28
24
|
|
29
25
|
collection_representer class: Employee
|
30
26
|
end
|
@@ -3,18 +3,8 @@
|
|
3
3
|
module JustimmoClient::V1
|
4
4
|
module JSON
|
5
5
|
class RealtyRepresenter < JustimmoRepresenter
|
6
|
-
property :usage, class: RealtyUsage do
|
7
|
-
property :living
|
8
|
-
property :business
|
9
|
-
property :investment
|
10
|
-
end
|
11
|
-
property :marketing, class: RealtyMarketing do
|
12
|
-
property :buy
|
13
|
-
property :rent
|
14
|
-
end
|
15
6
|
property :type_id
|
16
7
|
property :sub_type_id
|
17
|
-
|
18
8
|
property :id
|
19
9
|
property :number
|
20
10
|
property :created_at
|
@@ -23,43 +13,108 @@ module JustimmoClient::V1
|
|
23
13
|
property :title
|
24
14
|
property :teaser
|
25
15
|
property :description
|
26
|
-
property :floor
|
27
|
-
property :area,
|
28
|
-
decorator: RealtyAreaRepresenter,
|
29
|
-
class: RealtyArea
|
30
|
-
property :geo,
|
31
|
-
decorator: GeoLocationRepresenter,
|
32
|
-
class: GeoLocation
|
33
|
-
property :room_count,
|
34
|
-
decorator: RealtyRoomCountRepresenter,
|
35
|
-
class: RealtyRoomCount
|
36
|
-
|
37
16
|
property :openimmo_id
|
38
17
|
property :available
|
39
18
|
property :construction_year
|
40
|
-
property :contact,
|
41
|
-
decorator: ContactRepresenter,
|
42
|
-
class: Employee
|
43
19
|
property :description_furniture
|
44
20
|
property :furniture
|
45
|
-
property :price,
|
46
|
-
decorator: RealtyPriceRepresenter,
|
47
|
-
class: RealtyPrice
|
48
|
-
collection :images, class: Image do
|
49
|
-
property :category
|
50
|
-
property :origin
|
51
|
-
property :title
|
52
|
-
%i[pfad small medium big2 medium2 s220x155 fullhd].each do |size|
|
53
|
-
property size,
|
54
|
-
setter: ->(represented:, fragment:, **) { represented.add_url(fragment, default: :big) },
|
55
|
-
getter: ->(represented:, **) { represented[size] }
|
56
|
-
end
|
57
|
-
end
|
58
21
|
property :documents
|
59
22
|
property :images360
|
60
23
|
property :videos
|
61
24
|
property :links
|
62
25
|
|
26
|
+
property :usage, class: RealtyUsage do
|
27
|
+
property :living
|
28
|
+
property :business
|
29
|
+
property :investment
|
30
|
+
end
|
31
|
+
|
32
|
+
property :marketing, class: RealtyMarketing do
|
33
|
+
property :buy
|
34
|
+
property :rent
|
35
|
+
end
|
36
|
+
|
37
|
+
property :area, class: RealtyArea do
|
38
|
+
property :balcony_terrace
|
39
|
+
property :balcony
|
40
|
+
property :office
|
41
|
+
property :garage
|
42
|
+
property :garden
|
43
|
+
property :total
|
44
|
+
property :surface
|
45
|
+
property :property
|
46
|
+
property :basement
|
47
|
+
property :storage
|
48
|
+
property :loggia
|
49
|
+
property :floor
|
50
|
+
property :parking
|
51
|
+
property :terrace
|
52
|
+
property :buildable
|
53
|
+
property :sales
|
54
|
+
property :living
|
55
|
+
end
|
56
|
+
|
57
|
+
property :geo, class: GeoLocation do
|
58
|
+
property :zip_code
|
59
|
+
property :location
|
60
|
+
property :federal_state
|
61
|
+
property :floor
|
62
|
+
property :country
|
63
|
+
property :latitude
|
64
|
+
property :longitude
|
65
|
+
end
|
66
|
+
|
67
|
+
property :room_count, class: RealtyRoomCount do
|
68
|
+
property :store
|
69
|
+
property :bathroom
|
70
|
+
property :balcony_terrace
|
71
|
+
property :balcony
|
72
|
+
property :garden
|
73
|
+
property :garage
|
74
|
+
property :loggia
|
75
|
+
property :basement
|
76
|
+
property :toilet
|
77
|
+
property :parking_space
|
78
|
+
property :total
|
79
|
+
end
|
80
|
+
|
81
|
+
property :contact, decorator: EmployeeRepresenter, class: Employee do
|
82
|
+
property :email_feedback
|
83
|
+
property :email
|
84
|
+
property :last_name
|
85
|
+
property :company
|
86
|
+
property :salutation
|
87
|
+
property :phone
|
88
|
+
property :mobile
|
89
|
+
end
|
90
|
+
|
91
|
+
property :price, class: RealtyPrice do
|
92
|
+
property :purcase
|
93
|
+
property :purcase_net
|
94
|
+
property :rent
|
95
|
+
property :rent_net
|
96
|
+
property :rent_cold
|
97
|
+
property :rent_including_heating
|
98
|
+
property :deposit
|
99
|
+
property :rent_per_sqm
|
100
|
+
property :operating_cost
|
101
|
+
property :operating_cost_net
|
102
|
+
property :operating_cost_per_sqm
|
103
|
+
property :currency
|
104
|
+
property :commission
|
105
|
+
property :rent_vat
|
106
|
+
property :provision
|
107
|
+
property :including_vat
|
108
|
+
property :on_demand
|
109
|
+
property :real_estate_taxes
|
110
|
+
property :land_registry
|
111
|
+
property :operating_cost_vat
|
112
|
+
end
|
113
|
+
|
114
|
+
collection :attachments,
|
115
|
+
decorator: AttachmentRepresenter,
|
116
|
+
class: Attachment
|
117
|
+
|
63
118
|
collection_representer class: Realty
|
64
119
|
end
|
65
120
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module XML
|
5
|
+
class AttachmentRepresenter < JustimmoRepresenter
|
6
|
+
property :category,
|
7
|
+
as: :gruppe,
|
8
|
+
attribute: true,
|
9
|
+
parse_filter: ->(fragment, _opt) do
|
10
|
+
case fragment
|
11
|
+
when "TITELBILD" then :title_image
|
12
|
+
when "BILD" then :image
|
13
|
+
else nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
property :origin,
|
18
|
+
as: :location,
|
19
|
+
attribute: true,
|
20
|
+
parse_filter: ->(fragment, _opt) { fragment.downcase }
|
21
|
+
|
22
|
+
property :title, as: :anhangtitel
|
23
|
+
|
24
|
+
nested :daten do
|
25
|
+
property :url, as: :pfad
|
26
|
+
end
|
27
|
+
|
28
|
+
collection_representer class: Attachment
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -18,29 +18,18 @@ module JustimmoClient::V1
|
|
18
18
|
property :location, as: :ort
|
19
19
|
property :website, as: :url
|
20
20
|
|
21
|
-
|
22
|
-
as: :
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
21
|
+
collection :attachments,
|
22
|
+
as: :anhang,
|
23
|
+
wrap: :anhaenge,
|
24
|
+
decorator: AttachmentRepresenter,
|
25
|
+
class: Attachment
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# class: Image do
|
36
|
-
# property :category, as: :gruppe, attribute: true
|
37
|
-
# property :origin, as: :location, attribute: true
|
38
|
-
# property :title, as: :anhangtitel
|
39
|
-
# nested :daten do
|
40
|
-
# property :path, as: :pfad, setter: ->(represented:, fragment:, **) { represented.add_url(fragment, default: :user_big) }
|
41
|
-
# end
|
42
|
-
# end
|
43
|
-
# end
|
27
|
+
nested :bild do
|
28
|
+
property :pfad,
|
29
|
+
setter: ->(fragment:, represented:, **) do
|
30
|
+
represented.attachments << Attachment.new(url: fragment)
|
31
|
+
end
|
32
|
+
end
|
44
33
|
end
|
45
34
|
end
|
46
35
|
end
|
@@ -7,8 +7,10 @@ module JustimmoClient::V1
|
|
7
7
|
property :currency, as: :iso_waehrung, attribute: true
|
8
8
|
end
|
9
9
|
|
10
|
-
property :purcase,
|
10
|
+
property :purcase, as: :kaufpreis
|
11
11
|
property :purcase_net, as: :kaufpreisnetto
|
12
|
+
# property :purcase_per_sqm, as: :kaufpreis_pro_qm
|
13
|
+
|
12
14
|
nested :kaufpreis do
|
13
15
|
property :on_demand, as: :auf_anfrage, attribute: true
|
14
16
|
end
|
@@ -21,6 +23,7 @@ module JustimmoClient::V1
|
|
21
23
|
|
22
24
|
property :deposit, as: :kaution
|
23
25
|
property :rent_cold, as: :kaltmiete
|
26
|
+
property :rent_cold_net, as: :nettokaltmiete
|
24
27
|
property :rent_including_heating, as: :warmmiete
|
25
28
|
property :rent_per_sqm, as: :mietpreis_pro_qm
|
26
29
|
property :operating_cost_per_sqm, as: :betriebskosten_pro_qm
|
@@ -2,7 +2,153 @@
|
|
2
2
|
|
3
3
|
module JustimmoClient::V1
|
4
4
|
module XML
|
5
|
-
|
5
|
+
REALTY_ROOMS = {
|
6
|
+
store: :anzahl_abstellraum,
|
7
|
+
bathroom: :anzahl_badezimmer,
|
8
|
+
balcony_terrace: :anzahl_balkon_terrassen,
|
9
|
+
balcony: :anzahl_balkone,
|
10
|
+
garden: :anzahl_garten,
|
11
|
+
garage: :anzahl_garagen,
|
12
|
+
loggia: :anzahl_loggias,
|
13
|
+
basement: :anzahl_keller,
|
14
|
+
toilet: :anzahl_sep_wc,
|
15
|
+
parking_space: :anzahl_stellplaetze,
|
16
|
+
total: :anzahl_zimmer
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
REALTY_AREAS = {
|
20
|
+
balcony_terrace: :balkon_terrasse_flaeche,
|
21
|
+
balcony: :balkons_flaeche,
|
22
|
+
office: :bueroflaeche,
|
23
|
+
garage: :garagen_flaeche,
|
24
|
+
garden: :gartenflaeche,
|
25
|
+
total: :gesamtflaeche,
|
26
|
+
surface: :grundflaeche,
|
27
|
+
property: :grundstuecksflaeche,
|
28
|
+
basement: :kellerflaeche,
|
29
|
+
storage: :lagerflaeche,
|
30
|
+
loggia: :loggias_flaeche,
|
31
|
+
floor: :nutzflaeche,
|
32
|
+
parking: :stellplatz_flaeche,
|
33
|
+
terrace: :terrassen_flaeche,
|
34
|
+
buildable: :verbaubare_flaeche,
|
35
|
+
sales: :verkaufsflaeche,
|
36
|
+
living: :wohnflaeche
|
37
|
+
}.freeze
|
38
|
+
|
39
|
+
FILTERS = {
|
40
|
+
sanitize_newline: ->(frag, _opt) { frag.gsub("\r\n", "\n") },
|
41
|
+
str_to_a: ->(frag, _opt) { frag.split(",").map(&:strip) }
|
42
|
+
}.freeze
|
43
|
+
|
44
|
+
private_constant :REALTY_ROOMS
|
45
|
+
private_constant :REALTY_AREAS
|
46
|
+
private_constant :FILTERS
|
47
|
+
|
48
|
+
class RealtyListRepresenter < JustimmoRepresenter
|
49
|
+
property :title, as: :titel
|
50
|
+
property :teaser, as: :dreizeiler
|
51
|
+
property :description,
|
52
|
+
as: :objektbeschreibung,
|
53
|
+
parse_filter: FILTERS[:sanitize_newline]
|
54
|
+
|
55
|
+
property :status_id
|
56
|
+
property :created_at, as: :erstellt_am
|
57
|
+
property :updated_at, as: :aktualisiert_am
|
58
|
+
|
59
|
+
property :id
|
60
|
+
property :number, as: :objektnummer
|
61
|
+
|
62
|
+
# nesting
|
63
|
+
|
64
|
+
{ first_image: :erstes_bild,
|
65
|
+
second_image: :zweites_bild
|
66
|
+
}.each do |key, api|
|
67
|
+
property api, setter: ->(represented:, fragment:, **) do
|
68
|
+
represented.attachments << Attachment.new(url: fragment)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
{ location: :ort,
|
73
|
+
zip_code: :plz,
|
74
|
+
proximity: :naehe,
|
75
|
+
floor: :etage
|
76
|
+
}.each do |key, value|
|
77
|
+
property value, setter: ->(represented:, fragment:, **) do
|
78
|
+
represented.geo ||= GeoLocation.new
|
79
|
+
represented.geo.send("#{key}=", fragment)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
{ purcase: :kaufpreis,
|
84
|
+
rent_cold: :gesamtmiete
|
85
|
+
}.each do |key, value|
|
86
|
+
property value, setter: ->(represented:, fragment:, **) do
|
87
|
+
represented.price ||= RealtyPrice.new
|
88
|
+
represented.price.send("#{key}=", fragment)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
REALTY_AREAS.each do |key, value|
|
93
|
+
property key,
|
94
|
+
as: value,
|
95
|
+
setter: ->(fragment:, represented:, **) do
|
96
|
+
represented.area ||= RealtyArea.new
|
97
|
+
represented.area[key] = fragment
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
REALTY_ROOMS.each do |key, value|
|
102
|
+
property key,
|
103
|
+
as: value,
|
104
|
+
setter: ->(fragment:, represented:, **) do
|
105
|
+
represented.room_count ||= RealtyRoomCount.new
|
106
|
+
represented.room_count[key] = fragment
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
class RealtyRepresenter < RealtyListRepresenter
|
112
|
+
property :geo,
|
113
|
+
decorator: GeoLocationRepresenter,
|
114
|
+
class: GeoLocation
|
115
|
+
|
116
|
+
property :contact, as: :kontaktperson, class: Employee do
|
117
|
+
property :email_feedback
|
118
|
+
property :email, as: :email_direkt
|
119
|
+
property :last_name, as: :name
|
120
|
+
property :company, as: :firma
|
121
|
+
property :salutation, as: :anrede
|
122
|
+
property :phone, as: :tel_zentrale
|
123
|
+
property :mobile, as: :tel_handy
|
124
|
+
end
|
125
|
+
|
126
|
+
property :price,
|
127
|
+
as: :preise,
|
128
|
+
decorator: RealtyPriceRepresenter,
|
129
|
+
class: RealtyPrice
|
130
|
+
|
131
|
+
property :area, as: :flaechen, class: RealtyArea do
|
132
|
+
REALTY_AREAS.each { |k, v| property k, as: v }
|
133
|
+
end
|
134
|
+
|
135
|
+
property :room_count, as: :flaechen, class: RealtyRoomCount do
|
136
|
+
REALTY_ROOMS.each { |k, v| property k, as: v }
|
137
|
+
end
|
138
|
+
|
139
|
+
property :documents, as: :dokumente
|
140
|
+
property :videos
|
141
|
+
property :images360, as: :bilder360
|
142
|
+
property :links
|
143
|
+
|
144
|
+
collection :attachments,
|
145
|
+
as: :anhang,
|
146
|
+
wrap: :anhaenge,
|
147
|
+
decorator: AttachmentRepresenter,
|
148
|
+
class: Attachment
|
149
|
+
|
150
|
+
# Unnesting
|
151
|
+
|
6
152
|
nested :category, as: :objektkategorie do
|
7
153
|
property :usage, as: :nutzungsart, class: RealtyUsage do
|
8
154
|
property :living, as: :WOHNEN, attribute: true
|
@@ -27,6 +173,51 @@ module JustimmoClient::V1
|
|
27
173
|
options[:doc].css("user_defined_simplefield[feldname=sub_objektart_id]").text
|
28
174
|
end
|
29
175
|
end
|
176
|
+
|
177
|
+
nested :ausstattung do
|
178
|
+
end
|
179
|
+
|
180
|
+
nested :zustand_angaben do
|
181
|
+
property :construction_year, as: :baujahr
|
182
|
+
end
|
183
|
+
|
184
|
+
nested :freitexte do
|
185
|
+
property :title, as: :objekttitel
|
186
|
+
|
187
|
+
property :description,
|
188
|
+
as: :objektbeschreibung,
|
189
|
+
parse_filter: FILTERS[:sanitize_newline]
|
190
|
+
|
191
|
+
property :description_furniture,
|
192
|
+
as: :ausstatt_beschr,
|
193
|
+
parse_filter: FILTERS[:str_to_a]
|
194
|
+
|
195
|
+
nested :user_defined_anyfield do
|
196
|
+
property :furniture, as: :justimmo_moeblierung
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
nested :verwaltung_objekt do
|
201
|
+
property :available, as: :verfuegbar_ab
|
202
|
+
|
203
|
+
property :status_id
|
204
|
+
|
205
|
+
property :created_at,
|
206
|
+
as: :user_defined_simplefield,
|
207
|
+
parse_filter: ->(_fragment, options) { options[:doc].css("user_defined_simplefield[feldname=erstellt_am]").text }
|
208
|
+
|
209
|
+
property :updated_at,
|
210
|
+
as: :user_defined_simplefield,
|
211
|
+
parse_filter: ->(_fragment, options) { options[:doc].css("user_defined_simplefield[feldname=aktualisiert_am]").text }
|
212
|
+
end
|
213
|
+
|
214
|
+
nested :verwaltung_techn do
|
215
|
+
property :id, as: :objektnr_intern
|
216
|
+
property :number, as: :objektnr_extern
|
217
|
+
property :openimmo_id, as: :openimmo_obid
|
218
|
+
end
|
219
|
+
|
220
|
+
collection_representer class: Realty
|
30
221
|
end
|
31
222
|
end
|
32
223
|
end
|