justimmo_client 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +10 -0
  3. data/lib/justimmo_client/api/v1/interfaces/justimmo_interface.rb +1 -0
  4. data/lib/justimmo_client/api/v1/interfaces/realty_interface.rb +6 -5
  5. data/lib/justimmo_client/api/v1/models/attachment.rb +38 -0
  6. data/lib/justimmo_client/api/v1/models/city.rb +1 -1
  7. data/lib/justimmo_client/api/v1/models/country.rb +19 -10
  8. data/lib/justimmo_client/api/v1/models/employee.rb +26 -19
  9. data/lib/justimmo_client/api/v1/models/geo_location.rb +3 -5
  10. data/lib/justimmo_client/api/v1/models/justimmo_base.rb +1 -0
  11. data/lib/justimmo_client/api/v1/models/realty.rb +33 -36
  12. data/lib/justimmo_client/api/v1/models/realty_cost.rb +68 -0
  13. data/lib/justimmo_client/api/v1/models/realty_marketing.rb +1 -4
  14. data/lib/justimmo_client/api/v1/models/realty_price.rb +33 -57
  15. data/lib/justimmo_client/api/v1/models/realty_usage.rb +1 -5
  16. data/lib/justimmo_client/api/v1/representers/json/attachment_representer.rb +14 -0
  17. data/lib/justimmo_client/api/v1/representers/json/employee_representer.rb +3 -7
  18. data/lib/justimmo_client/api/v1/representers/json/realty_representer.rb +92 -37
  19. data/lib/justimmo_client/api/v1/representers/xml/attachment_representer.rb +31 -0
  20. data/lib/justimmo_client/api/v1/representers/xml/employee_representer.rb +11 -22
  21. data/lib/justimmo_client/api/v1/representers/xml/justimmo_representer.rb +1 -0
  22. data/lib/justimmo_client/api/v1/representers/xml/realty_price_representer.rb +4 -1
  23. data/lib/justimmo_client/api/v1/representers/xml/realty_representer.rb +192 -1
  24. data/lib/justimmo_client/api/v1/representers/xml/realty_type_representer.rb +2 -0
  25. data/lib/justimmo_client/autoload.rb +1 -0
  26. data/lib/justimmo_client/core/api_helpers.rb +29 -0
  27. data/lib/justimmo_client/core/config.rb +7 -1
  28. data/lib/justimmo_client/core/utils.rb +1 -25
  29. data/lib/justimmo_client/interface.rb +1 -0
  30. data/lib/justimmo_client/version.rb +1 -1
  31. data/locales/de.yml +3 -0
  32. metadata +8 -14
  33. data/lib/justimmo_client/api/v1/models/file.rb +0 -64
  34. data/lib/justimmo_client/api/v1/models/image.rb +0 -10
  35. data/lib/justimmo_client/api/v1/representers/json/contact_representer.rb +0 -15
  36. data/lib/justimmo_client/api/v1/representers/json/geo_location_representer.rb +0 -15
  37. data/lib/justimmo_client/api/v1/representers/json/realty_area_representer.rb +0 -27
  38. data/lib/justimmo_client/api/v1/representers/json/realty_price_representer.rb +0 -43
  39. data/lib/justimmo_client/api/v1/representers/json/realty_room_count_representer.rb +0 -21
  40. data/lib/justimmo_client/api/v1/representers/xml/contact_representer.rb +0 -15
  41. data/lib/justimmo_client/api/v1/representers/xml/realty_area_representer.rb +0 -28
  42. data/lib/justimmo_client/api/v1/representers/xml/realty_detail_representer.rb +0 -96
  43. data/lib/justimmo_client/api/v1/representers/xml/realty_list_representer.rb +0 -85
  44. data/lib/justimmo_client/api/v1/representers/xml/realty_room_count_representer.rb +0 -22
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module JustimmoClient::V1
4
- module XML
5
- class RealtyAreaRepresenter < JustimmoRepresenter
6
- { balcony_terrace: :balkon_terrasse_flaeche,
7
- balcony: :balkons_flaeche,
8
- office: :bueroflaeche,
9
- garage: :garagen_flaeche,
10
- garden: :gartenflaeche,
11
- total: :gesamtflaeche,
12
- surface: :grundflaeche,
13
- property: :grundstuecksflaeche,
14
- basement: :kellerflaeche,
15
- storage: :lagerflaeche,
16
- loggia: :loggias_flaeche,
17
- floor: :nutzflaeche,
18
- parking: :stellplatz_flaeche,
19
- terrace: :terrassen_flaeche,
20
- buildable: :verbaubare_flaeche,
21
- sales: :verkaufsflaeche,
22
- living: :wohnflaeche
23
- }.each do |key, api|
24
- property key, as: api
25
- end
26
- end
27
- end
28
- end
@@ -1,96 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module JustimmoClient::V1
4
- module XML
5
- class RealtyDetailItemRepresenter < RealtyRepresenter
6
- nested :verwaltung_techn do
7
- property :id, as: :objektnr_intern
8
- property :number, as: :objektnr_extern
9
- property :openimmo_id, as: :openimmo_obid
10
- end
11
-
12
- nested :verwaltung_objekt do
13
- property :available, as: :verfuegbar_ab
14
- property :status_id
15
- property :created_at,
16
- as: :user_defined_simplefield,
17
- parse_filter: ->(_fragment, options) { options[:doc].css("user_defined_simplefield[feldname=erstellt_am]").text }
18
- property :updated_at,
19
- as: :user_defined_simplefield,
20
- parse_filter: ->(_fragment, options) { options[:doc].css("user_defined_simplefield[feldname=aktualisiert_am]").text }
21
- end
22
-
23
- nested :zustand_angaben do
24
- property :construction_year, as: :baujahr
25
- end
26
-
27
- property :geo,
28
- decorator: GeoLocationRepresenter,
29
- class: GeoLocation
30
-
31
- property :contact,
32
- as: :kontaktperson,
33
- decorator: ContactRepresenter,
34
- class: Employee
35
-
36
- nested :freitexte do
37
- property :title, as: :objekttitel
38
- property :description,
39
- as: :objektbeschreibung,
40
- parse_filter: ->(frag, _opt) { frag.gsub("\r\n", "\n") }
41
- property :description_furniture,
42
- as: :ausstatt_beschr,
43
- parse_filter: ->(frag, _opt) { frag.split(",").map(&:strip) }
44
- nested :user_defined_anyfield do
45
- property :furniture, as: :justimmo_moeblierung
46
- end
47
- end
48
-
49
- property :price,
50
- as: :preise,
51
- decorator: RealtyPriceRepresenter,
52
- class: RealtyPrice
53
-
54
- collection :images,
55
- as: :anhang,
56
- wrap: :anhaenge,
57
- class: Image do
58
- property :category, as: :gruppe, attribute: true
59
- property :origin, as: :location, attribute: true
60
- property :title, as: :anhangtitel
61
- nested :daten do
62
- %i[pfad small medium big2 medium2 s220x155 fullhd].each do |size|
63
- property size,
64
- setter: ->(represented:, fragment:, **) do
65
- represented.add_url(fragment, default: :big)
66
- end
67
- end
68
- end
69
- end
70
-
71
- # FIXME: Get rid of duplicate code!
72
- # Duplicates in RealtyListRepresenter
73
- property :area,
74
- as: :flaechen,
75
- decorator: RealtyAreaRepresenter,
76
- class: RealtyArea
77
-
78
- property :room_count,
79
- as: :flaechen,
80
- decorator: RealtyRoomCountRepresenter,
81
- class: RealtyRoomCount
82
-
83
- property :documents, as: :dokumente
84
- property :images360, as: :bilder360
85
- property :videos
86
- property :links
87
- end
88
-
89
- class RealtyDetailRepresenter < JustimmoRepresenter
90
- property :realty,
91
- as: :immobilie,
92
- decorator: RealtyDetailItemRepresenter,
93
- class: Realty
94
- end
95
- end
96
- end
@@ -1,85 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module JustimmoClient::V1
4
- module XML
5
- class RealtyListItemRepresenter < RealtyRepresenter
6
- property :id
7
- property :number, as: :objektnummer
8
-
9
- property :created_at, as: :erstellt_am
10
- property :updated_at, as: :aktualisiert_am
11
- property :status_id
12
-
13
- property :title, as: :titel
14
- property :teaser, as: :dreizeiler
15
- property :description,
16
- as: :objektbeschreibung,
17
- parse_filter: ->(frag, _opt) { frag.gsub("\r\n", "\n") }
18
-
19
- property :floor, as: :etage
20
-
21
- # Move some attributes into "sub-objects"
22
-
23
- { first_image: :erstes_bild, second_image: :zweites_bild }.each do |key, api|
24
- property api, setter: ->(represented:, fragment:, **) { represented.add_image(fragment) }
25
- end
26
-
27
- { location: :ort,
28
- zip_code: :plz,
29
- proximity: :naehe
30
- }.each do |key, api|
31
- property api, setter: ->(represented:, fragment:, **) { represented.geo.send("#{key}=", fragment) }
32
- end
33
-
34
- { balcony_terrace: :balkon_terrasse_flaeche,
35
- balcony: :balkons_flaeche,
36
- office: :bueroflaeche,
37
- garage: :garagen_flaeche,
38
- garden: :gartenflaeche,
39
- total: :gesamtflaeche,
40
- surface: :grundflaeche,
41
- property: :grundstuecksflaeche,
42
- basement: :kellerflaeche,
43
- storage: :lagerflaeche,
44
- loggia: :loggias_flaeche,
45
- floor: :nutzflaeche,
46
- parking: :stellplatz_flaeche,
47
- terrace: :terrassen_flaeche,
48
- buildable: :verbaubare_flaeche,
49
- sales: :verkaufsflaeche,
50
- living: :wohnflaeche
51
- }.each do |key, api|
52
- property key,
53
- as: api,
54
- setter: ->(fragment:, represented:, **) { represented.area[key] = fragment },
55
- getter: ->(represented:, **) { represented.area[key] }
56
- end
57
-
58
- { store: :anzahl_abstellraum,
59
- bathroom: :anzahl_badezimmer,
60
- balcony_terrace: :anzahl_balkon_terrassen,
61
- balcony: :anzahl_balkone,
62
- garden: :anzahl_garten,
63
- garage: :anzahl_garagen,
64
- loggia: :anzahl_loggias,
65
- basement: :anzahl_keller,
66
- toilet: :anzahl_sep_wc,
67
- parking_space: :anzahl_stellplaetze,
68
- total: :anzahl_zimmer
69
- }.each do |key, api|
70
- property key,
71
- as: api,
72
- setter: ->(fragment:, represented:, **) { represented.room_count[key] = fragment },
73
- getter: ->(represented:, **) { represented.room_count[key] }
74
- end
75
- end
76
-
77
- class RealtyListRepresenter < JustimmoRepresenter
78
- collection :realties,
79
- as: :immobilie,
80
- wraps: :immobilie,
81
- decorator: RealtyListItemRepresenter,
82
- class: Realty
83
- end
84
- end
85
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module JustimmoClient::V1
4
- module XML
5
- class RealtyRoomCountRepresenter < JustimmoRepresenter
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
- }.each do |key, api|
18
- property key, as: api
19
- end
20
- end
21
- end
22
- end