justimmo_client 0.6.0 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1111c8bd67a8a48f624bc368fe44db21199b6e1a
4
- data.tar.gz: 6d8c62a4cc9e2373ae2ff999b446027ed05998b4
3
+ metadata.gz: 28c8c5889fc30bf130af4e4f14fe53c147d7252c
4
+ data.tar.gz: 269cdbff8ecd55635a8fe62efdb6f47c6b31c909
5
5
  SHA512:
6
- metadata.gz: 66da6c40804b2acdf9580898fdeccec4dcc0fc04ef4c1b5829754748a8f12d05126609981c1ccd61ad835187eb7e1f1d4a6d945289f284de6c52994e9eddef55
7
- data.tar.gz: 19f6be67d186e5e7a4dd3ec56854f6556669624beb53bdb23b9e16cf8ce5745de506c61035d4efc2b6cdf9c5c3b8f6e04f8edfcdf1db0b1fdfb7630e3e29163f
6
+ metadata.gz: 48aaa4888d18ee373a7b51ea8825abc7dc552b8235f9b0b729bed68a515c28455022893e56c268c8849409394db2633fd379e31de39eaebea654ec29fe30e01d
7
+ data.tar.gz: 90e74ba04d557e458be70c10861ecbe15a0079a0ce72c5029d9f9e43aa9cb39693aeb2ab4f1fa6a21cc17df9462d9f95395e408adb8d4a81d845e1f6f6ca55d3
data/bin/console CHANGED
@@ -3,6 +3,7 @@
3
3
  require "bundler/setup"
4
4
  require "justimmo_client"
5
5
  require "dotenv"
6
+ require "active_support"
6
7
 
7
8
  Dotenv.load
8
9
 
@@ -10,6 +11,7 @@ JustimmoClient.configure do |config|
10
11
  config.username = ENV['JUSTIMMO_USERNAME']
11
12
  config.password = ENV['JUSTIMMO_PASSWORD']
12
13
  config.debug = ENV['DEBUG']
14
+ config.cache = ActiveSupport::Cache.lookup_store(:memory_store) if ENV['DEV_CACHING']
13
15
  end
14
16
 
15
17
  begin
@@ -67,7 +67,7 @@ module JustimmoClient::V1
67
67
  model = Struct.new(:realties).new
68
68
  xml_response = request(:realty).list(options)
69
69
  represented = representer(:realty_list).new(model).from_xml(xml_response).realties
70
- new_cache = representer(:realty, :json).for_collection.new(realties).to_json
70
+ new_cache = representer(:realty, :json).for_collection.new(represented).to_json
71
71
  [represented, new_cache]
72
72
  end
73
73
  rescue JustimmoClient::RetrievalFailed
@@ -78,15 +78,15 @@ module JustimmoClient::V1
78
78
  # @param [Symbol, String] lang
79
79
  # @return [Realty, nil] A detailed realty object, or nil if it could not be found.
80
80
  def detail(id, lang: nil)
81
- with_cache cache_key("realty/detail", options),
81
+ with_cache cache_key("realty/detail", lang: lang),
82
82
  on_hit: ->(cached) do
83
- representer(:realty, :json).new(model(:realty)).from_json(cached)
83
+ representer(:realty, :json).new(model(:realty).new).from_json(cached)
84
84
  end,
85
85
  on_miss: -> do
86
86
  xml_response = request(:realty).detail(id, lang: lang)
87
87
  model = Struct.new(:realty).new
88
88
  represented = representer(:realty_detail).new(model).from_xml(xml_response).realty
89
- new_cache = representer(:realty, :json).new(realty).to_json
89
+ new_cache = representer(:realty, :json).new(represented).to_json
90
90
  [represented, new_cache]
91
91
  end
92
92
  rescue JustimmoClient::RetrievalFailed
@@ -8,5 +8,13 @@ module JustimmoClient::V1
8
8
  # @return [$2]
9
9
  attribute :id, Integer
10
10
  attribute :name, Symbol
11
+
12
+ def translated
13
+ translate("types.#{@name}")
14
+ end
15
+
16
+ def to_s
17
+ translated
18
+ end
11
19
  end
12
20
  end
@@ -40,7 +40,9 @@ module JustimmoClient
40
40
  end
41
41
 
42
42
  def translate(text)
43
- I18n.translate("justimmo_client.#{text}")
43
+ I18n.translate("justimmo_client.#{text}", raise: true)
44
+ rescue I18n::MissingTranslationData
45
+ text.split(".").last.capitalize
44
46
  end
45
47
  end
46
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JustimmoClient
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
data/locales/de.yml CHANGED
@@ -5,3 +5,18 @@ de:
5
5
  living: Wohnen
6
6
  business: Gewerbe
7
7
  investment: Anlage
8
+
9
+ types:
10
+ room: Zimmer
11
+ apartment: Wohnung
12
+ house: Haus
13
+ property: Grundstück
14
+ office: Büro / Praxis
15
+ retail: Einzelhandel
16
+ hospitality: Gastgewerbe
17
+ business: Industrie / Gewerbe
18
+ agriculture: Land und Forstwirtschaft
19
+ other: Sonstige / Sonderobjekte
20
+ recreational_property_business: Freizeitimmobilie gewerblich
21
+ yield: Zinshaus / Renditeobjekt
22
+ parking: Parken
data/locales/en.yml CHANGED
@@ -1,7 +1,3 @@
1
1
  en:
2
2
  justimmo_client:
3
- buy: buy
4
- rent: rent
5
- living: living
6
- business: business
7
- investment: investment
3
+ # automatically translated
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: justimmo_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Auernig