justimmo_client 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6928830a5a023c1cf09735024ca26b23fab285fc
|
4
|
+
data.tar.gz: acf43eca7ca6a680dc7b6dab59b397ab77ae4b8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90718990f0e62c1f973a6037f34ec881d7644d7507669daa430ee6c34cc720d014ec9cf452082d467bbd2e8aa022529f349516f018f70ef8bdbf4b81d9ddecac
|
7
|
+
data.tar.gz: d2f9f2076d83e6a3372dbbe5b9d7532c2a59548f4c532f0d4df2d2ad1341cafe4697bd0466b90db6b50034b10d5dabea254298a407de276cfe86bb6ff7caddf7
|
@@ -36,7 +36,7 @@ module JustimmoClient::V1
|
|
36
36
|
rent rent_net rent_cold rent_including_heating rent_per_sqm deposit
|
37
37
|
].each do |meth|
|
38
38
|
define_method("#{meth}=") do |amount|
|
39
|
-
|
39
|
+
log.debug("Using currency #{currency&.name} for #{meth}")
|
40
40
|
instance_variable_set("@#{meth}", Monetize.parse(amount))
|
41
41
|
end
|
42
42
|
end
|
@@ -57,9 +57,8 @@ module JustimmoClient::V1
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def currency=(cur)
|
60
|
-
|
61
|
-
@currency
|
62
|
-
Money.default_currency = @currency
|
60
|
+
@currency = Money::Currency.new(cur) unless cur.nil?
|
61
|
+
Money.default_currency = @currency || :eur
|
63
62
|
log.debug("Set currency to #{currency.name}")
|
64
63
|
end
|
65
64
|
|
@@ -79,7 +78,7 @@ module JustimmoClient::V1
|
|
79
78
|
end
|
80
79
|
|
81
80
|
def rent_vat
|
82
|
-
return nil unless rent? && rent_net
|
81
|
+
return nil unless rent? && rent_net && @rent_vat
|
83
82
|
rent_net / 100 * @rent_vat
|
84
83
|
end
|
85
84
|
|
@@ -95,6 +94,10 @@ module JustimmoClient::V1
|
|
95
94
|
on_demand? ? "on demand" : get.format
|
96
95
|
end
|
97
96
|
|
97
|
+
def as_json
|
98
|
+
@attributes.to_s
|
99
|
+
end
|
100
|
+
|
98
101
|
def inspect
|
99
102
|
"#<#{self.class} #{self}>"
|
100
103
|
end
|
@@ -1,30 +1,42 @@
|
|
1
1
|
module JustimmoClient::V1
|
2
2
|
module JSON
|
3
3
|
class RealtyPriceRepresenter < JustimmoRepresenter
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
%i[
|
5
|
+
purcase
|
6
|
+
purcase_net
|
7
|
+
rent
|
8
|
+
rent_net
|
9
|
+
rent_cold
|
10
|
+
rent_including_heating
|
11
|
+
deposit
|
12
|
+
rent_per_sqm
|
13
|
+
operating_cost
|
14
|
+
operating_cost_net
|
15
|
+
operating_cost_per_sqm
|
16
|
+
].each do |k|
|
17
|
+
property k,
|
18
|
+
setter: ->(represented:, fragment:, **) { represented.public_send("#{k}=", fragment) },
|
19
|
+
getter: ->(represented:, **) { represented.public_send(k)&.to_f }
|
20
|
+
end
|
21
|
+
|
22
|
+
property :currency,
|
23
|
+
setter: ->(represented:, fragment:, **) { represented.currency = fragment },
|
24
|
+
getter: ->(represented:, **) { represented.currency&.id }
|
8
25
|
|
9
|
-
property :
|
10
|
-
|
11
|
-
|
26
|
+
property :commission,
|
27
|
+
setter: ->(represented:, fragment:, **) { represented.commission = fragment },
|
28
|
+
getter: ->(represented:, **) { represented.instance_variable_get(:@commission) }
|
12
29
|
|
13
|
-
property :
|
14
|
-
|
15
|
-
|
16
|
-
property :rent_per_sqm
|
17
|
-
property :operating_cost_per_sqm
|
30
|
+
property :rent_vat,
|
31
|
+
setter: ->(represented:, fragment:, **) { represented.rent_vat = fragment },
|
32
|
+
getter: ->(represented:, **) { represented.instance_variable_get(:@rent_vat) }
|
18
33
|
|
19
34
|
property :provision
|
20
35
|
property :including_vat
|
21
|
-
property :
|
36
|
+
property :on_demand
|
22
37
|
|
23
38
|
property :real_estate_taxes
|
24
39
|
property :land_registry
|
25
|
-
|
26
|
-
property :operating_cost
|
27
|
-
property :operating_cost_net
|
28
40
|
property :operating_cost_vat
|
29
41
|
end
|
30
42
|
end
|