justimmo_client 0.4.4 → 0.4.5
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/lib/justimmo_client/api/v1/models/employee.rb +4 -0
 - data/lib/justimmo_client/api/v1/models/geo_location.rb +1 -1
 - data/lib/justimmo_client/api/v1/models/realty.rb +1 -0
 - data/lib/justimmo_client/api/v1/models/realty_price.rb +8 -1
 - data/lib/justimmo_client/api/v1/models/realty_type.rb +1 -1
 - data/lib/justimmo_client/api/v1/models/realty_usage.rb +18 -0
 - data/lib/justimmo_client/api/v1/representers/xml/realty_detail_representer.rb +4 -0
 - data/lib/justimmo_client/api/v1/representers/xml/realty_type_representer.rb +18 -1
 - data/lib/justimmo_client/api/v1/requests/realty_request.rb +12 -5
 - data/lib/justimmo_client/option_parser.rb +7 -3
 - data/lib/justimmo_client/realty.rb +2 -1
 - data/lib/justimmo_client/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 862c14b5638385085dd28a49b7516615bad161cb
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f9a71e5c7282b4e935faa15afc6f4756d7842d1d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 87d97beb7c5aff8c95bdb2e85c4726e7586e22c85665cdd9dcd9d18dd2e6a701af4180d261b88a6e180d13de80be2bb04517bdcefe7cdf57227915b708bd8f1f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d443e4e059747c07a2266ea72087fa2691d2e6c3b854e158f82c3441a664ae240fade67435444019b013a9776ed7e6018bd03d8cf2cb7c919b6fe633d683b0b9
         
     | 
| 
         @@ -10,7 +10,7 @@ module JustimmoClient::V1 
     | 
|
| 
       10 
10 
     | 
    
         
             
                #   @return [$2]
         
     | 
| 
       11 
11 
     | 
    
         
             
                attribute :proximity,     String
         
     | 
| 
       12 
12 
     | 
    
         
             
                attribute :federal_state, String
         
     | 
| 
       13 
     | 
    
         
            -
                attribute :country,        
     | 
| 
      
 13 
     | 
    
         
            +
                attribute :country,       IsoCountryCodes::Code
         
     | 
| 
       14 
14 
     | 
    
         
             
                attribute :zip_code,      Integer
         
     | 
| 
       15 
15 
     | 
    
         
             
                attribute :latitude,      Float
         
     | 
| 
       16 
16 
     | 
    
         
             
                attribute :longitude,     Float
         
     | 
| 
         @@ -68,6 +68,8 @@ module JustimmoClient::V1 
     | 
|
| 
       68 
68 
     | 
    
         
             
                end
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
                def commission
         
     | 
| 
      
 71 
     | 
    
         
            +
                  return nil unless @commission
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
       71 
73 
     | 
    
         
             
                  if purcase?
         
     | 
| 
       72 
74 
     | 
    
         
             
                    (get / 100 * @commission) * 1.20
         
     | 
| 
       73 
75 
     | 
    
         
             
                  else
         
     | 
| 
         @@ -76,6 +78,7 @@ module JustimmoClient::V1 
     | 
|
| 
       76 
78 
     | 
    
         
             
                end
         
     | 
| 
       77 
79 
     | 
    
         | 
| 
       78 
80 
     | 
    
         
             
                def rent_vat
         
     | 
| 
      
 81 
     | 
    
         
            +
                  return nil unless rent? && rent_net
         
     | 
| 
       79 
82 
     | 
    
         
             
                  rent_net / 100 * @rent_vat
         
     | 
| 
       80 
83 
     | 
    
         
             
                end
         
     | 
| 
       81 
84 
     | 
    
         | 
| 
         @@ -83,8 +86,12 @@ module JustimmoClient::V1 
     | 
|
| 
       83 
86 
     | 
    
         
             
                  @purcase || @rent
         
     | 
| 
       84 
87 
     | 
    
         
             
                end
         
     | 
| 
       85 
88 
     | 
    
         | 
| 
      
 89 
     | 
    
         
            +
                def to_f
         
     | 
| 
      
 90 
     | 
    
         
            +
                  get.to_f
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       86 
93 
     | 
    
         
             
                def to_s
         
     | 
