pricehubble 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +11 -4
- data/.github/workflows/test.yml +5 -21
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -4
- data/Appraisals +10 -0
- data/CHANGELOG.md +9 -0
- data/Dockerfile +3 -3
- data/Gemfile +22 -0
- data/Makefile +4 -1
- data/config/docker/.bashrc +3 -1
- data/doc/examples/authentication.rb +1 -1
- data/doc/examples/complex_property_valuations.rb +1 -1
- data/doc/examples/dossiers.rb +1 -1
- data/doc/examples/property_valuations_errors.rb +1 -1
- data/doc/examples/simple_property_valuations.rb +1 -1
- data/gemfiles/rails_5.2.gemfile +18 -0
- data/gemfiles/rails_6.1.gemfile +26 -0
- data/gemfiles/rails_7.1.gemfile +26 -0
- data/lib/{pricehubble → price_hubble}/client/response/recursive_open_struct.rb +1 -1
- data/lib/{pricehubble → price_hubble}/entity/concern/associations.rb +3 -3
- data/lib/{pricehubble → price_hubble}/entity/concern/attributes.rb +4 -4
- data/lib/{pricehubble → price_hubble}/version.rb +1 -1
- data/lib/price_hubble.rb +111 -1
- data/lib/pricehubble +1 -0
- data/lib/pricehubble.rb +1 -110
- data/pricehubble.gemspec +2 -21
- metadata +51 -301
- data/.github/workflows/documentation.yml +0 -39
- /data/lib/{pricehubble → price_hubble}/client/authentication.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/base.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/dossiers.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/request/data_sanitization.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/request/default_headers.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/response/data_sanitization.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/utils/request.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/utils/response.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client/valuation.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/client.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/configuration.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/configuration_handling.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/core_ext/hash.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/address.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/authentication.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/base_entity.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/concern/attributes/date_array.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/concern/attributes/enum.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/concern/attributes/range.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/concern/attributes/string_inquirer.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/concern/callbacks.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/concern/client.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/concern/persistence.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/coordinates.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/dossier.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/location.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/property.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/property_conditions.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/property_qualities.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/property_type.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/valuation.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/valuation_request.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/entity/valuation_scores.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/errors.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/faraday.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/identity.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/instrumentation/log_subscriber.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/instrumentation.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/railtie.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/utils/bangers.rb +0 -0
- /data/lib/{pricehubble → price_hubble}/utils/decision.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c76e2916270f0c409b580c65d1eb2fa643d8f12c8ea99c78eaa70e5c0d269e55
|
4
|
+
data.tar.gz: 7b868dd15db432d2c1265f0e16cd77355302fcff81b08b31846bc5e427bd54b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bdb415913b515caff0277c5b6eea96b39a161dfc1591fd49ef68de7434500071051276fb32adbd594f55295a8b7e7e56e4b0b6feac270deb0f96736bdb41919
|
7
|
+
data.tar.gz: e7ca73eb5a014d3d184c569425a9c0e561175361c0aaae3b58e04ab6b3d62a2669c2bcf8a561887a2f55d7ef093195751aae4f81817461146bb5f2bd4a406485
|
@@ -18,19 +18,20 @@ jobs:
|
|
18
18
|
runs-on: ubuntu-22.04
|
19
19
|
timeout-minutes: 5
|
20
20
|
steps:
|
21
|
-
- uses: actions/checkout@
|
21
|
+
- uses: actions/checkout@v4
|
22
22
|
|
23
|
-
- name: Install Ruby 2.
|
23
|
+
- name: Install Ruby 2.7
|
24
24
|
uses: ruby/setup-ruby@v1
|
25
25
|
with:
|
26
|
-
ruby-version: 2.
|
26
|
+
ruby-version: 2.7
|
27
27
|
bundler-cache: true
|
28
|
-
rubygems: '3.
|
28
|
+
rubygems: '3.4.22'
|
29
29
|
|
30
30
|
- name: Prepare the virtual environment
|
31
31
|
uses: hausgold/actions/ci@master
|
32
32
|
with:
|
33
33
|
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
34
|
+
settings_secret_key: '${{ secrets.SETTINGS_SECRET_KEY }}'
|
34
35
|
settings: '${{ github.repository }}'
|
35
36
|
target: ci/gem-test
|
36
37
|
|
@@ -45,3 +46,9 @@ jobs:
|
|
45
46
|
|
46
47
|
- name: Push the release Git commit/tag and package to the registry
|
47
48
|
run: make release
|
49
|
+
|
50
|
+
- name: Build and upload application documentation
|
51
|
+
run: api-docs && coverage --docs-only
|
52
|
+
env:
|
53
|
+
WORKFLOW_DISPATCH_TOKEN: '${{ secrets.WORKFLOW_DISPATCH_TOKEN }}'
|
54
|
+
GITHUB_TAG: 'v${{ github.event.inputs.VERSION }}'
|
data/.github/workflows/test.yml
CHANGED
@@ -18,24 +18,25 @@ jobs:
|
|
18
18
|
strategy:
|
19
19
|
fail-fast: false
|
20
20
|
matrix:
|
21
|
-
ruby: ['2.
|
22
|
-
rails: ['5.2']
|
21
|
+
ruby: ['2.7']
|
22
|
+
rails: ['5.2', '6.1', '7.1']
|
23
23
|
env:
|
24
24
|
BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
|
25
25
|
steps:
|
26
|
-
- uses: actions/checkout@
|
26
|
+
- uses: actions/checkout@v4
|
27
27
|
|
28
28
|
- name: Install the correct Ruby version
|
29
29
|
uses: ruby/setup-ruby@v1
|
30
30
|
with:
|
31
31
|
ruby-version: ${{ matrix.ruby }}
|
32
32
|
bundler-cache: true
|
33
|
-
rubygems: '3.
|
33
|
+
rubygems: '3.4.22'
|
34
34
|
|
35
35
|
- name: Prepare the virtual environment
|
36
36
|
uses: hausgold/actions/ci@master
|
37
37
|
with:
|
38
38
|
clone_token: '${{ secrets.CLONE_TOKEN }}'
|
39
|
+
settings_secret_key: '${{ secrets.SETTINGS_SECRET_KEY }}'
|
39
40
|
settings: '${{ github.repository }}'
|
40
41
|
target: ci/gem-test
|
41
42
|
|
@@ -44,20 +45,3 @@ jobs:
|
|
44
45
|
|
45
46
|
- name: Upload the code coverage report
|
46
47
|
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/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -12,7 +12,7 @@ AllCops:
|
|
12
12
|
NewCops: enable
|
13
13
|
SuggestExtensions: false
|
14
14
|
DisplayCopNames: true
|
15
|
-
TargetRubyVersion: 2.
|
15
|
+
TargetRubyVersion: 2.7
|
16
16
|
TargetRailsVersion: 5.2
|
17
17
|
Exclude:
|
18
18
|
- bin/**/*
|
@@ -28,9 +28,9 @@ Metrics/BlockLength:
|
|
28
28
|
- '**/*.rake'
|
29
29
|
- doc/**/*.rb
|
30
30
|
# Concerns and middlewares contain by nature long blocks
|
31
|
-
- lib/
|
32
|
-
- lib/
|
33
|
-
- lib/
|
31
|
+
- lib/price*hubble/entity/concern/**/*.rb
|
32
|
+
- lib/price*hubble/client/request/**/*.rb
|
33
|
+
- lib/price*hubble/client/response/**/*.rb
|
34
34
|
|
35
35
|
# Our examples use +pp+ a lot
|
36
36
|
Lint/Debugger:
|
data/Appraisals
CHANGED
@@ -4,3 +4,13 @@ appraise 'rails-5.2' do
|
|
4
4
|
gem 'activemodel', '~> 5.2.0'
|
5
5
|
gem 'activesupport', '~> 5.2.0'
|
6
6
|
end
|
7
|
+
|
8
|
+
appraise 'rails-6.1' do
|
9
|
+
gem 'activemodel', '~> 6.1.0'
|
10
|
+
gem 'activesupport', '~> 6.1.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise 'rails-7.1' do
|
14
|
+
gem 'activemodel', '~> 7.1.0'
|
15
|
+
gem 'activesupport', '~> 7.1.0'
|
16
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
4
4
|
|
5
|
+
### 1.2.1
|
6
|
+
|
7
|
+
* Added API docs building to continuous integration (#9)
|
8
|
+
|
9
|
+
### 1.2.0
|
10
|
+
|
11
|
+
* Moved the development dependencies from the gemspec to the Gemfile (#7)
|
12
|
+
* Dropped support for Ruby <2.7 (#8)
|
13
|
+
|
5
14
|
### 1.1.0
|
6
15
|
|
7
16
|
* Added support for Gem release automation
|
data/Dockerfile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
FROM hausgold/ruby:2.
|
1
|
+
FROM hausgold/ruby:2.7
|
2
2
|
MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
|
3
3
|
|
4
4
|
# Update system gem
|
5
|
-
RUN gem update --system '3.
|
5
|
+
RUN gem update --system '3.4.22'
|
6
6
|
|
7
7
|
# Install system packages and the latest bundler
|
8
8
|
RUN apt-get update -yqqq && \
|
@@ -11,7 +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.
|
14
|
+
gem install bundler -v '~> 2.4.22' --no-document --no-prerelease
|
15
15
|
|
16
16
|
# Add new web user
|
17
17
|
RUN mkdir /app && \
|
data/Gemfile
CHANGED
@@ -6,3 +6,25 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
6
6
|
|
7
7
|
# Specify your gem's dependencies in price_hubble.gemspec
|
8
8
|
gemspec
|
9
|
+
|
10
|
+
# Development dependencies
|
11
|
+
gem 'appraisal', '~> 2.4'
|
12
|
+
gem 'bundler', '~> 2.3'
|
13
|
+
gem 'countless', '~> 1.1'
|
14
|
+
# TODO: Remove the upper lock when
|
15
|
+
# https://github.com/thoughtbot/factory_bot/issues/1614 is solved.
|
16
|
+
gem 'factory_bot', '~> 6.2', '< 6.4.5'
|
17
|
+
gem 'guard-rspec', '~> 4.7'
|
18
|
+
gem 'rake', '~> 13.0'
|
19
|
+
gem 'redcarpet', '~> 3.5'
|
20
|
+
gem 'rspec', '~> 3.12'
|
21
|
+
gem 'rubocop', '~> 1.28'
|
22
|
+
gem 'rubocop-rails', '~> 2.14'
|
23
|
+
gem 'rubocop-rspec', '~> 2.10'
|
24
|
+
gem 'simplecov', '>= 0.22'
|
25
|
+
gem 'terminal-table', '~> 3.0'
|
26
|
+
gem 'timecop', '>= 0.9.6'
|
27
|
+
gem 'vcr', '~> 6.0'
|
28
|
+
gem 'webmock', '~> 3.18'
|
29
|
+
gem 'yard', '>= 0.9.28'
|
30
|
+
gem 'yard-activesupport-concern', '>= 0.0.1'
|
data/Makefile
CHANGED
@@ -24,6 +24,7 @@ GREP ?= grep
|
|
24
24
|
ID ?= id
|
25
25
|
MKDIR ?= mkdir
|
26
26
|
RM ?= rm
|
27
|
+
TEST ?= test
|
27
28
|
XARGS ?= xargs
|
28
29
|
|
29
30
|
# Container binaries
|
@@ -35,6 +36,7 @@ RAKE ?= rake
|
|
35
36
|
RSPEC ?= rspec
|
36
37
|
RUBOCOP ?= rubocop
|
37
38
|
YARD ?= yard
|
39
|
+
RUBY_VERSION := ruby-version
|
38
40
|
|
39
41
|
# Files
|
40
42
|
GEMFILES ?= $(subst _,-,$(patsubst $(GEMFILES_DIR)/%.gemfile,%,\
|
@@ -113,7 +115,8 @@ test-style: \
|
|
113
115
|
|
114
116
|
test-style-ruby:
|
115
117
|
# Run the static code analyzer (rubocop)
|
116
|
-
@$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a
|
118
|
+
@$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a \
|
119
|
+
|| ($(TEST) $$($(RUBY_VERSION)) != '2.7' && true))
|
117
120
|
|
118
121
|
clean:
|
119
122
|
# Clean the dependencies
|
data/config/docker/.bashrc
CHANGED
@@ -16,7 +16,9 @@ sudo sed -i 's/autostart=.*/autostart=false/g' /etc/supervisor/conf.d/*
|
|
16
16
|
sudo supervisord >/dev/null 2>&1 &
|
17
17
|
|
18
18
|
# Wait for supervisord
|
19
|
-
while ! supervisorctl status >/dev/null 2>&1; do
|
19
|
+
while ! (sudo supervisorctl status | grep avahi) >/dev/null 2>&1; do
|
20
|
+
sleep 1
|
21
|
+
done
|
20
22
|
|
21
23
|
# Boot the mDNS stack
|
22
24
|
echo '# Start the mDNS stack'
|
data/doc/examples/dossiers.rb
CHANGED
data/gemfiles/rails_5.2.gemfile
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
+
gem "appraisal", "~> 2.4"
|
6
|
+
gem "bundler", "~> 2.3"
|
7
|
+
gem "countless", "~> 1.1"
|
8
|
+
gem "factory_bot", "~> 6.2", "< 6.4.5"
|
9
|
+
gem "guard-rspec", "~> 4.7"
|
10
|
+
gem "rake", "~> 13.0"
|
11
|
+
gem "redcarpet", "~> 3.5"
|
12
|
+
gem "rspec", "~> 3.12"
|
13
|
+
gem "rubocop", "~> 1.28"
|
14
|
+
gem "rubocop-rails", "~> 2.14"
|
15
|
+
gem "rubocop-rspec", "~> 2.10"
|
16
|
+
gem "simplecov", ">= 0.22"
|
17
|
+
gem "terminal-table", "~> 3.0"
|
18
|
+
gem "timecop", ">= 0.9.6"
|
19
|
+
gem "vcr", "~> 6.0"
|
20
|
+
gem "webmock", "~> 3.18"
|
21
|
+
gem "yard", ">= 0.9.28"
|
22
|
+
gem "yard-activesupport-concern", ">= 0.0.1"
|
5
23
|
gem "activemodel", "~> 5.2.0"
|
6
24
|
gem "activesupport", "~> 5.2.0"
|
7
25
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 2.4"
|
6
|
+
gem "bundler", "~> 2.3"
|
7
|
+
gem "countless", "~> 1.1"
|
8
|
+
gem "factory_bot", "~> 6.2", "< 6.4.5"
|
9
|
+
gem "guard-rspec", "~> 4.7"
|
10
|
+
gem "rake", "~> 13.0"
|
11
|
+
gem "redcarpet", "~> 3.5"
|
12
|
+
gem "rspec", "~> 3.12"
|
13
|
+
gem "rubocop", "~> 1.28"
|
14
|
+
gem "rubocop-rails", "~> 2.14"
|
15
|
+
gem "rubocop-rspec", "~> 2.10"
|
16
|
+
gem "simplecov", ">= 0.22"
|
17
|
+
gem "terminal-table", "~> 3.0"
|
18
|
+
gem "timecop", ">= 0.9.6"
|
19
|
+
gem "vcr", "~> 6.0"
|
20
|
+
gem "webmock", "~> 3.18"
|
21
|
+
gem "yard", ">= 0.9.28"
|
22
|
+
gem "yard-activesupport-concern", ">= 0.0.1"
|
23
|
+
gem "activemodel", "~> 6.1.0"
|
24
|
+
gem "activesupport", "~> 6.1.0"
|
25
|
+
|
26
|
+
gemspec path: "../"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 2.4"
|
6
|
+
gem "bundler", "~> 2.3"
|
7
|
+
gem "countless", "~> 1.1"
|
8
|
+
gem "factory_bot", "~> 6.2", "< 6.4.5"
|
9
|
+
gem "guard-rspec", "~> 4.7"
|
10
|
+
gem "rake", "~> 13.0"
|
11
|
+
gem "redcarpet", "~> 3.5"
|
12
|
+
gem "rspec", "~> 3.12"
|
13
|
+
gem "rubocop", "~> 1.28"
|
14
|
+
gem "rubocop-rails", "~> 2.14"
|
15
|
+
gem "rubocop-rspec", "~> 2.10"
|
16
|
+
gem "simplecov", ">= 0.22"
|
17
|
+
gem "terminal-table", "~> 3.0"
|
18
|
+
gem "timecop", ">= 0.9.6"
|
19
|
+
gem "vcr", "~> 6.0"
|
20
|
+
gem "webmock", "~> 3.18"
|
21
|
+
gem "yard", ">= 0.9.28"
|
22
|
+
gem "yard-activesupport-concern", ">= 0.0.1"
|
23
|
+
gem "activemodel", "~> 7.1.0"
|
24
|
+
gem "activesupport", "~> 7.1.0"
|
25
|
+
|
26
|
+
gemspec path: "../"
|
@@ -144,12 +144,12 @@ module PriceHubble
|
|
144
144
|
def has_one(entity, **args)
|
145
145
|
# Sanitize options
|
146
146
|
entity = entity.to_sym
|
147
|
-
opts = { class_name: nil, from: entity, persist: false }
|
147
|
+
opts = { class_name: nil, from: entity, persist: false }
|
148
148
|
.merge(args).merge(type: :has_one)
|
149
149
|
# Resolve the given entity to a class name, when no explicit class
|
150
150
|
# name was given via options
|
151
151
|
if opts[:class_name].nil?
|
152
|
-
opts[:class_name] =
|
152
|
+
opts[:class_name] =
|
153
153
|
entity.to_s.camelcase.prepend('PriceHubble::').constantize
|
154
154
|
end
|
155
155
|
# Register the association
|
@@ -176,7 +176,7 @@ module PriceHubble
|
|
176
176
|
def has_many(entity, **args)
|
177
177
|
# Sanitize options
|
178
178
|
entity = entity.to_sym
|
179
|
-
opts = { class_name: nil, from: entity, persist: false }
|
179
|
+
opts = { class_name: nil, from: entity, persist: false }
|
180
180
|
.merge(args).merge(type: :has_many)
|
181
181
|
# Resolve the given entity to a class name, when no explicit class
|
182
182
|
# name was given via options
|
@@ -32,11 +32,11 @@ module PriceHubble
|
|
32
32
|
reader = key
|
33
33
|
|
34
34
|
if sanitize
|
35
|
-
sanitizer = "sanitize_attr_#{key}"
|
35
|
+
sanitizer = :"sanitize_attr_#{key}"
|
36
36
|
reader = methods.include?(sanitizer) ? sanitizer : key
|
37
37
|
|
38
|
-
key_sanitizer = "sanitize_attr_key_#{key}"
|
39
|
-
key =
|
38
|
+
key_sanitizer = :"sanitize_attr_key_#{key}"
|
39
|
+
key = send(key_sanitizer) if methods.include?(key_sanitizer)
|
40
40
|
end
|
41
41
|
|
42
42
|
result = resolve_attributes(send(reader))
|
@@ -124,7 +124,7 @@ module PriceHubble
|
|
124
124
|
# Substract known keys, to move them to the +_unmapped+ variable
|
125
125
|
attribute_names.each { |key| struct.delete_field(key) }
|
126
126
|
# Merge the previous unmapped struct and the given data
|
127
|
-
self._unmapped =
|
127
|
+
self._unmapped =
|
128
128
|
::RecursiveOpenStruct.new(_unmapped.to_h.merge(struct.to_h),
|
129
129
|
recurse_over_arrays: true)
|
130
130
|
# Allow mass assignment of known attributes
|
data/lib/price_hubble.rb
CHANGED
@@ -1,3 +1,113 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/concern'
|
5
|
+
require 'active_support/configurable'
|
6
|
+
require 'active_support/time'
|
7
|
+
require 'active_support/time_with_zone'
|
8
|
+
require 'active_support/core_ext/object'
|
9
|
+
require 'active_support/core_ext/module'
|
10
|
+
require 'active_support/core_ext/hash'
|
11
|
+
require 'active_support/core_ext/string'
|
12
|
+
require 'active_model'
|
13
|
+
require 'recursive-open-struct'
|
14
|
+
require 'faraday'
|
15
|
+
require 'faraday_middleware'
|
16
|
+
|
17
|
+
# Load polyfills if needed
|
18
|
+
require 'price_hubble/core_ext/hash'
|
19
|
+
|
20
|
+
# The top level namespace for the PriceHubble gem.
|
21
|
+
module PriceHubble
|
22
|
+
# Top level elements
|
23
|
+
autoload :Configuration, 'price_hubble/configuration'
|
24
|
+
autoload :ConfigurationHandling, 'price_hubble/configuration_handling'
|
25
|
+
autoload :Client, 'price_hubble/client'
|
26
|
+
autoload :Identity, 'price_hubble/identity'
|
27
|
+
autoload :Instrumentation, 'price_hubble/instrumentation'
|
28
|
+
|
29
|
+
# Entities
|
30
|
+
autoload :BaseEntity, 'price_hubble/entity/base_entity'
|
31
|
+
autoload :Authentication, 'price_hubble/entity/authentication'
|
32
|
+
autoload :Valuation, 'price_hubble/entity/valuation'
|
33
|
+
autoload :ValuationScores, 'price_hubble/entity/valuation_scores'
|
34
|
+
autoload :ValuationRequest, 'price_hubble/entity/valuation_request'
|
35
|
+
autoload :Property, 'price_hubble/entity/property'
|
36
|
+
autoload :PropertyConditions, 'price_hubble/entity/property_conditions'
|
37
|
+
autoload :PropertyQualities, 'price_hubble/entity/property_qualities'
|
38
|
+
autoload :PropertyType, 'price_hubble/entity/property_type'
|
39
|
+
autoload :Location, 'price_hubble/entity/location'
|
40
|
+
autoload :Address, 'price_hubble/entity/address'
|
41
|
+
autoload :Coordinates, 'price_hubble/entity/coordinates'
|
42
|
+
autoload :Dossier, 'price_hubble/entity/dossier'
|
43
|
+
|
44
|
+
# Some general purpose utilities
|
45
|
+
module Utils
|
46
|
+
autoload :Decision, 'price_hubble/utils/decision'
|
47
|
+
autoload :Bangers, 'price_hubble/utils/bangers'
|
48
|
+
end
|
49
|
+
|
50
|
+
# Instrumentation
|
51
|
+
module Instrumentation
|
52
|
+
autoload :LogSubscriber, 'price_hubble/instrumentation/log_subscriber'
|
53
|
+
end
|
54
|
+
|
55
|
+
# Dedicated application HTTP (low level) client
|
56
|
+
module Client
|
57
|
+
# All our utilities used for the low level client
|
58
|
+
module Utils
|
59
|
+
autoload :Request, 'price_hubble/client/utils/request'
|
60
|
+
autoload :Response, 'price_hubble/client/utils/response'
|
61
|
+
end
|
62
|
+
|
63
|
+
# Faraday request middlewares
|
64
|
+
module Request
|
65
|
+
autoload :DataSanitization,
|
66
|
+
'price_hubble/client/request/data_sanitization'
|
67
|
+
autoload :DefaultHeaders, 'price_hubble/client/request/default_headers'
|
68
|
+
end
|
69
|
+
|
70
|
+
# Faraday response middlewares
|
71
|
+
module Response
|
72
|
+
autoload :DataSanitization,
|
73
|
+
'price_hubble/client/response/data_sanitization'
|
74
|
+
autoload :RecursiveOpenStruct,
|
75
|
+
'price_hubble/client/response/recursive_open_struct'
|
76
|
+
end
|
77
|
+
|
78
|
+
autoload :Base, 'price_hubble/client/base'
|
79
|
+
autoload :Authentication, 'price_hubble/client/authentication'
|
80
|
+
autoload :Valuation, 'price_hubble/client/valuation'
|
81
|
+
autoload :Dossiers, 'price_hubble/client/dossiers'
|
82
|
+
end
|
83
|
+
|
84
|
+
# Separated features of an entity instance
|
85
|
+
module EntityConcern
|
86
|
+
autoload :Callbacks, 'price_hubble/entity/concern/callbacks'
|
87
|
+
autoload :Attributes, 'price_hubble/entity/concern/attributes'
|
88
|
+
autoload :Associations, 'price_hubble/entity/concern/associations'
|
89
|
+
autoload :Client, 'price_hubble/entity/concern/client'
|
90
|
+
autoload :Persistence, 'price_hubble/entity/concern/persistence'
|
91
|
+
|
92
|
+
# Some custom typed attribute helpers
|
93
|
+
module Attributes
|
94
|
+
base = 'price_hubble/entity/concern/attributes'
|
95
|
+
autoload :DateArray, "#{base}/date_array"
|
96
|
+
autoload :Enum, "#{base}/enum"
|
97
|
+
autoload :Range, "#{base}/range"
|
98
|
+
autoload :StringInquirer, "#{base}/string_inquirer"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Load standalone code
|
103
|
+
require 'price_hubble/version'
|
104
|
+
require 'price_hubble/errors'
|
105
|
+
require 'price_hubble/faraday'
|
106
|
+
require 'price_hubble/railtie' if defined? Rails
|
107
|
+
|
108
|
+
# Include top-level features
|
109
|
+
include PriceHubble::ConfigurationHandling
|
110
|
+
include PriceHubble::Client
|
111
|
+
include PriceHubble::Identity
|
112
|
+
include PriceHubble::Instrumentation
|
113
|
+
end
|
data/lib/pricehubble
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
price_hubble
|