immobilienscout24 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +85 -5
- data/immobilienscout24.gemspec +1 -1
- data/lib/immobilienscout24/api/attachment.rb +66 -0
- data/lib/immobilienscout24/api/connection.rb +6 -0
- data/lib/immobilienscout24/api/contact.rb +46 -2
- data/lib/immobilienscout24/api/publish.rb +40 -0
- data/lib/immobilienscout24/api/real_estate.rb +52 -0
- data/spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/attachment/should_retrieve_a_single_attachment.json +1 -0
- data/spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/update_attachment/should_update_the_attachment.json +1 -0
- data/spec/integration/attachment_spec.rb +16 -0
- data/spec/unit/immobilienscout24/api/attachment_spec.rb +3 -1
- metadata +8 -26
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2U2NTE0NTQxOWRiODYyZDE3M2I0YTE1M2MxNGRiNzE0NjM1NjMzNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MWUyMjQ1ZWY1MGM3OTAzZWVjODEyMTNiYmEyZTYzMGI0OWViMmE1MA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDRlMzcyZTYyZjQ5MmRiNTY2MjQzMDIxZDZmZTRmYzk1ZjFmMzI3ZGQyODFk
|
10
|
+
NDdhYmJiZGVjMjE4YzgyNjdkOGEyZjc3Nzc0MzNmNjEzMmNjNmZkZWZmMDdl
|
11
|
+
ZDBmMGY0ZjBhMGEwNGRlMTk3M2U2NTZiZWUyMzUzYzQ4ZDA3NmM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODY4NDUzYjFhM2U3Mzc2ZjI5ZjM5NmNhYWRmY2I3YThkOWY2Zjc5MzMzM2U5
|
14
|
+
Y2ZiMDdkNTA4ZGE1ODFmYWFkMmIzODYzMmM4ODJlMjk4NjA5MTUzNDVjMzRk
|
15
|
+
YzMyYTFhZGExZWRiYTY1MzgzOGIyODk1YWE2YjMzYzYxNjc2ZGY=
|
data/README.md
CHANGED
@@ -1,8 +1,25 @@
|
|
1
1
|
# Immobilienscout24
|
2
2
|
|
3
|
-
A Ruby wrapper for the Immobilienscout24 REST API. This wrapper has all the important parts
|
3
|
+
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.
|
4
4
|
|
5
|
-
|
5
|
+
Complete API's:
|
6
|
+
|
7
|
+
* Attachment
|
8
|
+
* Contact
|
9
|
+
* Publish
|
10
|
+
* RealEstate
|
11
|
+
* User
|
12
|
+
|
13
|
+
Incomplete:
|
14
|
+
|
15
|
+
* Search
|
16
|
+
* Expose
|
17
|
+
* Geo Services
|
18
|
+
* Product Valuation Services
|
19
|
+
* Realtor
|
20
|
+
* Construction Financing Lead engine API
|
21
|
+
|
22
|
+
In the spirit of free software, everyone is encouraged to help improve this project.
|
6
23
|
|
7
24
|
## Quick start
|
8
25
|
|
@@ -22,15 +39,14 @@ API methods are available from the `Immobilienscout24.client`.
|
|
22
39
|
|
23
40
|
```ruby
|
24
41
|
# Provide authentication credentials
|
25
|
-
|
26
42
|
Immobilienscout24.configure do |config|
|
27
43
|
config.consumer_key = 'your_consumer_key'
|
28
44
|
config.consumer_secret = 'your_consumer_secret'
|
29
45
|
end
|
30
46
|
|
31
47
|
# Fetch your real estates
|
32
|
-
|
33
|
-
|
48
|
+
immoscout_client = Immobilienscout24.client(token: 'your_oauth_token', token_secret: 'your_oauth_token_secret')
|
49
|
+
immoscout_client.real_estates
|
34
50
|
```
|
35
51
|
|
36
52
|
For the oauth process you can use the excellent [omniauth-immobilienscout24][oauthgem] gem.
|
@@ -38,6 +54,70 @@ For the oauth process you can use the excellent [omniauth-immobilienscout24][oau
|
|
38
54
|
[oauthgem]: https://github.com/endil/omniauth-immobilienscout24
|
39
55
|
|
40
56
|
|
57
|
+
### Consuming resources
|
58
|
+
|
59
|
+
Most methods return a [Hashie::Mash][hashie] object which provides dot notation and `[]` access for fields returned in the API response.
|
60
|
+
|
61
|
+
[hashie]: https://github.com/intridea/hashie#mash
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
# Fetch the real estates
|
65
|
+
real_estates = immoscout_client.real_estates
|
66
|
+
|
67
|
+
# Sorry, we haven't invented the Immobilienscout24 response...
|
68
|
+
real_estates = real_estates["realestates.realEstates"].realEstateList.realEstateElement
|
69
|
+
|
70
|
+
# Iterate over results
|
71
|
+
real_estates.each do |real_estate|
|
72
|
+
puts real_estate.title
|
73
|
+
# etc.
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
### Creating / Updating resources
|
78
|
+
|
79
|
+
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`.
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
# Wrapper class for our request
|
83
|
+
class ImmoscoutEstate
|
84
|
+
|
85
|
+
def to_json
|
86
|
+
# generates the json for
|
87
|
+
# the real estate that you want to create / update
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
immoscout_estate = ImmoscoutEstate.new
|
93
|
+
|
94
|
+
# `to_json` will be called on the immoscout_estate object
|
95
|
+
immoscout_client.create_real_estate(immoscout_estate)
|
96
|
+
```
|
97
|
+
|
98
|
+
### Configuration
|
99
|
+
|
100
|
+
For a basic configuration you just enter your `consumer_key` and `consumer_secret`.
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
Immobilienscout24.configure do |config|
|
104
|
+
config.consumer_key = 'your_consumer_key'
|
105
|
+
config.consumer_secret = 'your_consumer_secret'
|
106
|
+
end
|
107
|
+
|
108
|
+
# If you want to use the sandbox
|
109
|
+
config.sandbox = true
|
110
|
+
|
111
|
+
# If you want to generate a log file
|
112
|
+
config.faraday_logger = [:logger, Logger.new('log/immobilienscout24.log')]
|
113
|
+
|
114
|
+
# If you want to use xml
|
115
|
+
config.request_strategy = Immobilienscout24::Api::Request::Xml
|
116
|
+
```
|
117
|
+
|
118
|
+
There are more advanced configuration options. Take a look at `Immobilienscout24::Configuration`.
|
119
|
+
|
120
|
+
|
41
121
|
## Contributing
|
42
122
|
|
43
123
|
1. Fork it
|
data/immobilienscout24.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "immobilienscout24"
|
5
|
-
spec.version = "0.1.
|
5
|
+
spec.version = "0.1.2"
|
6
6
|
spec.author = ["Converate Consulting Group GmbH"]
|
7
7
|
spec.email = ["info@converate.com"]
|
8
8
|
spec.description = %q{A Ruby wrapper for the Immobilienscout24 REST API}
|
@@ -3,13 +3,53 @@ module Immobilienscout24
|
|
3
3
|
|
4
4
|
# Methods for the Attachment API
|
5
5
|
#
|
6
|
+
# For all methods you must provide the immoscout estate id in the options hash.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# client.attachment(663515214, estate: estate_id)
|
10
|
+
#
|
11
|
+
# Per default the client will use the current user (`me`).
|
12
|
+
# If you want to use an other user then you have to provide
|
13
|
+
# the id in the options hash.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# client.attachment(663515214, estate: estate_id, user: immoscout_user_id)
|
17
|
+
#
|
6
18
|
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/attachment
|
7
19
|
module Attachment
|
8
20
|
|
21
|
+
# Get a list of all attachments
|
22
|
+
#
|
23
|
+
# @param options [Hash] Additional options
|
24
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
25
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/attachment/GETALL
|
26
|
+
# @example
|
27
|
+
# client.attachments(estate: 62412598)
|
9
28
|
def attachments(options = {})
|
10
29
|
get attachment_endpoint("/attachment", options)
|
11
30
|
end
|
12
31
|
|
32
|
+
# Get an attachment by id
|
33
|
+
#
|
34
|
+
# @param id [String, Integer] Attachment id
|
35
|
+
# @param options [Hash] Additional options
|
36
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
37
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/attachment/GETbyID
|
38
|
+
# @example
|
39
|
+
# client.attachment(663515214, estate: 62412598)
|
40
|
+
def attachment(id, options = {})
|
41
|
+
get attachment_endpoint("/attachment/#{id}", options)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Create an attachment
|
45
|
+
#
|
46
|
+
# @param metadata [Hash] Object that contains the information about the attachment (title etc.)
|
47
|
+
# @param attachment [String, Hash, Array, Attachment, File] Contains the file information
|
48
|
+
# @param options [Hash] Additional options
|
49
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
50
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/attachment/POST
|
51
|
+
# @example
|
52
|
+
# client.create_attachment(matadata, 'path/to/attachment.jpg', estate: 62412598)
|
13
53
|
def create_attachment(metadata, attachment, options = {})
|
14
54
|
attachment = ::Immobilienscout24::Helper::Attachment.new(attachment).build
|
15
55
|
multipart = {metadata: metadata, attachment: Faraday::UploadIO.new(*attachment)}
|
@@ -19,12 +59,38 @@ module Immobilienscout24
|
|
19
59
|
end
|
20
60
|
end
|
21
61
|
|
62
|
+
# Update an attachment
|
63
|
+
#
|
64
|
+
# @param id [String, Integer] Attachment id
|
65
|
+
# @param attachment [Hash] Attachment meta data to be updated (title etc.). You can't upload a new file.
|
66
|
+
# @param options [Hash] Additional options
|
67
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
68
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/attachment/PUTbyID
|
69
|
+
# @example
|
70
|
+
# client.update_attachment(663515214, attachment, estate: 62412598)
|
71
|
+
def update_attachment(id, attachment, options = {})
|
72
|
+
put attachment_endpoint("/attachment/#{id}", options), attachment
|
73
|
+
end
|
74
|
+
|
75
|
+
# Delete an attachment
|
76
|
+
#
|
77
|
+
# @param id [String, Integer] Attachment id
|
78
|
+
# @param options [Hash] Additional options
|
79
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
80
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/attachment/DELETEbyID
|
81
|
+
# @example
|
82
|
+
# client.delete_attachment(663515214, estate: 62412598)
|
22
83
|
def delete_attachment(id, options = {})
|
23
84
|
delete attachment_endpoint("/attachment/#{id}", options)
|
24
85
|
end
|
25
86
|
|
26
87
|
# -- endpoint
|
27
88
|
|
89
|
+
# Generates the attachment endpoint
|
90
|
+
#
|
91
|
+
# @param resource [String, Integer] In most cases the id of the attachment
|
92
|
+
# @param options [Hash] Additional options
|
93
|
+
# @return [String] The url to the attachment resource
|
28
94
|
def attachment_endpoint(resource, options = {})
|
29
95
|
estate = options.fetch(:estate)
|
30
96
|
estate_attachment_endpoint(estate, resource, options)
|
@@ -1,7 +1,13 @@
|
|
1
1
|
module Immobilienscout24
|
2
2
|
module Api
|
3
|
+
|
4
|
+
# Methods for the Immobilienscout24 connection
|
3
5
|
module Connection
|
4
6
|
|
7
|
+
# Used for every API call to Immobilienscout24.
|
8
|
+
#
|
9
|
+
# @return [Faraday::Connection] Connection handler.
|
10
|
+
# @see https://github.com/lostisland/faraday
|
5
11
|
def connection
|
6
12
|
connection = ::Faraday::Connection.new(configuration.faraday_connection) do |builder|
|
7
13
|
builder.request :oauth, oauth_credentials
|
@@ -3,27 +3,71 @@ module Immobilienscout24
|
|
3
3
|
|
4
4
|
# Methods for the Contact API
|
5
5
|
#
|
6
|
+
# Per default the client will use the current user (`me`).
|
7
|
+
# If you want to use an other user then you have to provide
|
8
|
+
# the id in the options hash.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# client.contact(663515214, user: immoscout_user_id)
|
12
|
+
#
|
6
13
|
# @see http://developerwiki.immobilienscout24.de/wiki/User/Contact
|
7
14
|
module Contact
|
8
15
|
|
16
|
+
# Get a list of all contacts
|
17
|
+
#
|
18
|
+
# @param options [Hash] Additional options
|
19
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
20
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Contact/GETALL
|
21
|
+
# @example
|
22
|
+
# client.contacts
|
9
23
|
def contacts(options = {})
|
10
24
|
get contact_endpoint("/contact", options)
|
11
25
|
end
|
12
26
|
|
13
|
-
|
14
|
-
|
27
|
+
# Get a contact
|
28
|
+
#
|
29
|
+
# @param id [String, Integer] Contact id
|
30
|
+
# @param options [Hash] Additional options
|
31
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
32
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Contact/GETbyID
|
33
|
+
# @example
|
34
|
+
# client.contact(663515214)
|
35
|
+
def contact(id, options = {})
|
36
|
+
get contact_endpoint("/contact/#{id}", options)
|
15
37
|
end
|
16
38
|
|
39
|
+
# Create a contact
|
40
|
+
#
|
41
|
+
# @param contact [Hash] The new contact
|
42
|
+
# @param options [Hash] Additional options
|
43
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
44
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Contact/POST
|
45
|
+
# @example
|
46
|
+
# client.create_contact(contact)
|
17
47
|
def create_contact(contact, options = {})
|
18
48
|
post contact_endpoint("/contact", options), contact
|
19
49
|
end
|
20
50
|
|
51
|
+
# Update a contact
|
52
|
+
#
|
53
|
+
# @param id [String, Integer] Contact id
|
54
|
+
# @param contact [Hash] Data to update
|
55
|
+
# @param options [Hash] Additional options
|
56
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
57
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Contact/PUTbyID
|
58
|
+
# @example
|
59
|
+
# client.update_contact(663515214, contact)
|
21
60
|
def update_contact(id, contact, options = {})
|
22
61
|
put contact_endpoint("/contact/#{id}", options), contact
|
23
62
|
end
|
24
63
|
|
25
64
|
# -- endpoint
|
26
65
|
|
66
|
+
# Generates the contact endpoint
|
67
|
+
#
|
68
|
+
# @param resource [String, Integer] In most cases the id of the contact
|
69
|
+
# @param options [Hash] Additional options
|
70
|
+
# @return [String] The url to the contact resource
|
27
71
|
def contact_endpoint(resource, options = {})
|
28
72
|
options = {user: "me"}.merge(options)
|
29
73
|
user_contact_endpoint(options.fetch(:user), resource, options)
|
@@ -7,29 +7,69 @@ module Immobilienscout24
|
|
7
7
|
# @see http://developerwiki.immobilienscout24.de/wiki/PublishChannel/GET
|
8
8
|
module Publish
|
9
9
|
|
10
|
+
# Get a list of all publications
|
11
|
+
#
|
12
|
+
# @param estate [Hash] Estate id
|
13
|
+
# @param params [Hash] Additional request parameters
|
14
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
15
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/Publish/GET
|
16
|
+
# @example
|
17
|
+
# client.publications(estate_id)
|
10
18
|
def publications(estate, params = {})
|
11
19
|
params = {realestate: estate}.merge(params)
|
12
20
|
get publish_endpoint("/publish"), params
|
13
21
|
end
|
14
22
|
|
23
|
+
# Get a single publication
|
24
|
+
#
|
25
|
+
# @param id [String] Publication id
|
26
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
27
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/Publish/GETbyID
|
28
|
+
# @example
|
29
|
+
# client.publication(publication_id)
|
15
30
|
def publication(id)
|
16
31
|
get publish_endpoint("/publish/#{id}")
|
17
32
|
end
|
18
33
|
|
34
|
+
# Create multiple publications
|
35
|
+
#
|
36
|
+
# @param publications [Hash] Publication data
|
37
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
38
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/Publish/POST
|
39
|
+
# @example
|
40
|
+
# client.create_publications(publications)
|
19
41
|
def create_publications(publications)
|
20
42
|
post publish_endpoint("/publish/list"), publications
|
21
43
|
end
|
22
44
|
|
45
|
+
# Create a single publication
|
46
|
+
#
|
47
|
+
# @param publication [Hash] Publication data
|
48
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
49
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/Publish/POSTbyID
|
50
|
+
# @example
|
51
|
+
# client.create_publication(publication)
|
23
52
|
def create_publication(publication)
|
24
53
|
post publish_endpoint("/publish"), publication
|
25
54
|
end
|
26
55
|
|
56
|
+
# Delete a publication
|
57
|
+
#
|
58
|
+
# @param id [String] Publication id
|
59
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
60
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/Publish/DELETEbyID
|
61
|
+
# @example
|
62
|
+
# client.delete_publication(publication_id)
|
27
63
|
def delete_publication(id)
|
28
64
|
delete publish_endpoint("/publish/#{id}")
|
29
65
|
end
|
30
66
|
|
31
67
|
# -- endpoint
|
32
68
|
|
69
|
+
# Generates the publish endpoint
|
70
|
+
#
|
71
|
+
# @param resource [String, Integer] In most cases the id of the publication
|
72
|
+
# @return [String] The url to the publish resource
|
33
73
|
def publish_endpoint(resource)
|
34
74
|
["api/offer/#{api_version}", resource].join
|
35
75
|
end
|
@@ -3,31 +3,83 @@ module Immobilienscout24
|
|
3
3
|
|
4
4
|
# Methods for the RealEstate API
|
5
5
|
#
|
6
|
+
# Per default the client will use the current user (`me`).
|
7
|
+
# If you want to use an other user then you have to provide
|
8
|
+
# the id in the options hash.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# client.real_estate(663515214, user: immoscout_user_id)
|
12
|
+
#
|
6
13
|
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate
|
7
14
|
module RealEstate
|
8
15
|
|
16
|
+
# Get a list of all real estates
|
17
|
+
#
|
18
|
+
# @param options [Hash] Additional options
|
19
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
20
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/GETALL
|
21
|
+
# @example
|
22
|
+
# client.real_estates
|
9
23
|
def real_estates(options = {})
|
10
24
|
get real_estate_endpoint("/realestate", options)
|
11
25
|
end
|
12
26
|
|
27
|
+
# Get a single real estate
|
28
|
+
#
|
29
|
+
# @param id [String, Integer] Real estate id
|
30
|
+
# @param options [Hash] Additional options
|
31
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
32
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/GETbyID
|
33
|
+
# @example
|
34
|
+
# client.real_estate(real_estate_id)
|
13
35
|
def real_estate(id, options = {})
|
14
36
|
get real_estate_endpoint("/realestate/#{id}", options)
|
15
37
|
end
|
16
38
|
|
39
|
+
# Create a real estate
|
40
|
+
#
|
41
|
+
# @param estate [Hash] Estate data
|
42
|
+
# @param options [Hash] Additional options
|
43
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
44
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/POST
|
45
|
+
# @example
|
46
|
+
# client.create_real_estate(estate)
|
17
47
|
def create_real_estate(estate, options = {})
|
18
48
|
post real_estate_endpoint("/realestate", options), estate
|
19
49
|
end
|
20
50
|
|
51
|
+
# Update a real estate
|
52
|
+
#
|
53
|
+
# @param id [String, Integer] Real estate id
|
54
|
+
# @param estate [Hash] Estate data
|
55
|
+
# @param options [Hash] Additional options
|
56
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
57
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/PUTbyID
|
58
|
+
# @example
|
59
|
+
# client.update_real_estate(estate_id, data)
|
21
60
|
def update_real_estate(id, estate, options = {})
|
22
61
|
put real_estate_endpoint("/realestate/#{id}", options), estate
|
23
62
|
end
|
24
63
|
|
64
|
+
# Delete a real estate
|
65
|
+
#
|
66
|
+
# @param id [String, Integer] Real estate id
|
67
|
+
# @param options [Hash] Additional options
|
68
|
+
# @return [Hashie::Mash] Immobilienscout24 response
|
69
|
+
# @see http://developerwiki.immobilienscout24.de/wiki/User/Realestate/DELETEbyID
|
70
|
+
# @example
|
71
|
+
# client.delete_real_estate(estate_id, data)
|
25
72
|
def delete_real_estate(id, options = {})
|
26
73
|
delete real_estate_endpoint("/realestate/#{id}", options)
|
27
74
|
end
|
28
75
|
|
29
76
|
# -- endpoint
|
30
77
|
|
78
|
+
# Generates the real estate endpoint
|
79
|
+
#
|
80
|
+
# @param resource [String, Integer] In most cases the id of the real estate
|
81
|
+
# @param options [Hash] Additional options
|
82
|
+
# @return [String] The url to the real estate resource
|
31
83
|
def real_estate_endpoint(resource, options = {})
|
32
84
|
options = {user: "me"}.merge(options)
|
33
85
|
user_real_estate_endpoint(options.fetch(:user), resource, options)
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"http://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/realestate/62412598/attachment/663515214","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"User-Agent":["Faraday v0.8.9"],"Accept":["application/json"],"Content-Type":["application/json;charset=UTF-8"]}},"response":{"status":{"code":200,"message":null},"headers":{"server":["Apache-Coyote/1.1"],"date":["Wed, 16 Apr 2014 17:24:36 GMT"],"content-type":["application/json;charset=UTF-8"],"content-length":["1940"],"connection":["close"]},"body":{"encoding":"US-ASCII","base64_string":"eyJjb21tb24uYXR0YWNobWVudCI6eyJAeHNpLnR5cGUiOiJjb21tb246UGlj\ndHVyZSIsIkB4bGluay5ocmVmIjoiaHR0cDpcL1wvcmVzdC5zYW5kYm94LWlt\nbW9iaWxpZW5zY291dDI0LmRlXC9yZXN0YXBpXC9hcGlcL29mZmVyXC92MS4w\nXC91c2VyXC9tZVwvcmVhbGVzdGF0ZVwvNjI0MTI1OThcL2F0dGFjaG1lbnRc\nLzY2MzUxNTIxNFwvNjYzNTE1MjE0IiwiQGlkIjoiNjYzNTE1MjE0IiwidGl0\nbGUiOiJFc3RhdGUgUGljdHVyZSIsImZsb29ycGxhbiI6ImZhbHNlIiwidGl0\nbGVQaWN0dXJlIjoidHJ1ZSIsInVybHMiOlt7InVybCI6W3siQHNjYWxlIjoi\nU0NBTEUiLCJAaHJlZiI6Imh0dHA6XC9cL3RwaWN0dXJlLmltbW9ia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n\nYWN5X3RodW1ibmFpbFwvNzN4NzNcL2Zvcm1hdFwvanBnPzk5MzkzNTUwNSJ9\nXX1dfX0=\n"},"http_version":null},"recorded_at":"Wed, 16 Apr 2014 17:24:36 GMT"}],"recorded_with":"VCR 2.9.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"put","uri":"http://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/realestate/62412598/attachment/663515214","body":{"encoding":"UTF-8","base64_string":"eyJjb21tb24uYXR0YWNobWVudCI6eyJAeG1sbnMiOnsiY29tbW9uIjoiaHR0\ncDovL3Jlc3QuaW1tb2JpbGllbnNjb3V0MjQuZGUvc2NoZW1hL2NvbW1vbi8x\nLjAifSwiQHhzaS50eXBlIjoiY29tbW9uOlBpY3R1cmUiLCJ0aXRsZSI6IkVz\ndGF0ZSBQaWN0dXJlIiwiZmxvb3JwbGFuIjoiZmFsc2UiLCJ0aXRsZVBpY3R1\ncmUiOiJmYWxzZSJ9fQ==\n"},"headers":{"User-Agent":["Faraday v0.8.9"],"Accept":["application/json"],"Content-Type":["application/json;charset=UTF-8"]}},"response":{"status":{"code":200,"message":null},"headers":{"server":["Apache-Coyote/1.1"],"date":["Wed, 16 Apr 2014 17:28:22 GMT"],"content-type":["application/json;charset=UTF-8"],"content-length":["149"],"connection":["close"]},"body":{"encoding":"US-ASCII","base64_string":"eyJjb21tb24ubWVzc2FnZXMiOlt7Im1lc3NhZ2UiOnsibWVzc2FnZUNvZGUi\nOiJNRVNTQUdFX1JFU09VUkNFX1VQREFURUQiLCJtZXNzYWdlIjoiUmVzb3Vy\nY2UgW2F0dGFjaG1lbnRdIHdpdGggaWQgWzY2MzUxNTIxNF0gaGFzIGJlZW4g\ndXBkYXRlZC4gIn19XX0=\n"},"http_version":null},"recorded_at":"Wed, 16 Apr 2014 17:28:22 GMT"}],"recorded_with":"VCR 2.9.0"}
|
@@ -11,6 +11,13 @@ describe Immobilienscout24::Api::Attachment, vcr: true do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe "attachment" do
|
15
|
+
it "should retrieve a single attachment" do
|
16
|
+
result = client.attachment(663515214, estate: 62412598)
|
17
|
+
expect(result).to include "common.attachment"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
14
21
|
describe "create attachment" do
|
15
22
|
let(:attachment) { File.join(fixture_path, 'estate.jpg') }
|
16
23
|
let(:meta) { mashify_fixture('raw_picture.json') }
|
@@ -21,6 +28,15 @@ describe Immobilienscout24::Api::Attachment, vcr: true do
|
|
21
28
|
end
|
22
29
|
end
|
23
30
|
|
31
|
+
describe "update attachment" do
|
32
|
+
let(:attachment) { mashify_fixture('raw_picture.json') }
|
33
|
+
|
34
|
+
it "should update the attachment" do
|
35
|
+
result = client.update_attachment(663515214, attachment, estate: 62412598)
|
36
|
+
expect(result.inspect).to include "MESSAGE_RESOURCE_UPDATED"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
24
40
|
describe "delete attachment" do
|
25
41
|
it "should delete an attachment" do
|
26
42
|
result = client.delete_attachment(663517286, estate: 62412598)
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immobilienscout24
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Converate Consulting Group GmbH
|
@@ -14,7 +13,6 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: faraday
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - <
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - <
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: faraday_middleware
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: multi_xml
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: hashie
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: simple_oauth
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: bundler
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rake
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ! '>='
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ! '>='
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -161,9 +146,11 @@ files:
|
|
161
146
|
- spec/fixtures/raw_picture.json
|
162
147
|
- spec/fixtures/raw_publication.json
|
163
148
|
- spec/fixtures/raw_publications.json
|
149
|
+
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/attachment/should_retrieve_a_single_attachment.json
|
164
150
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/attachments/should_retrieve_all_attachments.json
|
165
151
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/create_attachment/should_create_the_attachment.json
|
166
152
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/delete_attachment/should_delete_an_attachment.json
|
153
|
+
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/update_attachment/should_update_the_attachment.json
|
167
154
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Contact/contact/should_retrieve_a_signle_contact.json
|
168
155
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Contact/contacts/should_retrieve_all_contacts.json
|
169
156
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Contact/create_contact/should_create_the_contact.json
|
@@ -205,33 +192,26 @@ files:
|
|
205
192
|
homepage: https://github.com/converate-consulting-group/immobilienscout24
|
206
193
|
licenses:
|
207
194
|
- MIT
|
195
|
+
metadata: {}
|
208
196
|
post_install_message:
|
209
197
|
rdoc_options: []
|
210
198
|
require_paths:
|
211
199
|
- lib
|
212
200
|
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
-
none: false
|
214
201
|
requirements:
|
215
202
|
- - ! '>='
|
216
203
|
- !ruby/object:Gem::Version
|
217
204
|
version: '0'
|
218
|
-
segments:
|
219
|
-
- 0
|
220
|
-
hash: -928056505246667324
|
221
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
|
-
none: false
|
223
206
|
requirements:
|
224
207
|
- - ! '>='
|
225
208
|
- !ruby/object:Gem::Version
|
226
209
|
version: '0'
|
227
|
-
segments:
|
228
|
-
- 0
|
229
|
-
hash: -928056505246667324
|
230
210
|
requirements: []
|
231
211
|
rubyforge_project:
|
232
|
-
rubygems_version:
|
212
|
+
rubygems_version: 2.2.2
|
233
213
|
signing_key:
|
234
|
-
specification_version:
|
214
|
+
specification_version: 4
|
235
215
|
summary: A Ruby wrapper for the Immobilienscout24 REST API
|
236
216
|
test_files:
|
237
217
|
- spec/fixtures/estate.jpg
|
@@ -241,9 +221,11 @@ test_files:
|
|
241
221
|
- spec/fixtures/raw_picture.json
|
242
222
|
- spec/fixtures/raw_publication.json
|
243
223
|
- spec/fixtures/raw_publications.json
|
224
|
+
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/attachment/should_retrieve_a_single_attachment.json
|
244
225
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/attachments/should_retrieve_all_attachments.json
|
245
226
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/create_attachment/should_create_the_attachment.json
|
246
227
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/delete_attachment/should_delete_an_attachment.json
|
228
|
+
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Attachment/update_attachment/should_update_the_attachment.json
|
247
229
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Contact/contact/should_retrieve_a_signle_contact.json
|
248
230
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Contact/contacts/should_retrieve_all_contacts.json
|
249
231
|
- spec/fixtures/vcr_cassettes/Immobilienscout24_Api_Contact/create_contact/should_create_the_contact.json
|