| 
       87 
     | 
    
         
            -
                  on_demand? ? "on demand" :  
     | 
| 
      
 94 
     | 
    
         
            +
                  on_demand? ? "on demand" : get.format
         
     | 
| 
       88 
95 
     | 
    
         
             
                end
         
     | 
| 
       89 
96 
     | 
    
         | 
| 
       90 
97 
     | 
    
         
             
                def inspect
         
     | 
| 
         @@ -20,5 +20,23 @@ module JustimmoClient::V1 
     | 
|
| 
       20 
20 
     | 
    
         
             
                attribute :living,     Boolean
         
     | 
| 
       21 
21 
     | 
    
         
             
                attribute :business,   Boolean
         
     | 
| 
       22 
22 
     | 
    
         
             
                attribute :investment, Boolean
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                # @!group Instance Method Summary
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def to_a
         
     | 
| 
      
 27 
     | 
    
         
            +
                  tmp = []
         
     | 
| 
      
 28 
     | 
    
         
            +
                  tmp << :living if living?
         
     | 
| 
      
 29 
     | 
    
         
            +
                  tmp << :business if business?
         
     | 
| 
      
 30 
     | 
    
         
            +
                  tmp << :investment if investment?
         
     | 
| 
      
 31 
     | 
    
         
            +
                  tmp
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                def to_s
         
     | 
| 
      
 35 
     | 
    
         
            +
                  to_a.join(", ")
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                def map(&block)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  to_a.map(&block)
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
       23 
41 
     | 
    
         
             
              end
         
     | 
| 
       24 
42 
     | 
    
         
             
            end
         
     | 
| 
         @@ -20,6 +20,10 @@ module JustimmoClient::V1 
     | 
|
| 
       20 
20 
     | 
    
         
             
                      parse_filter: ->(_fragment, options) { options[:doc].css("user_defined_simplefield[feldname=aktualisiert_am]").text }
         
     | 
| 
       21 
21 
     | 
    
         
             
                  end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
      
 23 
     | 
    
         
            +
                  nested :zustand_angaben do
         
     | 
| 
      
 24 
     | 
    
         
            +
                    property :construction_year, as: :baujahr
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       23 
27 
     | 
    
         
             
                  property :geo,
         
     | 
| 
       24 
28 
     | 
    
         
             
                    decorator: GeoLocationRepresenter,
         
     | 
| 
       25 
29 
     | 
    
         
             
                    class: GeoLocation
         
     | 
| 
         @@ -5,8 +5,25 @@ module JustimmoClient::V1 
     | 
|
| 
       5 
5 
     | 
    
         
             
                class RealtyTypeRepresenter < JustimmoRepresenter
         
     | 
| 
       6 
6 
     | 
    
         
             
                  self.representation_wrap = :objektart
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
      
 8 
     | 
    
         
            +
                  TRANSLATION_MAPPING = {
         
     | 
| 
      
 9 
     | 
    
         
            +
                    "Zimmer" => :room,
         
     | 
| 
      
 10 
     | 
    
         
            +
                    "Wohnung" => :apartment,
         
     | 
| 
      
 11 
     | 
    
         
            +
                    "Haus" => :house,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    "Grundstück" => :property,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    "Büro / Praxis" => :office,
         
     | 
| 
      
 14 
     | 
    
         
            +
                    "Einzelhandel" => :retail,
         
     | 
| 
      
 15 
     | 
    
         
            +
                    "Gastgewerbe" => :hospitality,
         
     | 
| 
      
 16 
     | 
    
         
            +
                    "Industrie / Gewerbe" => :business,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    "Land und Forstwirtschaft" => :agriculture,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    "Sonstige / Sonderobjekte" => :other,
         
     | 
| 
      
 19 
     | 
    
         
            +
                    "Freizeitimmobilie gewerblich" => :recreational_property_business,
         
     | 
| 
      
 20 
     | 
    
         
            +
                    "Zinshaus / Renditeobjekt" => :yield,
         
     | 
| 
      
 21 
     | 
    
         
            +
                    "Parken" => :parking
         
     | 
| 
      
 22 
     | 
    
         
            +
                  }.freeze
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       8 
24 
     | 
    
         
             
                  property :id
         
     | 
