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
@@ -10,6 +10,7 @@ module JustimmoClient
|
|
10
10
|
autoload :Config, "justimmo_client/core/config"
|
11
11
|
autoload :Logging, "justimmo_client/core/logging"
|
12
12
|
autoload :Utils, "justimmo_client/core/utils"
|
13
|
+
autoload :API, "justimmo_client/core/api_helpers"
|
13
14
|
autoload :Caching, "justimmo_client/core/caching"
|
14
15
|
autoload :OptionParser, "justimmo_client/option_parser"
|
15
16
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JustimmoClient
|
4
|
+
module API
|
5
|
+
def versioned_api(*name)
|
6
|
+
(["JustimmoClient::V#{JustimmoClient::Config.api_ver}"] + name).join("::").constantize
|
7
|
+
end
|
8
|
+
|
9
|
+
def api(name)
|
10
|
+
"JustimmoClient::#{name.to_s.classify}".constantize
|
11
|
+
end
|
12
|
+
|
13
|
+
def representer(name, type = :xml)
|
14
|
+
versioned_api(type.to_s.classify, "#{name.to_s.classify}Representer")
|
15
|
+
end
|
16
|
+
|
17
|
+
def model(name)
|
18
|
+
versioned_api(name.to_s.classify)
|
19
|
+
end
|
20
|
+
|
21
|
+
def request(name)
|
22
|
+
versioned_api("#{name.to_s.classify}Request")
|
23
|
+
end
|
24
|
+
|
25
|
+
def interface(name)
|
26
|
+
versioned_api("#{name.to_s.classify}Interface")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require "base64"
|
4
4
|
require "active_support/configurable"
|
5
5
|
require "justimmo_client/errors"
|
6
|
+
require "money"
|
6
7
|
|
7
8
|
module JustimmoClient
|
8
9
|
# Configuration options storage
|
@@ -23,6 +24,7 @@ module JustimmoClient
|
|
23
24
|
config_accessor(:cache) { nil }
|
24
25
|
config_accessor(:request_retries) { 3 }
|
25
26
|
config_accessor(:proxy) { ENV.fetch("JUSTIMMO_PROXY", nil) }
|
27
|
+
config_accessor(:default_currency) { ::Money.default_currency = ::Money::Currency.new(:eur) }
|
26
28
|
|
27
29
|
class << self
|
28
30
|
def configure
|
@@ -41,8 +43,12 @@ module JustimmoClient
|
|
41
43
|
raise JustimmoClient::UnsupportedAPIVersion, api_ver unless supported_ver
|
42
44
|
end
|
43
45
|
|
44
|
-
def
|
46
|
+
def credentials
|
45
47
|
validate_credentials
|
48
|
+
@_config[:credentials]
|
49
|
+
end
|
50
|
+
|
51
|
+
def url
|
46
52
|
return "#{base_url}/v#{api_ver}" if self.base_url.start_with?("http")
|
47
53
|
"#{secure ? 'https' : 'http'}://#{base_url}/v#{api_ver}"
|
48
54
|
end
|
@@ -15,34 +15,10 @@ module JustimmoClient
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def versioned_api(*name)
|
19
|
-
(["JustimmoClient::V#{JustimmoClient::Config.api_ver}"] + name).join("::").constantize
|
20
|
-
end
|
21
|
-
|
22
|
-
def api(name)
|
23
|
-
"JustimmoClient::#{name.to_s.classify}".constantize
|
24
|
-
end
|
25
|
-
|
26
|
-
def representer(name, type = :xml)
|
27
|
-
versioned_api(type.to_s.classify, "#{name.to_s.classify}Representer")
|
28
|
-
end
|
29
|
-
|
30
|
-
def model(name)
|
31
|
-
versioned_api(name.to_s.classify)
|
32
|
-
end
|
33
|
-
|
34
|
-
def request(name)
|
35
|
-
versioned_api("#{name.to_s.classify}Request")
|
36
|
-
end
|
37
|
-
|
38
|
-
def interface(name)
|
39
|
-
versioned_api("#{name.to_s.classify}Interface")
|
40
|
-
end
|
41
|
-
|
42
18
|
def translate(text)
|
43
19
|
I18n.translate("justimmo_client.#{text}", raise: true)
|
44
20
|
rescue I18n::MissingTranslationData
|
45
|
-
text.split(".").last.
|
21
|
+
text.split(".").last.titleize
|
46
22
|
end
|
47
23
|
end
|
48
24
|
end
|
data/locales/de.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: justimmo_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Auernig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- ".gitlab-ci.yml"
|
196
196
|
- ".rspec"
|
197
197
|
- ".rubocop.yml"
|
198
|
+
- ".simplecov"
|
198
199
|
- Gemfile
|
199
200
|
- LICENSE
|
200
201
|
- README.md
|
@@ -208,17 +209,17 @@ files:
|
|
208
209
|
- lib/justimmo_client/api/v1/interfaces/employee_interface.rb
|
209
210
|
- lib/justimmo_client/api/v1/interfaces/justimmo_interface.rb
|
210
211
|
- lib/justimmo_client/api/v1/interfaces/realty_interface.rb
|
212
|
+
- lib/justimmo_client/api/v1/models/attachment.rb
|
211
213
|
- lib/justimmo_client/api/v1/models/city.rb
|
212
214
|
- lib/justimmo_client/api/v1/models/country.rb
|
213
215
|
- lib/justimmo_client/api/v1/models/employee.rb
|
214
216
|
- lib/justimmo_client/api/v1/models/federal_state.rb
|
215
|
-
- lib/justimmo_client/api/v1/models/file.rb
|
216
217
|
- lib/justimmo_client/api/v1/models/geo_location.rb
|
217
|
-
- lib/justimmo_client/api/v1/models/image.rb
|
218
218
|
- lib/justimmo_client/api/v1/models/justimmo_base.rb
|
219
219
|
- lib/justimmo_client/api/v1/models/realty.rb
|
220
220
|
- lib/justimmo_client/api/v1/models/realty_area.rb
|
221
221
|
- lib/justimmo_client/api/v1/models/realty_category.rb
|
222
|
+
- lib/justimmo_client/api/v1/models/realty_cost.rb
|
222
223
|
- lib/justimmo_client/api/v1/models/realty_marketing.rb
|
223
224
|
- lib/justimmo_client/api/v1/models/realty_price.rb
|
224
225
|
- lib/justimmo_client/api/v1/models/realty_room_count.rb
|
@@ -226,42 +227,35 @@ files:
|
|
226
227
|
- lib/justimmo_client/api/v1/models/realty_usage.rb
|
227
228
|
- lib/justimmo_client/api/v1/models/region.rb
|
228
229
|
- lib/justimmo_client/api/v1/representers/json.rb
|
230
|
+
- lib/justimmo_client/api/v1/representers/json/attachment_representer.rb
|
229
231
|
- lib/justimmo_client/api/v1/representers/json/city_representer.rb
|
230
|
-
- lib/justimmo_client/api/v1/representers/json/contact_representer.rb
|
231
232
|
- lib/justimmo_client/api/v1/representers/json/country_representer.rb
|
232
233
|
- lib/justimmo_client/api/v1/representers/json/employee_representer.rb
|
233
234
|
- lib/justimmo_client/api/v1/representers/json/federal_state_representer.rb
|
234
|
-
- lib/justimmo_client/api/v1/representers/json/geo_location_representer.rb
|
235
235
|
- lib/justimmo_client/api/v1/representers/json/justimmo_representer.rb
|
236
|
-
- lib/justimmo_client/api/v1/representers/json/realty_area_representer.rb
|
237
236
|
- lib/justimmo_client/api/v1/representers/json/realty_category_representer.rb
|
238
|
-
- lib/justimmo_client/api/v1/representers/json/realty_price_representer.rb
|
239
237
|
- lib/justimmo_client/api/v1/representers/json/realty_representer.rb
|
240
|
-
- lib/justimmo_client/api/v1/representers/json/realty_room_count_representer.rb
|
241
238
|
- lib/justimmo_client/api/v1/representers/json/realty_type_representer.rb
|
242
239
|
- lib/justimmo_client/api/v1/representers/json/region_representer.rb
|
243
240
|
- lib/justimmo_client/api/v1/representers/xml.rb
|
241
|
+
- lib/justimmo_client/api/v1/representers/xml/attachment_representer.rb
|
244
242
|
- lib/justimmo_client/api/v1/representers/xml/city_representer.rb
|
245
|
-
- lib/justimmo_client/api/v1/representers/xml/contact_representer.rb
|
246
243
|
- lib/justimmo_client/api/v1/representers/xml/country_representer.rb
|
247
244
|
- lib/justimmo_client/api/v1/representers/xml/employee_list_representer.rb
|
248
245
|
- lib/justimmo_client/api/v1/representers/xml/employee_representer.rb
|
249
246
|
- lib/justimmo_client/api/v1/representers/xml/federal_state_representer.rb
|
250
247
|
- lib/justimmo_client/api/v1/representers/xml/geo_location_representer.rb
|
251
248
|
- lib/justimmo_client/api/v1/representers/xml/justimmo_representer.rb
|
252
|
-
- lib/justimmo_client/api/v1/representers/xml/realty_area_representer.rb
|
253
249
|
- lib/justimmo_client/api/v1/representers/xml/realty_category_representer.rb
|
254
|
-
- lib/justimmo_client/api/v1/representers/xml/realty_detail_representer.rb
|
255
|
-
- lib/justimmo_client/api/v1/representers/xml/realty_list_representer.rb
|
256
250
|
- lib/justimmo_client/api/v1/representers/xml/realty_price_representer.rb
|
257
251
|
- lib/justimmo_client/api/v1/representers/xml/realty_representer.rb
|
258
|
-
- lib/justimmo_client/api/v1/representers/xml/realty_room_count_representer.rb
|
259
252
|
- lib/justimmo_client/api/v1/representers/xml/realty_type_representer.rb
|
260
253
|
- lib/justimmo_client/api/v1/representers/xml/region_representer.rb
|
261
254
|
- lib/justimmo_client/api/v1/requests/employee_request.rb
|
262
255
|
- lib/justimmo_client/api/v1/requests/justimmo_request.rb
|
263
256
|
- lib/justimmo_client/api/v1/requests/realty_request.rb
|
264
257
|
- lib/justimmo_client/autoload.rb
|
258
|
+
- lib/justimmo_client/core/api_helpers.rb
|
265
259
|
- lib/justimmo_client/core/caching.rb
|
266
260
|
- lib/justimmo_client/core/config.rb
|
267
261
|
- lib/justimmo_client/core/logging.rb
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JustimmoClient::V1
|
4
|
-
class File < JustimmoBase
|
5
|
-
BASE_URL = "https://files.justimmo.at/public"
|
6
|
-
|
7
|
-
# @!group Attributes
|
8
|
-
|
9
|
-
# @!macro [attach] attribute
|
10
|
-
# @return [$2]
|
11
|
-
attribute :title, String
|
12
|
-
attribute :category, Symbol
|
13
|
-
attribute :origin, Symbol
|
14
|
-
attribute :type, Symbol
|
15
|
-
attribute :name, String
|
16
|
-
attribute :format, String
|
17
|
-
|
18
|
-
# @!group Instance Method Summary
|
19
|
-
|
20
|
-
def initialize(**options)
|
21
|
-
super(options)
|
22
|
-
@settings = []
|
23
|
-
end
|
24
|
-
|
25
|
-
def category=(cat)
|
26
|
-
@category =
|
27
|
-
case cat
|
28
|
-
when "BILD" then :image
|
29
|
-
when "TITELBILD" then :title_image
|
30
|
-
else nil
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def origin=(orig)
|
35
|
-
@origin = orig&.downcase&.to_sym
|
36
|
-
end
|
37
|
-
|
38
|
-
def get(setting = nil)
|
39
|
-
return nil if @default.nil? || @settings.empty?
|
40
|
-
setting = (@settings.include?(setting) ? setting : @default)
|
41
|
-
"#{BASE_URL}/#{@type}/#{setting}/#{@name}"
|
42
|
-
end
|
43
|
-
|
44
|
-
alias [] get
|
45
|
-
|
46
|
-
def add_url(url, default: nil)
|
47
|
-
uri_path = URI.parse(url).path
|
48
|
-
@name ||= ::File.basename(uri_path)
|
49
|
-
@format ||= ::File.extname(@name)
|
50
|
-
@settings << ::URI.parse(url).path.split("/")[-2].to_sym
|
51
|
-
@default = default || @settings.last
|
52
|
-
end
|
53
|
-
|
54
|
-
alias path= add_url
|
55
|
-
|
56
|
-
def to_s
|
57
|
-
get
|
58
|
-
end
|
59
|
-
|
60
|
-
def inspect
|
61
|
-
"#<#{self.class} #{self}>"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JustimmoClient::V1
|
4
|
-
module JSON
|
5
|
-
class ContactRepresenter < EmployeeRepresenter
|
6
|
-
property :email_feedback
|
7
|
-
property :email
|
8
|
-
property :last_name
|
9
|
-
property :company
|
10
|
-
property :salutation
|
11
|
-
property :phone
|
12
|
-
property :mobile
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JustimmoClient::V1
|
4
|
-
module JSON
|
5
|
-
class GeoLocationRepresenter < JustimmoRepresenter
|
6
|
-
property :zip_code
|
7
|
-
property :location
|
8
|
-
property :federal_state
|
9
|
-
property :floor
|
10
|
-
property :country
|
11
|
-
property :latitude
|
12
|
-
property :longitude
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JustimmoClient::V1
|
4
|
-
module JSON
|
5
|
-
class RealtyAreaRepresenter < JustimmoRepresenter
|
6
|
-
%i[
|
7
|
-
balcony_terrace
|
8
|
-
balcony
|
9
|
-
office
|
10
|
-
garage
|
11
|
-
garden
|
12
|
-
total
|
13
|
-
surface
|
14
|
-
property
|
15
|
-
basement
|
16
|
-
storage
|
17
|
-
loggia
|
18
|
-
floor
|
19
|
-
parking
|
20
|
-
terrace
|
21
|
-
buildable
|
22
|
-
sales
|
23
|
-
living
|
24
|
-
].each { |k| property k }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module JustimmoClient::V1
|
2
|
-
module JSON
|
3
|
-
class RealtyPriceRepresenter < JustimmoRepresenter
|
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 }
|
25
|
-
|
26
|
-
property :commission,
|
27
|
-
setter: ->(represented:, fragment:, **) { represented.commission = fragment },
|
28
|
-
getter: ->(represented:, **) { represented.instance_variable_get(:@commission) }
|
29
|
-
|
30
|
-
property :rent_vat,
|
31
|
-
setter: ->(represented:, fragment:, **) { represented.rent_vat = fragment },
|
32
|
-
getter: ->(represented:, **) { represented.instance_variable_get(:@rent_vat) }
|
33
|
-
|
34
|
-
property :provision
|
35
|
-
property :including_vat
|
36
|
-
property :on_demand
|
37
|
-
|
38
|
-
property :real_estate_taxes
|
39
|
-
property :land_registry
|
40
|
-
property :operating_cost_vat
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module JustimmoClient::V1
|
4
|
-
module JSON
|
5
|
-
class RealtyRoomCountRepresenter < JustimmoRepresenter
|
6
|
-
%i[
|
7
|
-
store
|
8
|
-
bathroom
|
9
|
-
balcony_terrace
|
10
|
-
balcony
|
11
|
-
garden
|
12
|
-
garage
|
13
|
-
loggia
|
14
|
-
basement
|
15
|
-
toilet
|
16
|
-
parking_space
|
17
|
-
total
|
18
|
-
].each { |k| property k }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,15 +0,0 @@
|
|
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
|