immoscout 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/documentation.yml +39 -0
- data/.github/workflows/test.yml +63 -0
- data/.rspec +2 -1
- data/.rubocop.yml +23 -4
- data/.simplecov +12 -0
- data/.yardopts +6 -0
- data/Appraisals +1 -5
- data/CHANGELOG.md +14 -0
- data/Dockerfile +2 -3
- data/Envfile +0 -3
- data/Gemfile +1 -1
- data/Guardfile +44 -0
- data/LICENSE +1 -1
- data/Makefile +47 -17
- data/README.md +4 -4
- data/Rakefile +18 -2
- data/gemfiles/rails_5.2.gemfile +1 -1
- data/immoscout.gemspec +45 -44
- data/lib/immoscout/api/client.rb +5 -2
- data/lib/immoscout/api/connection.rb +12 -11
- data/lib/immoscout/api/request.rb +10 -5
- data/lib/immoscout/configuration.rb +15 -9
- data/lib/immoscout/errors/failed.rb +3 -0
- data/lib/immoscout/models/actions/attachment.rb +22 -9
- data/lib/immoscout/models/actions/contact.rb +7 -10
- data/lib/immoscout/models/actions/publish.rb +4 -4
- data/lib/immoscout/models/actions/real_estate.rb +12 -12
- data/lib/immoscout/models/apartment_buy.rb +4 -1
- data/lib/immoscout/models/base.rb +3 -1
- data/lib/immoscout/models/concerns/modelable.rb +8 -3
- data/lib/immoscout/models/concerns/propertiable.rb +8 -2
- data/lib/immoscout/models/concerns/renderable.rb +18 -5
- data/lib/immoscout/models/contact.rb +3 -1
- data/lib/immoscout/models/document.rb +3 -1
- data/lib/immoscout/models/house_buy.rb +4 -1
- data/lib/immoscout/models/parts/address.rb +3 -0
- data/lib/immoscout/models/parts/api_search_data.rb +3 -0
- data/lib/immoscout/models/parts/contact.rb +3 -0
- data/lib/immoscout/models/parts/coordinate.rb +3 -0
- data/lib/immoscout/models/parts/courtage.rb +3 -0
- data/lib/immoscout/models/parts/energy_certificate.rb +3 -0
- data/lib/immoscout/models/parts/energy_source.rb +3 -0
- data/lib/immoscout/models/parts/firing_type.rb +3 -0
- data/lib/immoscout/models/parts/geo_code.rb +3 -0
- data/lib/immoscout/models/parts/geo_hierarchy.rb +3 -0
- data/lib/immoscout/models/parts/international_country_region.rb +3 -0
- data/lib/immoscout/models/parts/price.rb +3 -0
- data/lib/immoscout/models/parts/publish_channel.rb +3 -0
- data/lib/immoscout/models/parts/real_estate.rb +3 -0
- data/lib/immoscout/models/parts/url.rb +3 -0
- data/lib/immoscout/models/parts/urls.rb +3 -0
- data/lib/immoscout/models/picture.rb +4 -2
- data/lib/immoscout/models/publish.rb +3 -1
- data/lib/immoscout/models.rb +2 -1
- data/lib/immoscout/version.rb +19 -1
- data/lib/immoscout.rb +2 -1
- metadata +99 -71
- data/.travis.yml +0 -23
- data/gemfiles/rails_6.0.gemfile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4cd53b266de26d3e819cdfedba39ced10517813e4aed918c7bb9eb243a1c9e2
|
4
|
+
data.tar.gz: 4e9e75201da0c3a21da12f1c162f078c71fc393e4e350837fd39beca00dc83db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 519df9e86e1f3bf3616c24ff3684b5be431a4261e9b2521afa807ae8ae15f23913552bb543b664559242d5f74bb23b4d6aff34bc2cda1fdf2e8d0086c77cd8c9
|
7
|
+
data.tar.gz: 145b56aea60a069fb70b29d7e46774f9f72f05ff50b10df6579d34760939f19c4ff44d7df7ebf089d9c32f2f1d3a3b4beb11b37dc6844d9514b9eb71cfc024ec
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: Build Documentation
|
2
|
+
on:
|
3
|
+
repository_dispatch:
|
4
|
+
types: [documentation]
|
5
|
+
|
6
|
+
concurrency:
|
7
|
+
group: 'docs'
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
docs:
|
11
|
+
name: Build gem documentation
|
12
|
+
runs-on: ubuntu-22.04
|
13
|
+
timeout-minutes: 5
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v3
|
16
|
+
|
17
|
+
- name: Install the correct Ruby version
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 2.5
|
21
|
+
bundler-cache: true
|
22
|
+
rubygems: '3.3.26'
|
23
|
+
|
24
|
+
- name: Prepare the virtual environment
|
25
|
+
uses: hausgold/actions/ci@master
|
26
|
+
with:
|
27
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
28
|
+
settings: '${{ github.repository }}'
|
29
|
+
target: ci/gem-test
|
30
|
+
|
31
|
+
- name: Build gem documentation
|
32
|
+
run: make docs
|
33
|
+
|
34
|
+
- name: Upload the code coverage report
|
35
|
+
run: coverage
|
36
|
+
|
37
|
+
- name: Add this job to the commit status
|
38
|
+
run: commit-status '${{ job.status }}'
|
39
|
+
if: always()
|
@@ -0,0 +1,63 @@
|
|
1
|
+
name: Test
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- '**'
|
6
|
+
schedule:
|
7
|
+
- cron: '0 0 * * MON'
|
8
|
+
|
9
|
+
concurrency:
|
10
|
+
group: '${{ github.ref }}'
|
11
|
+
cancel-in-progress: true
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test:
|
15
|
+
name: 'Test the gem (Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }})'
|
16
|
+
runs-on: ubuntu-22.04
|
17
|
+
timeout-minutes: 5
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: ['2.5', '2.7']
|
22
|
+
rails: ['5.2']
|
23
|
+
env:
|
24
|
+
BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v3
|
27
|
+
|
28
|
+
- name: Install the correct Ruby version
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
bundler-cache: true
|
33
|
+
rubygems: '3.3.26'
|
34
|
+
|
35
|
+
- name: Prepare the virtual environment
|
36
|
+
uses: hausgold/actions/ci@master
|
37
|
+
with:
|
38
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
39
|
+
settings: '${{ github.repository }}'
|
40
|
+
target: ci/gem-test
|
41
|
+
|
42
|
+
- name: Run the gem tests
|
43
|
+
run: make test
|
44
|
+
|
45
|
+
- name: Upload the code coverage report
|
46
|
+
run: coverage
|
47
|
+
|
48
|
+
trigger-docs:
|
49
|
+
name: Trigger the documentation upload
|
50
|
+
runs-on: ubuntu-22.04
|
51
|
+
timeout-minutes: 2
|
52
|
+
needs: test
|
53
|
+
if: github.ref == 'refs/heads/master'
|
54
|
+
steps:
|
55
|
+
- name: Prepare the virtual environment
|
56
|
+
uses: hausgold/actions/ci@master
|
57
|
+
with:
|
58
|
+
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
59
|
+
settings: '${{ github.repository }}'
|
60
|
+
target: ci/noop
|
61
|
+
|
62
|
+
- name: Trigger the documentation upload
|
63
|
+
run: workflow documentation
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,14 +1,24 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-rails
|
4
|
+
|
5
|
+
Rails:
|
6
|
+
Enabled: true
|
7
|
+
|
8
|
+
Style/Documentation:
|
9
|
+
Enabled: true
|
3
10
|
|
4
11
|
AllCops:
|
12
|
+
NewCops: enable
|
13
|
+
SuggestExtensions: false
|
5
14
|
DisplayCopNames: true
|
6
15
|
TargetRubyVersion: 2.5
|
16
|
+
TargetRailsVersion: 5.2
|
7
17
|
Exclude:
|
8
18
|
- bin/**/*
|
9
19
|
- vendor/**/*
|
10
20
|
- build/**/*
|
11
|
-
- gemfiles
|
21
|
+
- gemfiles/**/*
|
12
22
|
|
13
23
|
Metrics/BlockLength:
|
14
24
|
Exclude:
|
@@ -20,5 +30,14 @@ Metrics/BlockLength:
|
|
20
30
|
|
21
31
|
# We stay at 80 characters per line.
|
22
32
|
# See: https://rubystyle.guide/#max-line-length
|
23
|
-
|
33
|
+
Layout/LineLength:
|
24
34
|
Max: 80
|
35
|
+
|
36
|
+
# MFA is not yet enabled for our gems yet.
|
37
|
+
Gemspec/RequireMFA:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
# We use memoized helpers all over the place to construct inputs and output
|
41
|
+
# which can be customized at nested contexts easily.
|
42
|
+
RSpec/MultipleMemoizedHelpers:
|
43
|
+
Enabled: false
|
data/.simplecov
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov-html'
|
4
|
+
require 'simplecov_json_formatter'
|
5
|
+
|
6
|
+
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
|
7
|
+
[
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
SimpleCov::Formatter::JSONFormatter
|
10
|
+
]
|
11
|
+
)
|
12
|
+
|
1
13
|
SimpleCov.start 'test_frameworks' do
|
2
14
|
add_filter '/vendor/bundle/'
|
3
15
|
end
|
data/.yardopts
ADDED
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
### 1.4.0
|
2
|
+
|
3
|
+
* Bundler >= 2.3 is from now on required as minimal version (#10)
|
4
|
+
* Dropped support for Ruby < 2.5 (#10)
|
5
|
+
* Dropped support for Rails < 5.2 (#10)
|
6
|
+
* Updated all development/runtime gems to their latest
|
7
|
+
Ruby 2.5 compatible version (#10)
|
8
|
+
|
9
|
+
### 1.3.2
|
10
|
+
|
11
|
+
* Migrated to Github Actions
|
12
|
+
* Migrated to our own coverage reporting
|
13
|
+
* Added the code statistics to the test process
|
14
|
+
|
1
15
|
### 1.3.1
|
2
16
|
|
3
17
|
* Corrected the GNU Make release target
|
data/Dockerfile
CHANGED
@@ -2,7 +2,7 @@ FROM hausgold/ruby:2.5
|
|
2
2
|
MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
|
3
3
|
|
4
4
|
# Update system gem
|
5
|
-
RUN gem update --system
|
5
|
+
RUN gem update --system '3.3.26'
|
6
6
|
|
7
7
|
# Install system packages and the latest bundler
|
8
8
|
RUN apt-get update -yqqq && \
|
@@ -11,8 +11,7 @@ RUN apt-get update -yqqq && \
|
|
11
11
|
ca-certificates \
|
12
12
|
bash-completion inotify-tools && \
|
13
13
|
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
|
14
|
-
gem install bundler -v '~> 2.0' --no-document --no-prerelease
|
15
|
-
gem install bundler -v '~> 1.0' --no-document --no-prerelease
|
14
|
+
gem install bundler -v '~> 2.3.0' --no-document --no-prerelease
|
16
15
|
|
17
16
|
# Add new web user
|
18
17
|
RUN mkdir /app && \
|
data/Envfile
CHANGED
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
7
|
+
(directories %w[lib spec]).select do |d|
|
8
|
+
if Dir.exist?(d)
|
9
|
+
d
|
10
|
+
else
|
11
|
+
UI.warning("Directory #{d} does not exist")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
## Note: if you are using the `directories` clause above and you are not
|
16
|
+
## watching the project directory ('.'), then you will want to move
|
17
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
18
|
+
#
|
19
|
+
# $ mkdir config
|
20
|
+
# $ mv Guardfile config/
|
21
|
+
# $ ln -s config/Guardfile .
|
22
|
+
#
|
23
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
24
|
+
|
25
|
+
# NOTE: The cmd option is now required due to the increasing number of ways
|
26
|
+
# rspec may be run, below are examples of the most common uses.
|
27
|
+
# * bundler: 'bundle exec rspec'
|
28
|
+
# * bundler binstubs: 'bin/rspec'
|
29
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
30
|
+
# installed the spring binstubs per the docs)
|
31
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
32
|
+
# * 'just' rspec: 'rspec'
|
33
|
+
|
34
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
35
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
36
|
+
watch(%r{^lib/immoscout.rb}) { 'spec' }
|
37
|
+
watch(%r{^spec/.+_spec\.rb$})
|
38
|
+
watch(%r{^lib/immoscout/([^\\]+)\.rb$}) do |m|
|
39
|
+
"spec/immoscout/#{m[1]}_spec.rb"
|
40
|
+
end
|
41
|
+
watch(%r{^lib/immoscout/([^\\]+)/(.*)\.rb$}) do |m|
|
42
|
+
"spec/#{m[1]}/#{m[2]}_spec.rb"
|
43
|
+
end
|
44
|
+
end
|
data/LICENSE
CHANGED
data/Makefile
CHANGED
@@ -9,6 +9,7 @@ SHELL := bash
|
|
9
9
|
# Environment switches
|
10
10
|
MAKE_ENV ?= docker
|
11
11
|
COMPOSE_RUN_SHELL_FLAGS ?= --rm
|
12
|
+
BASH_RUN_SHELL_FLAGS ?=
|
12
13
|
|
13
14
|
# Directories
|
14
15
|
VENDOR_DIR ?= vendor/bundle
|
@@ -26,13 +27,14 @@ RM ?= rm
|
|
26
27
|
XARGS ?= xargs
|
27
28
|
|
28
29
|
# Container binaries
|
29
|
-
BUNDLE ?= bundle
|
30
30
|
APPRAISAL ?= appraisal
|
31
|
+
BUNDLE ?= bundle
|
31
32
|
GEM ?= gem
|
33
|
+
GUARD ?= guard
|
32
34
|
RAKE ?= rake
|
33
|
-
|
34
|
-
RAKE ?= rake
|
35
|
+
RSPEC ?= rspec
|
35
36
|
RUBOCOP ?= rubocop
|
37
|
+
YARD ?= yard
|
36
38
|
|
37
39
|
# Files
|
38
40
|
GEMFILES ?= $(subst _,-,$(patsubst $(GEMFILES_DIR)/%.gemfile,%,\
|
@@ -46,7 +48,8 @@ define run-shell
|
|
46
48
|
$(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \
|
47
49
|
-e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \
|
48
50
|
-e HOME=/home/web -e BUNDLE_APP_CONFIG=/app/.bundle \
|
49
|
-
-u `$(ID) -u` test
|
51
|
+
-u `$(ID) -u` test \
|
52
|
+
bash $(BASH_RUN_SHELL_FLAGS) -c 'sleep 0.1; echo; $(1)'
|
50
53
|
endef
|
51
54
|
else ifeq ($(MAKE_ENV),baremetal)
|
52
55
|
define run-shell
|
@@ -58,33 +61,52 @@ all:
|
|
58
61
|
# Immoscout
|
59
62
|
#
|
60
63
|
# install Install the dependencies
|
61
|
-
#
|
64
|
+
# update Update the local Gemset dependencies
|
62
65
|
# clean Clean the dependencies
|
63
66
|
#
|
67
|
+
# test Run the whole test suite
|
68
|
+
# test-style Test the code styles
|
69
|
+
# watch Watch for code changes and rerun the test suite
|
70
|
+
#
|
71
|
+
# docs Generate the Ruby documentation of the library
|
72
|
+
# stats Print the code statistics (library and test suite)
|
73
|
+
# notes Print all the notes from the code
|
74
|
+
# release Release a new Gem version (maintainers only)
|
75
|
+
#
|
64
76
|
# shell Run an interactive shell on the container
|
65
77
|
# shell-irb Run an interactive IRB shell on the container
|
66
78
|
|
79
|
+
.interactive:
|
80
|
+
@$(eval BASH_RUN_SHELL_FLAGS = --login)
|
81
|
+
|
67
82
|
install:
|
68
83
|
# Install the dependencies
|
69
84
|
@$(MKDIR) -p $(VENDOR_DIR)
|
70
85
|
@$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
|
71
|
-
@$(call run-shell,GEM_HOME=vendor/bundle/ruby/$${RUBY_MAJOR}.0 \
|
72
|
-
$(GEM) install bundler -v "~> 1.0")
|
73
86
|
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) install)
|
74
87
|
|
75
|
-
update:
|
88
|
+
update:
|
76
89
|
# Install the dependencies
|
77
90
|
@$(MKDIR) -p $(VENDOR_DIR)
|
91
|
+
@$(call run-shell,$(BUNDLE) update)
|
78
92
|
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) update)
|
79
93
|
|
80
|
-
|
94
|
+
watch: install .interactive
|
95
|
+
# Watch for code changes and rerun the test suite
|
96
|
+
@$(call run-shell,$(BUNDLE) exec $(GUARD))
|
97
|
+
|
98
|
+
test: \
|
99
|
+
test-specs \
|
100
|
+
test-style
|
101
|
+
|
102
|
+
test-specs:
|
81
103
|
# Run the whole test suite
|
82
|
-
@$(call run-shell,$(BUNDLE) exec $(RAKE))
|
104
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec)
|
83
105
|
|
84
106
|
$(TEST_GEMFILES): GEMFILE=$(@:test-%=%)
|
85
107
|
$(TEST_GEMFILES):
|
86
108
|
# Run the whole test suite ($(GEMFILE))
|
87
|
-
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(
|
109
|
+
@$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RSPEC))
|
88
110
|
|
89
111
|
test-style: \
|
90
112
|
test-style-ruby
|
@@ -99,8 +121,8 @@ clean:
|
|
99
121
|
@$(RM) -rf $(VENDOR_DIR)/Gemfile.lock
|
100
122
|
@$(RM) -rf $(GEMFILES_DIR)/vendor
|
101
123
|
@$(RM) -rf $(GEMFILES_DIR)/*.lock
|
102
|
-
@$(RM) -rf pkg
|
103
|
-
|
124
|
+
@$(RM) -rf .bundle .yardoc coverage pkg Gemfile.lock doc/api \
|
125
|
+
.rspec_status
|
104
126
|
|
105
127
|
clean-containers:
|
106
128
|
# Clean running containers
|
@@ -111,26 +133,34 @@ endif
|
|
111
133
|
clean-images:
|
112
134
|
# Clean build images
|
113
135
|
ifeq ($(MAKE_ENV),docker)
|
114
|
-
@-$(DOCKER) images | $(GREP)
|
136
|
+
@-$(DOCKER) images | $(GREP) $(shell basename "`pwd`") \
|
115
137
|
| $(AWK) '{ print $$3 }' \
|
116
138
|
| $(XARGS) -rn1 $(DOCKER) rmi -f
|
117
139
|
endif
|
118
140
|
|
119
141
|
distclean: clean clean-containers clean-images
|
120
142
|
|
121
|
-
shell:
|
143
|
+
shell:
|
122
144
|
# Run an interactive shell on the container
|
123
145
|
@$(call run-shell,$(BASH) -i)
|
124
146
|
|
125
|
-
shell-irb:
|
147
|
+
shell-irb:
|
126
148
|
# Run an interactive IRB shell on the container
|
127
149
|
@$(call run-shell,bin/console)
|
128
150
|
|
129
|
-
docs:
|
151
|
+
docs:
|
130
152
|
# Build the API documentation
|
131
153
|
@$(call run-shell,$(BUNDLE) exec $(YARD) -q && \
|
132
154
|
$(BUNDLE) exec $(YARD) stats --list-undoc --compact)
|
133
155
|
|
156
|
+
notes:
|
157
|
+
# Print the code statistics (library and test suite)
|
158
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE) notes)
|
159
|
+
|
160
|
+
stats:
|
161
|
+
# Print all the notes from the code
|
162
|
+
@$(call run-shell,$(BUNDLE) exec $(RAKE) stats)
|
163
|
+
|
134
164
|
release:
|
135
165
|
# Release a new gem version
|
136
166
|
@$(BUNDLE) exec $(RAKE) release
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
![Immoscout](doc/assets/project.svg)
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Continuous Integration](https://github.com/hausgold/immoscout/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/hausgold/immoscout/actions/workflows/test.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/immoscout.svg)](https://badge.fury.io/rb/immoscout)
|
5
|
-
[![
|
6
|
-
[![Test
|
7
|
-
[![API docs](https://
|
5
|
+
[![Test Coverage](https://automate-api.hausgold.de/v1/coverage_reports/immoscout/coverage.svg)](https://knowledge.hausgold.de/coverage)
|
6
|
+
[![Test Ratio](https://automate-api.hausgold.de/v1/coverage_reports/immoscout/ratio.svg)](https://knowledge.hausgold.de/coverage)
|
7
|
+
[![API docs](https://automate-api.hausgold.de/v1/coverage_reports/immoscout/documentation.svg)](https://www.rubydoc.info/gems/immoscout)
|
8
8
|
|
9
9
|
This gem provides an API wrapper for the [Immobilienscout24 REST
|
10
10
|
API](https://api.immobilienscout24.de/our-apis/import-export.html). It provides
|
data/Rakefile
CHANGED
@@ -1,8 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'countless/rake_tasks'
|
5
6
|
|
6
7
|
RSpec::Core::RakeTask.new(:spec)
|
7
8
|
|
8
9
|
task default: :spec
|
10
|
+
|
11
|
+
# Configure all code statistics directories
|
12
|
+
Countless.configure do |config|
|
13
|
+
config.stats_base_directories = [
|
14
|
+
{ name: 'Top-levels', dir: 'lib',
|
15
|
+
pattern: %r{/lib(/immoscout)?/[^/]+\.rb$} },
|
16
|
+
{ name: 'Top-levels specs', test: true, dir: 'spec',
|
17
|
+
pattern: %r{/spec(/immoscout)?/[^/]+_spec\.rb$} },
|
18
|
+
{ name: 'APIs', pattern: 'lib/immoscout/api/**/*.rb' },
|
19
|
+
{ name: 'Errors', pattern: 'lib/immoscout/errors/**/*.rb' },
|
20
|
+
{ name: 'Models', pattern: 'lib/immoscout/models/**/*.rb' },
|
21
|
+
{ name: 'Models specs', test: true,
|
22
|
+
pattern: 'spec/models/**/*_spec.rb' }
|
23
|
+
]
|
24
|
+
end
|
data/gemfiles/rails_5.2.gemfile
CHANGED
data/immoscout.gemspec
CHANGED
@@ -5,55 +5,56 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'immoscout/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
12
|
-
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
|
16
|
-
|
17
|
-
spec.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
25
|
-
else
|
26
|
-
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
27
|
-
'public gem pushes.'
|
28
|
-
end
|
8
|
+
spec.name = 'immoscout'
|
9
|
+
spec.version = Immoscout::VERSION
|
10
|
+
spec.authors = ['Marcus Geissler']
|
11
|
+
spec.email = ['marcus3006@gmail.com']
|
12
|
+
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.summary = 'Ruby client for the Immobilienscout24 REST API'
|
15
|
+
|
16
|
+
base_uri = "https://github.com/hausgold/#{spec.name}"
|
17
|
+
spec.metadata = {
|
18
|
+
'homepage_uri' => base_uri,
|
19
|
+
'source_code_uri' => base_uri,
|
20
|
+
'changelog_uri' => "#{base_uri}/blob/master/CHANGELOG.md",
|
21
|
+
'bug_tracker_uri' => "#{base_uri}/issues",
|
22
|
+
'documentation_uri' => "https://www.rubydoc.info/gems/#{spec.name}"
|
23
|
+
}
|
29
24
|
|
30
25
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
31
26
|
f.match(%r{^(test|spec|features)/})
|
32
27
|
end
|
33
|
-
|
34
|
-
spec.
|
28
|
+
|
29
|
+
spec.bindir = 'exe'
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
31
|
spec.require_paths = ['lib']
|
36
|
-
|
37
|
-
spec.
|
38
|
-
|
32
|
+
|
33
|
+
spec.required_ruby_version = '>= 2.5'
|
34
|
+
|
35
|
+
spec.add_dependency 'activesupport', '>= 5.2'
|
36
|
+
spec.add_dependency 'faraday', '~> 1.10'
|
37
|
+
spec.add_dependency 'faraday_middleware', '~> 1.2'
|
39
38
|
spec.add_dependency 'simple_oauth', '>= 0.3'
|
40
39
|
|
41
|
-
spec.add_development_dependency 'appraisal'
|
42
|
-
spec.add_development_dependency 'bundler', '
|
43
|
-
spec.add_development_dependency '
|
44
|
-
spec.add_development_dependency '
|
45
|
-
spec.add_development_dependency '
|
46
|
-
spec.add_development_dependency '
|
47
|
-
spec.add_development_dependency '
|
48
|
-
spec.add_development_dependency '
|
49
|
-
spec.add_development_dependency 'rspec
|
50
|
-
spec.add_development_dependency '
|
51
|
-
spec.add_development_dependency 'rubocop
|
52
|
-
spec.add_development_dependency '
|
53
|
-
spec.add_development_dependency '
|
54
|
-
spec.add_development_dependency '
|
55
|
-
spec.add_development_dependency '
|
56
|
-
spec.add_development_dependency '
|
57
|
-
spec.add_development_dependency '
|
58
|
-
spec.add_development_dependency '
|
40
|
+
spec.add_development_dependency 'appraisal', '~> 2.4'
|
41
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
42
|
+
spec.add_development_dependency 'countless', '~> 1.1'
|
43
|
+
spec.add_development_dependency 'factory_bot', '~> 6.2'
|
44
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
45
|
+
spec.add_development_dependency 'railties', '>= 5.2'
|
46
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
47
|
+
spec.add_development_dependency 'redcarpet', '~> 3.5'
|
48
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
49
|
+
spec.add_development_dependency 'rspec-json_expectations', '~> 2.2'
|
50
|
+
spec.add_development_dependency 'rubocop', '~> 1.28'
|
51
|
+
spec.add_development_dependency 'rubocop-rails', '~> 2.14'
|
52
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.10'
|
53
|
+
spec.add_development_dependency 'simplecov', '>= 0.22'
|
54
|
+
spec.add_development_dependency 'terminal-table', '~> 3.0'
|
55
|
+
spec.add_development_dependency 'timecop', '>= 0.9.6'
|
56
|
+
spec.add_development_dependency 'vcr', '~> 6.0'
|
57
|
+
spec.add_development_dependency 'webmock', '~> 3.18'
|
58
|
+
spec.add_development_dependency 'yard', '>= 0.9.28'
|
59
|
+
spec.add_development_dependency 'yard-activesupport-concern', '>= 0.0.1'
|
59
60
|
end
|
data/lib/immoscout/api/client.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'singleton'
|
2
|
-
require_relative
|
3
|
-
require_relative
|
4
|
+
require_relative 'connection'
|
5
|
+
require_relative 'request'
|
4
6
|
|
5
7
|
module Immoscout
|
6
8
|
module Api
|
9
|
+
# The immoscout API client object.
|
7
10
|
class Client
|
8
11
|
include Singleton
|
9
12
|
include Immoscout::Api::Connection
|
@@ -1,24 +1,25 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
3
5
|
|
4
6
|
module Immoscout
|
5
7
|
module Api
|
8
|
+
# A connection builder/handler for reusable connections.
|
6
9
|
module Connection
|
7
|
-
# :reek:FeatureEnvy
|
8
10
|
def connection
|
9
11
|
@connection ||= Faraday::Connection.new(url: url) do |builder|
|
10
12
|
configure_oauth(builder)
|
11
|
-
builder.request
|
12
|
-
builder.request
|
13
|
-
builder.request
|
14
|
-
builder.response
|
15
|
-
builder.response
|
16
|
-
builder.adapter
|
13
|
+
builder.request :multipart
|
14
|
+
builder.request :url_encoded
|
15
|
+
builder.request :json
|
16
|
+
builder.response :follow_redirects
|
17
|
+
builder.response :json, content_type: /\bjson$/
|
18
|
+
builder.adapter :net_http
|
17
19
|
end
|
18
|
-
@connection
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
+
protected
|
22
23
|
|
23
24
|
def configure_oauth(builder)
|
24
25
|
builder.request(
|