| 
       9 
     | 
    
         
            -
                  property :name
         
     | 
| 
      
 25 
     | 
    
         
            +
                  property :name,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    parse_filter: ->(fragment, **) { TRANSLATION_MAPPING[fragment] }
         
     | 
| 
       10 
27 
     | 
    
         | 
| 
       11 
28 
     | 
    
         
             
                  collection_representer class: RealtyType
         
     | 
| 
       12 
29 
     | 
    
         
             
                end
         
     | 
| 
         @@ -15,8 +15,6 @@ module JustimmoClient::V1 
     | 
|
| 
       15 
15 
     | 
    
         
             
                  price: :preis,
         
     | 
| 
       16 
16 
     | 
    
         
             
                  zip_code: :plz,
         
     | 
| 
       17 
17 
     | 
    
         
             
                  price_per_sqm: :preis_per_m2,
         
     | 
| 
       18 
     | 
    
         
            -
                  type: :objektart,
         
     | 
| 
       19 
     | 
    
         
            -
                  subtype: :subobjektart,
         
     | 
| 
       20 
18 
     | 
    
         
             
                  tag: :tagname,
         
     | 
| 
       21 
19 
     | 
    
         
             
                  rooms: :zimmer,
         
     | 
| 
       22 
20 
     | 
    
         
             
                  area: :flaeche,
         
     | 
| 
         @@ -38,7 +36,10 @@ module JustimmoClient::V1 
     | 
|
| 
       38 
36 
     | 
    
         
             
                  location: :ort,
         
     | 
| 
       39 
37 
     | 
    
         
             
                  all: :alle,
         
     | 
| 
       40 
38 
     | 
    
         
             
                  rent: :miete,
         
     | 
| 
       41 
     | 
    
         
            -
                  purcase: :kauf
         
     | 
| 
      
 39 
     | 
    
         
            +
                  purcase: :kauf,
         
     | 
| 
      
 40 
     | 
    
         
            +
                  type: :objektart,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  sub_type: :subobjektart,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  system_type: :realty_type
         
     | 
| 
       42 
43 
     | 
    
         
             
                }.freeze
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
       44 
45 
     | 
    
         
             
                module_function
         
     | 
| 
         @@ -172,7 +173,13 @@ module JustimmoClient::V1 
     | 
|
| 
       172 
173 
     | 
    
         
             
                      f.add :price_per_sqm_min
         
     | 
| 
       173 
174 
     | 
    
         
             
                      f.add :price_per_sqm_max
         
     | 
| 
       174 
175 
     | 
    
         
             
                      f.add :type_id
         
     | 
| 
       175 
     | 
    
         
            -
                      f.add : 
     | 
| 
      
 176 
     | 
    
         
            +
                      f.add :type do |key, *values|
         
     | 
| 
      
 177 
     | 
    
         
            +
                        values = [values].flatten.map(&:to_sym)
         
     | 
| 
      
 178 
     | 
    
         
            +
                        log.debug(values)
         
     | 
| 
      
 179 
     | 
    
         
            +
                        types = JustimmoClient::Realty.types
         
     | 
| 
      
 180 
     | 
    
         
            +
                        [:type_id, types.select { |x| values.include?(x.name) }.map(&:id)]
         
     | 
| 
      
 181 
     | 
    
         
            +
                      end
         
     | 
| 
      
 182 
     | 
    
         
            +
                      f.add :sub_type_id
         
     | 
| 
       176 
183 
     | 
    
         
             
                      f.add :tag
         
     | 
| 
       177 
184 
     | 
    
         
             
                      f.add :zip_code
         
     | 
| 
       178 
185 
     | 
    
         
             
                      f.add :zip_code_min
         
     | 
| 
         @@ -195,7 +202,7 @@ module JustimmoClient::V1 
     | 
|
| 
       195 
202 
     | 
    
         
             
                      f.add :federal_state_id
         
     | 
| 
       196 
203 
     | 
    
         
             
                      f.add :status_id
         
     | 
| 
       197 
204 
     | 
    
         
             
                      f.add :project_id
         
     | 
| 
       198 
     | 
    
         
            -
                      f.add : 
     | 
