immobilienscout 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e94144983edce73e19c3bf4a64b2ab02ef5297e4f10f714ddb7b0e68645aa9b6
4
- data.tar.gz: a816281b3268330b43d8a2f7b50ecb25e281d749b79b2172af7068ca64281bcf
3
+ metadata.gz: 754ab014cfc8cdc8e6139bd24adcdba2aaa403a8f919496311cda524a1969d16
4
+ data.tar.gz: f6df5d74e3da9c0f8ba0af924dc190e41dabdb0542573d62fb654c549da90de3
5
5
  SHA512:
6
- metadata.gz: 7d4664aaecc0dce42f23d10776a8102a71e7419599254ab36be12ccf594ed049bf7f4d6f4813b5768c9c28b17d61548fabc6b014f2dae03e8dc6dcad51f8053c
7
- data.tar.gz: bc3f0ae38c2729544fb49f74a9514c1282accc91171899987c7d4ea5f16643c649dd6d6e9c530f383bc91329c227cacf8273b6b48fda0d7ab96b54748108a627
6
+ metadata.gz: 2418ce31bbf7ac90d3ec5e6fec45c22c8b61f01f7536bdd5505f47f22fe8359bf84b388550556334444f08b831d3c13335ad7f24cf34c8211f64f6452f29d934
7
+ data.tar.gz: dee93e8fece5792fd2694fbf67eb5ea01a27121bb9b7a37dacc0cdb7f6aa63cdefeb3d4056e3ab1b70f754e4a9c3ea6ee0e3f226c3c7b9dffaa3242036f0b3fa
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.0.4] - 2019-10-17
10
+ Adding endpoint to update order of attachments for a specific property
11
+
9
12
  ## [0.0.3] - 2019-08-15
10
13
  Update the response accord to the Immobilienscout changes in the `JSON` structure
11
14
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- immobilienscout (0.0.2)
4
+ immobilienscout (0.0.3)
5
5
  activesupport
6
6
  json
7
7
  multipart-post
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Immobilienscout gem
2
2
 
3
+ [![Build Status](https://travis-ci.com/homeday-de/immobilienscout.svg?branch=master)](https://travis-ci.com/homeday-de/immobilienscout)
4
+ [![Gem Version](https://badge.fury.io/rb/immobilienscout.svg)](https://badge.fury.io/rb/immobilienscout)
5
+ [![GitHub license](https://img.shields.io/github/license/homeday-de/immobilienscout)](https://github.com/homeday-de/immobilienscout/blob/master/LICENSE.txt)
6
+
3
7
  This is an interface for Immobilienscout API
4
8
 
5
9
  ## Example
@@ -37,6 +41,11 @@ Immobilienscout::API::Property.destroy(is24_id)
37
41
  - Add attachments to property
38
42
  ```ruby
39
43
  Immobilienscout::API::Attachment.add(is24_id, binary_file, {metadata})
44
+ ```
45
+
46
+ - Order attachments for a specific property
47
+ ```ruby
48
+ Immobilienscout::API::Attachment.put_order(is24_id, {params})
40
49
  ```
41
50
 
42
51
  #### Report
@@ -15,6 +15,15 @@ module Immobilienscout
15
15
  parsed_response
16
16
  end
17
17
 
18
+ def put_order(is24_id, params)
19
+ raise ArgumentError unless params.present?
20
+
21
+ parsed_response = Immobilienscout::Request.new(put_order_url(is24_id), params).put
22
+ raise Immobilienscout::Errors::InvalidRequest, parsed_response.messages.map(&:messages) unless parsed_response.success?
23
+
24
+ parsed_response
25
+ end
26
+
18
27
  private
19
28
 
20
29
  def create_metadata_file(params)
@@ -25,6 +34,10 @@ module Immobilienscout
25
34
  def add_url(is24_id)
26
35
  "#{Immobilienscout::Client.api_url}/restapi/api/offer/v1.0/user/me/realestate/#{is24_id}/attachment"
27
36
  end
37
+
38
+ def put_order_url(is24_id)
39
+ "#{Immobilienscout::Client.api_url}/restapi/api/offer/v1.0/user/me/realestate/#{is24_id}/attachment/attachmentsorder"
40
+ end
28
41
  end
29
42
  end
30
43
  end
@@ -2,7 +2,7 @@ require 'open-uri'
2
2
 
3
3
  module Immobilienscout
4
4
  class Authenticator
5
- ALLOWED_METHODS = %w(POST GET DELETE).freeze
5
+ ALLOWED_METHODS = %w(POST GET DELETE PUT).freeze
6
6
  OAUTH_SIGNATURE_METHOD = 'HMAC-SHA1'.freeze
7
7
  OAUTH_VERSION = '1.0'.freeze
8
8
  HASH_DIGEST = 'sha1'.freeze
@@ -48,6 +48,19 @@ module Immobilienscout
48
48
  execute_request(uri, request)
49
49
  end
50
50
 
51
+ def put
52
+ auth_header = generate_auth_header('PUT')
53
+ headers = generate_headers(auth_header)
54
+
55
+ uri = URI.parse(@url)
56
+
57
+ request = Net::HTTP::Put.new(uri)
58
+ request.body = @params.to_json
59
+ request.initialize_http_header(headers)
60
+
61
+ execute_request(uri, request)
62
+ end
63
+
51
64
  def delete
52
65
  auth_header = generate_auth_header('DELETE')
53
66
  headers = generate_headers(auth_header)
@@ -1,3 +1,3 @@
1
1
  module Immobilienscout
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immobilienscout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Homeday GmbH
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-15 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json