No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the Immobilienscout24 REST API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

Immobilienscout24

Gem Version Build Status Dependency Status

A Ruby wrapper for the Immobilienscout24 REST API. This wrapper has all the important parts for the import and export of real estates from and to Immobilienscout24.

Complete API's:

  • Attachment
  • Contact
  • Publish
  • RealEstate
  • User

Incomplete:

  • Search
  • Expose
  • Geo Services
  • Product Valuation Services
  • Realtor
  • Construction Financing Lead engine API

In the spirit of free software, everyone is encouraged to help improve this project.

Quick start

Add this line to your application's Gemfile:

gem 'immobilienscout24'

And then execute:

$ bundle

Or install it yourself as:

$ gem install immobilienscout24

API methods are available from the Immobilienscout24.client.

# Provide authentication credentials
Immobilienscout24.configure do |config|
  config.consumer_key = 'your_consumer_key'
  config.consumer_secret = 'your_consumer_secret'
end

# Fetch your real estates
immoscout_client = Immobilienscout24.client(token: 'your_oauth_token', token_secret: 'your_oauth_token_secret')
immoscout_client.real_estates

For the oauth process you can use the excellent omniauth-immobilienscout24 gem.

Consuming resources

Most methods return a Hashie::Mash object which provides dot notation and [] access for fields returned in the API response.

# Fetch the real estates
real_estates = immoscout_client.real_estates

# Sorry, we haven't invented the Immobilienscout24 response...
real_estates = real_estates["realestates.realEstates"].realEstateList.realEstateElement

# Iterate over results
real_estates.each do |real_estate|
  puts real_estate.title
  # etc.
end

Creating / Updating resources

The creation / modification of resources follows one simple rule: If you make JSON requests then the object that you send via the api has to respond to to_json. If you make XML requests then it has to respond to to_xml.

# Wrapper class for our request
class ImmoscoutEstate

  def to_json
    # generates the json for
    # the real estate that you want to create / update
  end

end

immoscout_estate = ImmoscoutEstate.new

# `to_json` will be called on the immoscout_estate object
immoscout_client.create_real_estate(immoscout_estate)

Configuration

For a basic configuration you just enter your consumer_key and consumer_secret.

Immobilienscout24.configure do |config|
  config.consumer_key = 'your_consumer_key'
  config.consumer_secret = 'your_consumer_secret'
end

# If you want to use the sandbox
config.sandbox = true

# If you want to generate a log file
config.faraday_logger = [:logger, Logger.new('log/immobilienscout24.log')]

# If you want to use xml
config.request_strategy = Immobilienscout24::Api::Request::Xml

There are more advanced configuration options. Take a look at Immobilienscout24::Configuration.

Rails integration

Take a look at the wiki.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

TODO

  • Extend API
  • Write more tests