| 
      
 205 
     | 
    
         
            +
                      f.add :system_type
         
     | 
| 
       199 
206 
     | 
    
         
             
                      f.add :parent_id
         
     | 
| 
       200 
207 
     | 
    
         
             
                      f.add :rent, type: :bool
         
     | 
| 
       201 
208 
     | 
    
         
             
                      f.add :purcase, type: :bool
         
     | 
| 
         @@ -100,7 +100,7 @@ module JustimmoClient 
     | 
|
| 
       100 
100 
     | 
    
         | 
| 
       101 
101 
     | 
    
         
             
                  coerced =
         
     | 
| 
       102 
102 
     | 
    
         
             
                    case @options.dig(key, :type)
         
     | 
| 
       103 
     | 
    
         
            -
                    when :bool then  
     | 
| 
      
 103 
     | 
    
         
            +
                    when :bool then bool_to_i(value)
         
     | 
| 
       104 
104 
     | 
    
         
             
                    else mapping(value)
         
     | 
| 
       105 
105 
     | 
    
         
             
                    end
         
     | 
| 
       106 
106 
     | 
    
         | 
| 
         @@ -113,8 +113,12 @@ module JustimmoClient 
     | 
|
| 
       113 
113 
     | 
    
         
             
                  { "#{api_param}#{min}": range.first, "#{api_param}#{max}": range.last }
         
     | 
| 
       114 
114 
     | 
    
         
             
                end
         
     | 
| 
       115 
115 
     | 
    
         | 
| 
       116 
     | 
    
         
            -
                def  
     | 
| 
       117 
     | 
    
         
            -
                  value 
     | 
| 
      
 116 
     | 
    
         
            +
                def bool_to_i(value)
         
     | 
| 
      
 117 
     | 
    
         
            +
                  case value
         
     | 
| 
      
 118 
     | 
    
         
            +
                  when "true" then 1
         
     | 
| 
      
 119 
     | 
    
         
            +
                  when "false" then 0
         
     | 
| 
      
 120 
     | 
    
         
            +
                  else value ? 1 : 0
         
     | 
| 
      
 121 
     | 
    
         
            +
                  end
         
     | 
| 
       118 
122 
     | 
    
         
             
                end
         
     | 
| 
       119 
123 
     | 
    
         
             
              end
         
     | 
| 
       120 
124 
     | 
    
         
             
            end
         
     | 
| 
         @@ -21,6 +21,7 @@ module JustimmoClient 
     | 
|
| 
       21 
21 
     | 
    
         
             
                # @option options [Float] :price_per_sqm_min
         
     | 
| 
       22 
22 
     | 
    
         
             
                # @option options [Float] :price_per_sqm_max
         
     | 
| 
       23 
23 
     | 
    
         
             
                # @option options [Integer] :type_id
         
     | 
| 
      
 24 
     | 
    
         
            +
                # @option options [Symbol, String, Array<Symbol, String>] :type
         
     | 
| 
       24 
25 
     | 
    
         
             
                # @option options [Integer] :sub_type_id
         
     | 
| 
       25 
26 
     | 
    
         
             
                # @option options [Symbol, String] :tag
         
     | 
| 
       26 
27 
     | 
    
         
             
                # @option options [String, Integer] :zip_code
         
     | 
| 
         @@ -47,7 +48,7 @@ module JustimmoClient 
     | 
|
| 
       47 
48 
     | 
    
         
             
                # @option options [Boolean] :purcase
         
     | 
| 
       48 
49 
     | 
    
         
             
                # @option options [Integer] :owner_id
         
     | 
| 
       49 
50 
     | 
    
         
             
                # @option options [Integer] :project_id
         
     | 
| 
       50 
     | 
    
         
            -
                # @option options [ 
     | 
| 
      
 51 
     | 
    
         
            +
                # @option options [String] :system_type
         
     | 
| 
       51 
52 
     | 
    
         
             
                # @option options [Integer] :parent_id
         
     | 
| 
       52 
53 
     | 
    
         
             
                # @option options [DateTime] :updated_at_min
         
     | 
| 
       53 
54 
     | 
    
         
             
                # @option options [DateTime] :updated_at_max
         
     |