justimmo_client 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +15 -0
- data/.gitignore +15 -0
- data/.gitlab-ci.yml +67 -0
- data/.rspec +2 -0
- data/.rubocop.yml +90 -0
- data/.ruby-version +1 -0
- data/Gemfile +21 -0
- data/LICENSE +21 -0
- data/README.md +72 -0
- data/Rakefile +14 -0
- data/bin/console +21 -0
- data/bin/setup +8 -0
- data/examples/client.rb +16 -0
- data/justimmo_client.gemspec +41 -0
- data/lib/justimmo_client/api/v1/models/city.rb +16 -0
- data/lib/justimmo_client/api/v1/models/country.rb +44 -0
- data/lib/justimmo_client/api/v1/models/employee.rb +45 -0
- data/lib/justimmo_client/api/v1/models/federal_state.rb +15 -0
- data/lib/justimmo_client/api/v1/models/file.rb +64 -0
- data/lib/justimmo_client/api/v1/models/geo_location.rb +47 -0
- data/lib/justimmo_client/api/v1/models/image.rb +10 -0
- data/lib/justimmo_client/api/v1/models/justimmo_base.rb +15 -0
- data/lib/justimmo_client/api/v1/models/realty.rb +82 -0
- data/lib/justimmo_client/api/v1/models/realty_area.rb +49 -0
- data/lib/justimmo_client/api/v1/models/realty_category.rb +13 -0
- data/lib/justimmo_client/api/v1/models/realty_marketing.rb +12 -0
- data/lib/justimmo_client/api/v1/models/realty_price.rb +94 -0
- data/lib/justimmo_client/api/v1/models/realty_room_count.rb +35 -0
- data/lib/justimmo_client/api/v1/models/realty_type.rb +12 -0
- data/lib/justimmo_client/api/v1/models/realty_usage.rb +24 -0
- data/lib/justimmo_client/api/v1/models/region.rb +12 -0
- data/lib/justimmo_client/api/v1/representers/json/attachment_image_representer.rb +16 -0
- data/lib/justimmo_client/api/v1/representers/json/attachment_representer.rb +15 -0
- data/lib/justimmo_client/api/v1/representers/json/contact_representer.rb +30 -0
- data/lib/justimmo_client/api/v1/representers/json/justimmo_representer.rb +13 -0
- data/lib/justimmo_client/api/v1/representers/json/location_representer.rb +14 -0
- data/lib/justimmo_client/api/v1/representers/json/realty_category_representer.rb +21 -0
- data/lib/justimmo_client/api/v1/representers/json/realty_detail_representer.rb +69 -0
- data/lib/justimmo_client/api/v1/representers/json.rb +10 -0
- data/lib/justimmo_client/api/v1/representers/xml/city_representer.rb +18 -0
- data/lib/justimmo_client/api/v1/representers/xml/contact_representer.rb +15 -0
- data/lib/justimmo_client/api/v1/representers/xml/country_representer.rb +15 -0
- data/lib/justimmo_client/api/v1/representers/xml/employee_list_representer.rb +15 -0
- data/lib/justimmo_client/api/v1/representers/xml/employee_representer.rb +46 -0
- data/lib/justimmo_client/api/v1/representers/xml/federal_state_representer.rb +17 -0
- data/lib/justimmo_client/api/v1/representers/xml/geo_location_representer.rb +24 -0
- data/lib/justimmo_client/api/v1/representers/xml/justimmo_representer.rb +13 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_area_representer.rb +28 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_category_representer.rb +15 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_detail_representer.rb +92 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_list_representer.rb +85 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_price_representer.rb +53 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_representer.rb +32 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_room_count_representer.rb +22 -0
- data/lib/justimmo_client/api/v1/representers/xml/realty_type_representer.rb +14 -0
- data/lib/justimmo_client/api/v1/representers/xml/region_representer.rb +14 -0
- data/lib/justimmo_client/api/v1/representers/xml.rb +11 -0
- data/lib/justimmo_client/api/v1/requests/employee_request.rb +24 -0
- data/lib/justimmo_client/api/v1/requests/justimmo_request.rb +64 -0
- data/lib/justimmo_client/api/v1/requests/realty_request.rb +209 -0
- data/lib/justimmo_client/api/v1.rb +16 -0
- data/lib/justimmo_client/autoload.rb +17 -0
- data/lib/justimmo_client/core/caching.rb +55 -0
- data/lib/justimmo_client/core/config.rb +46 -0
- data/lib/justimmo_client/core/logging.rb +46 -0
- data/lib/justimmo_client/core/utils.rb +38 -0
- data/lib/justimmo_client/employee.rb +39 -0
- data/lib/justimmo_client/errors.rb +58 -0
- data/lib/justimmo_client/misc.rb +10 -0
- data/lib/justimmo_client/option_parser.rb +107 -0
- data/lib/justimmo_client/realty.rb +150 -0
- data/lib/justimmo_client/version.rb +5 -0
- data/lib/justimmo_client.rb +22 -0
- data/notes.md +19 -0
- metadata +271 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
class Realty < JustimmoBase
|
5
|
+
# @!group Attributes
|
6
|
+
|
7
|
+
# @!macro [attach] attribute
|
8
|
+
# @return [$2]
|
9
|
+
attribute :id, Integer
|
10
|
+
attribute :number, Integer
|
11
|
+
attribute :title, String
|
12
|
+
attribute :description, String, default: ""
|
13
|
+
attribute :teaser, String, default: ""
|
14
|
+
attribute :usage, RealtyUsage
|
15
|
+
attribute :marketing, RealtyMarketing
|
16
|
+
attribute :type_id, Integer
|
17
|
+
attribute :sub_type_id, Integer
|
18
|
+
attribute :geo, GeoLocation
|
19
|
+
attribute :area, RealtyArea
|
20
|
+
attribute :room_count, RealtyRoomCount
|
21
|
+
attribute :price, RealtyPrice
|
22
|
+
attribute :status_id, Integer
|
23
|
+
attribute :floor, String
|
24
|
+
attribute :openimmo_id, String
|
25
|
+
attribute :contact, Employee
|
26
|
+
attribute :description_furniture, Array[String]
|
27
|
+
attribute :furniture, Array[String]
|
28
|
+
attribute :images, Array[Image]
|
29
|
+
attribute :documents, Array
|
30
|
+
attribute :videos, Array
|
31
|
+
attribute :images360, Array
|
32
|
+
attribute :links, Array
|
33
|
+
attribute :available, DateTime
|
34
|
+
attribute :created_at, DateTime
|
35
|
+
attribute :updated_at, DateTime
|
36
|
+
|
37
|
+
# @!group Instance Method Summary
|
38
|
+
|
39
|
+
def initialize(**options)
|
40
|
+
super(options)
|
41
|
+
@area = RealtyArea.new
|
42
|
+
@room_count = RealtyRoomCount.new
|
43
|
+
@geo = GeoLocation.new
|
44
|
+
@usage = RealtyUsage.new
|
45
|
+
@marketing = RealtyMarketing.new
|
46
|
+
@price = RealtyPrice.new
|
47
|
+
end
|
48
|
+
|
49
|
+
# @param date [String]
|
50
|
+
# @return [String, DateTime]
|
51
|
+
def available=(date)
|
52
|
+
@available = DateTime.parse(date)
|
53
|
+
rescue ArgumentError
|
54
|
+
log.error("Failed to convert date: #{date}")
|
55
|
+
@available = date
|
56
|
+
end
|
57
|
+
|
58
|
+
def description=(desc)
|
59
|
+
@description =
|
60
|
+
if @teaser.empty?
|
61
|
+
parts = desc.partition("</ul>\n")
|
62
|
+
@teaser = parts[0..1].join
|
63
|
+
parts.last.empty? ? @teaser : parts.last
|
64
|
+
else
|
65
|
+
desc
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def add_image(url, **options)
|
70
|
+
@images ||= []
|
71
|
+
image = Image.new
|
72
|
+
image.add_url(url, options)
|
73
|
+
@images << image
|
74
|
+
end
|
75
|
+
|
76
|
+
def type
|
77
|
+
end
|
78
|
+
|
79
|
+
def sub_type
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
class RealtyArea < JustimmoBase
|
5
|
+
# @!group Attributes
|
6
|
+
|
7
|
+
# @!macro [attach] attribute
|
8
|
+
# @return [$2]
|
9
|
+
attribute :balcony_terrace, Float
|
10
|
+
attribute :balcony, Float
|
11
|
+
attribute :office, Float
|
12
|
+
attribute :garage, Float
|
13
|
+
attribute :garden, Float
|
14
|
+
attribute :total, Float
|
15
|
+
attribute :surface, Float
|
16
|
+
attribute :property, Float
|
17
|
+
attribute :basement, Float
|
18
|
+
attribute :storage, Float
|
19
|
+
attribute :loggia, Float
|
20
|
+
attribute :floor, Float
|
21
|
+
attribute :parking, Float
|
22
|
+
attribute :terrace, Float
|
23
|
+
attribute :buildable, Float
|
24
|
+
attribute :sales, Float
|
25
|
+
attribute :living, Float
|
26
|
+
|
27
|
+
# @!group Instance Method Summary
|
28
|
+
|
29
|
+
def to_f
|
30
|
+
living || floor
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
to_f.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
def inspect
|
38
|
+
"#<#{self.class} #{self}>"
|
39
|
+
end
|
40
|
+
|
41
|
+
def each(&block)
|
42
|
+
attributes.each(&block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def map(&block)
|
46
|
+
attributes.map(&block)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
class RealtyCategory < JustimmoBase
|
5
|
+
# @!group Attributes
|
6
|
+
|
7
|
+
# @!macro [attach] attribute
|
8
|
+
# @return [$2]
|
9
|
+
attribute :id, Integer
|
10
|
+
attribute :name, String
|
11
|
+
attribute :sortablerank, Boolean
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "monetize"
|
4
|
+
|
5
|
+
module JustimmoClient::V1
|
6
|
+
class RealtyPrice < JustimmoBase
|
7
|
+
# @!group Attributes
|
8
|
+
|
9
|
+
# @!macro [attach] attribute
|
10
|
+
# @return [$2]
|
11
|
+
attribute :currency, Money::Currency
|
12
|
+
attribute :provision, Boolean
|
13
|
+
attribute :including_vat, Boolean
|
14
|
+
attribute :on_demand, Boolean
|
15
|
+
attribute :real_estate_taxes, Float
|
16
|
+
attribute :land_registry, Float
|
17
|
+
attribute :commission, Integer
|
18
|
+
attribute :purcase, Money
|
19
|
+
attribute :purcase_net, Money
|
20
|
+
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
|
+
attribute :operating_cost_vat, Integer
|
28
|
+
attribute :operating_cost, Money
|
29
|
+
attribute :operating_cost_net, Money
|
30
|
+
attribute :operating_cost_per_sqm, Money
|
31
|
+
|
32
|
+
# @!group Instance Method Summary
|
33
|
+
|
34
|
+
%w[purcase purcase_net
|
35
|
+
operating_cost operating_cost_net operating_cost_per_sqm
|
36
|
+
rent rent_net rent_cold rent_including_heating rent_per_sqm deposit
|
37
|
+
].each do |meth|
|
38
|
+
define_method("#{meth}=") do |amount|
|
39
|
+
log.debug("Using currency #{currency.name} for #{meth}")
|
40
|
+
instance_variable_set("@#{meth}", Monetize.parse(amount))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def on_demand?
|
45
|
+
return on_demand unless on_demand.nil?
|
46
|
+
return purcase.zero? unless purcase.nil?
|
47
|
+
return rent.zero? unless rent.nil?
|
48
|
+
true
|
49
|
+
end
|
50
|
+
|
51
|
+
def rent?
|
52
|
+
!rent.nil?
|
53
|
+
end
|
54
|
+
|
55
|
+
def purcase?
|
56
|
+
!purcase.nil?
|
57
|
+
end
|
58
|
+
|
59
|
+
def currency=(cur)
|
60
|
+
@currency = Money::Currency.new(cur)
|
61
|
+
Money.default_currency = @currency
|
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
|
+
if purcase?
|
72
|
+
(get / 100 * @commission) * 1.20
|
73
|
+
else
|
74
|
+
(get * @commission) * 1.20
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def rent_vat
|
79
|
+
rent_net / 100 * @rent_vat
|
80
|
+
end
|
81
|
+
|
82
|
+
def get
|
83
|
+
@purcase || @rent
|
84
|
+
end
|
85
|
+
|
86
|
+
def to_s
|
87
|
+
on_demand? ? "on demand" : "#{get} #{get.symbol}"
|
88
|
+
end
|
89
|
+
|
90
|
+
def inspect
|
91
|
+
"#<#{self.class} #{self}>"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
class RealtyRoomCount < JustimmoBase
|
5
|
+
# @!group Attributes
|
6
|
+
|
7
|
+
# @!macro [attach] attribute
|
8
|
+
# @return [$2]
|
9
|
+
attribute :store, Integer
|
10
|
+
attribute :bathroom, Integer
|
11
|
+
attribute :balcony_terrace, Integer
|
12
|
+
attribute :balcony, Integer
|
13
|
+
attribute :garden, Integer
|
14
|
+
attribute :garage, Integer
|
15
|
+
attribute :loggia, Integer
|
16
|
+
attribute :basement, Integer
|
17
|
+
attribute :toilet, Integer
|
18
|
+
attribute :parking_space, Integer
|
19
|
+
attribute :total, Integer
|
20
|
+
|
21
|
+
# @!group Instance Method Summary
|
22
|
+
|
23
|
+
def to_i
|
24
|
+
total
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_s
|
28
|
+
to_i.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
def inspect
|
32
|
+
"#<#{self.class} #{self}>"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module JustimmoClient::V1
|
3
|
+
class RealtyUsage < JustimmoBase
|
4
|
+
# @!group Attributes
|
5
|
+
|
6
|
+
# @!method living?
|
7
|
+
# @api private
|
8
|
+
# @return [Boolean]
|
9
|
+
|
10
|
+
# @!method business?
|
11
|
+
# @api private
|
12
|
+
# @return [Boolean]
|
13
|
+
|
14
|
+
# @!method investment?
|
15
|
+
# @api private
|
16
|
+
# @return [Boolean]
|
17
|
+
|
18
|
+
# @!macro [attach] attribute
|
19
|
+
# @return [$2]
|
20
|
+
attribute :living, Boolean
|
21
|
+
attribute :business, Boolean
|
22
|
+
attribute :investment, Boolean
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module JSON
|
5
|
+
class AttachmentImageRepresenter < JustimmoRepresenter
|
6
|
+
property :small
|
7
|
+
property :small2
|
8
|
+
property :medium
|
9
|
+
property :medium2
|
10
|
+
property :big
|
11
|
+
property :big2
|
12
|
+
property :fullhd
|
13
|
+
property :path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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 :format
|
10
|
+
property :data,
|
11
|
+
decorator: AttachmentImageRepresenter,
|
12
|
+
class: AttachmentImage
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module JSON
|
5
|
+
class ContactRepresenter < JustimmoRepresenter
|
6
|
+
property :id
|
7
|
+
property :number
|
8
|
+
property :last_name
|
9
|
+
property :first_name
|
10
|
+
property :phone
|
11
|
+
property :phone_mobile
|
12
|
+
property :salutation
|
13
|
+
property :email
|
14
|
+
property :email_feedback
|
15
|
+
property :company
|
16
|
+
property :street
|
17
|
+
property :zip_code
|
18
|
+
property :location
|
19
|
+
property :website
|
20
|
+
|
21
|
+
property :picture,
|
22
|
+
decorator: AttachmentImageRepresenter,
|
23
|
+
class: AttachmentImage
|
24
|
+
|
25
|
+
property :attachment,
|
26
|
+
decorator: AttachmentRepresenter,
|
27
|
+
class: Attachment
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module JSON
|
5
|
+
class LocationRepresenter < JustimmoRepresenter
|
6
|
+
property :zip_code
|
7
|
+
property :location
|
8
|
+
property :federal_state
|
9
|
+
property :country
|
10
|
+
property :latitude
|
11
|
+
property :longitude
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module JSON
|
5
|
+
class RealtyCategoryRepresenter < JustimmoRepresenter
|
6
|
+
property :usage, class: RealtyUsage do
|
7
|
+
property :living
|
8
|
+
property :business
|
9
|
+
property :investment
|
10
|
+
end
|
11
|
+
|
12
|
+
property :marketing, class: RealtyMarketing do
|
13
|
+
property :buy
|
14
|
+
property :rent
|
15
|
+
end
|
16
|
+
|
17
|
+
property :type_id
|
18
|
+
property :sub_type_id
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module JSON
|
5
|
+
class RealtyDetailRepresenter < JustimmoRepresenter
|
6
|
+
property :category,
|
7
|
+
decorator: RealtyCategoryRepresenter,
|
8
|
+
class: RealtyCategory
|
9
|
+
|
10
|
+
property :location,
|
11
|
+
decorator: LocationRepresenter,
|
12
|
+
class: Location
|
13
|
+
|
14
|
+
property :contact,
|
15
|
+
decorator: ContactRepresenter,
|
16
|
+
class: Contact
|
17
|
+
|
18
|
+
property :documents
|
19
|
+
property :images360
|
20
|
+
property :videos
|
21
|
+
property :links
|
22
|
+
|
23
|
+
property :title
|
24
|
+
property :description
|
25
|
+
property :description_furniture
|
26
|
+
property :furniture
|
27
|
+
|
28
|
+
property :balcony_terrace_area, as: :balkon_terrasse_flaeche
|
29
|
+
property :balcony_area, as: :balkons_flaeche
|
30
|
+
property :office_area, as: :bueroflaeche
|
31
|
+
property :garage_area, as: :garagen_flaeche
|
32
|
+
property :garden_area, as: :gartenflaeche
|
33
|
+
property :total_area, as: :gesamtflaeche
|
34
|
+
property :surface_area, as: :grundflaeche
|
35
|
+
property :property_area, as: :grundstueksflaeche
|
36
|
+
property :basement_area, as: :kellerflaeche
|
37
|
+
property :storage_area, as: :lagerflaeche
|
38
|
+
property :loggia_area, as: :loggias_flaeche
|
39
|
+
property :floor_area, as: :nutzflaeche
|
40
|
+
property :parking_area, as: :stellplatz_flaeche
|
41
|
+
property :terrace_area, as: :terrassen_flaeche
|
42
|
+
property :buildable_area, as: :verbaubare_flaeche
|
43
|
+
property :sales_area, as: :verkaufsflaeche
|
44
|
+
property :living_area, as: :wohnflaeche
|
45
|
+
property :store_rooms, as: :anzahl_abstellraum
|
46
|
+
property :bathrooms, as: :anzahl_badezimmer
|
47
|
+
property :balconies_terraces, as: :anzahl_balkon_terrassen
|
48
|
+
property :balconies, as: :anzahl_balkone
|
49
|
+
property :balconies, as: :anzahl_balkons
|
50
|
+
property :gardens, as: :anzahl_garten
|
51
|
+
property :garages, as: :anzahl_garagen
|
52
|
+
property :loggias, as: :anzahl_loggias
|
53
|
+
property :basements, as: :anzahl_keller
|
54
|
+
property :toilet_rooms, as: :anzahl_sep_wc
|
55
|
+
property :parking_spaces, as: :anzahl_stellplaetze
|
56
|
+
property :rooms, as: :anzahl_zimmer
|
57
|
+
|
58
|
+
property :available_from
|
59
|
+
property :status_id
|
60
|
+
property :id
|
61
|
+
property :number
|
62
|
+
property :openimmo_id
|
63
|
+
|
64
|
+
collection :attachments,
|
65
|
+
decorator: AttachmentRepresenter,
|
66
|
+
class: Attachment
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module XML
|
5
|
+
class CityRepresenter < JustimmoRepresenter
|
6
|
+
self.representation_wrap = :postleitzahl
|
7
|
+
|
8
|
+
property :id
|
9
|
+
property :country_id, as: :landid
|
10
|
+
property :region_id, as: :regionid
|
11
|
+
property :zip_code, as: :plz
|
12
|
+
property :location, as: :ort
|
13
|
+
property :federal_state_id, as: :bundeslandid
|
14
|
+
|
15
|
+
collection_representer class: City
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module XML
|
5
|
+
class ContactRepresenter < EmployeeRepresenter
|
6
|
+
property :email_feedback
|
7
|
+
property :email, as: :email_direkt
|
8
|
+
property :last_name, as: :name
|
9
|
+
property :company, as: :firma
|
10
|
+
property :salutation, as: :anrede
|
11
|
+
property :phone, as: :tel_zentrale
|
12
|
+
property :mobile, as: :tel_handy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module XML
|
5
|
+
class CountryRepresenter < JustimmoRepresenter
|
6
|
+
self.representation_wrap = :land
|
7
|
+
|
8
|
+
property :id
|
9
|
+
property :alpha2, as: :iso2
|
10
|
+
property :alpha3, as: :iso3
|
11
|
+
|
12
|
+
collection_representer class: Country
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module XML
|
5
|
+
class EmployeeListRepresenter < JustimmoRepresenter
|
6
|
+
nested :kategorie do
|
7
|
+
collection :employees,
|
8
|
+
as: :mitarbeiter,
|
9
|
+
wraps: :mitarbeiter,
|
10
|
+
class: Employee,
|
11
|
+
decorator: EmployeeRepresenter
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module XML
|
5
|
+
class EmployeeRepresenter < JustimmoRepresenter
|
6
|
+
property :id
|
7
|
+
property :number, as: :personennummer
|
8
|
+
property :first_name, as: :vorname
|
9
|
+
property :last_name, as: :nachname
|
10
|
+
property :salutation, as: :titel
|
11
|
+
property :position
|
12
|
+
property :phone, as: :tel
|
13
|
+
property :mobile, as: :handy
|
14
|
+
property :fax
|
15
|
+
property :email
|
16
|
+
property :street, as: :strasse
|
17
|
+
property :zip_code, as: :plz
|
18
|
+
property :location, as: :ort
|
19
|
+
property :website, as: :url
|
20
|
+
|
21
|
+
property :picture,
|
22
|
+
as: :bild,
|
23
|
+
class: Image do
|
24
|
+
%i[small medium big pfad_medium].each do |size|
|
25
|
+
property size, setter: ->(represented:, fragment:, **) { represented.add_url(fragment, default: :user_big) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# NOTE: Just contains the picture again
|
30
|
+
# Comment it out for now in case we still need it later.
|
31
|
+
#
|
32
|
+
# nested :user_defined_anyfield do
|
33
|
+
# property :attachment,
|
34
|
+
# as: :anhang,
|
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
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient::V1
|
4
|
+
module XML
|
5
|
+
class FederalStateRepresenter < JustimmoRepresenter
|
6
|
+
self.representation_wrap = :bundesland
|
7
|
+
|
8
|
+
property :id
|
9
|
+
property :name
|
10
|
+
property :country_id, as: :landid
|
11
|
+
property :fips, as: :fipscode
|
12
|
+
property :iso, as: :iso31662code
|
13
|
+
|
14
|
+
collection_representer class: FederalState
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|