pricehubble 0.4.1 → 1.0.0

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: a1c2e582e583c4400274fdd33ec9b4150ce4910a8bd6b8aeec4cbf029378bc89
4
- data.tar.gz: 2edaa056bc36349f835250e4a55414022b55a0773c0d215c35c706bd023cd925
3
+ metadata.gz: 3f1ed8db96f0efa1edf1011116a4269e35a075b9b162b13d68a4e6c08d81d9cb
4
+ data.tar.gz: 00b1e03b3c0f76e577c2fdea0108c03d9743a6bfe73c00d71b4183e2f9b0aa05
5
5
  SHA512:
6
- metadata.gz: 8ac3db724b8f3f60e1a760b36f248772b601824ea63cd24bcfedcefe6ba31128bfaf8d0956280335775c5bf5a5faae652cb6348b11c700f2aff1c91a0179c37e
7
- data.tar.gz: 566857d2fb6ce6163b55cbc2d3d3c46ecedd20e46565bde0aedb205902c7aca01c99f689d60fb38afce263a7f87c47cdca00dba928d426b64a11c6241234d937
6
+ metadata.gz: 8822ad28938b426cd42242cbeebacf6c4697eb17187343c3478e415a9ade67add42c13d0c01bd378efaab3f0252d6e7916e7ce9a48055b5bb9060553467bffb3
7
+ data.tar.gz: 0fcc8813a696d6c64e9dc8ba70676ee129621189bee80da841c3d02b96f6587fa99a4d72bf312dc300fa484798d801c46152543d7136c9a7880dfd34baeae6bc
@@ -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
@@ -1,3 +1,3 @@
1
+ --backtrace
2
+ --force-color
1
3
  --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml CHANGED
@@ -1,19 +1,24 @@
1
- require: rubocop-rspec
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-rails
2
4
 
3
5
  Rails:
4
6
  Enabled: true
5
7
 
6
- Documentation:
8
+ Style/Documentation:
7
9
  Enabled: true
8
10
 
9
11
  AllCops:
12
+ NewCops: enable
13
+ SuggestExtensions: false
10
14
  DisplayCopNames: true
11
15
  TargetRubyVersion: 2.5
16
+ TargetRailsVersion: 5.2
12
17
  Exclude:
13
18
  - bin/**/*
14
19
  - vendor/**/*
15
20
  - build/**/*
16
- - gemfiles/vendor/**/*
21
+ - gemfiles/**/*
17
22
 
18
23
  Metrics/BlockLength:
19
24
  Exclude:
@@ -27,6 +32,10 @@ Metrics/BlockLength:
27
32
  - lib/pricehubble/client/request/**/*.rb
28
33
  - lib/pricehubble/client/response/**/*.rb
29
34
 
35
+ # MFA is not yet enabled for our gems yet.
36
+ Gemspec/RequireMFA:
37
+ Enabled: false
38
+
30
39
  # Document all the things.
31
40
  Style/DocumentationMethod:
32
41
  Enabled: true
@@ -63,5 +72,20 @@ Lint/ShadowingOuterLocalVariable:
63
72
 
64
73
  # We stay at 80 characters per line.
65
74
  # See: https://rubystyle.guide/#max-line-length
66
- Metrics/LineLength:
75
+ Layout/LineLength:
67
76
  Max: 80
77
+
78
+ # We use memoized helpers all over the place to construct inputs and output
79
+ # which can be customized at nested contexts easily.
80
+ RSpec/MultipleMemoizedHelpers:
81
+ Enabled: false
82
+
83
+ # That are false-positives because we implement similar working
84
+ # helpers for associations like +.has_one+.
85
+ Rails/ReflectionClassName:
86
+ Enabled: false
87
+
88
+ # A very nice feature, but it does not work for non-method code parts atow.
89
+ # So just disabling it for now.
90
+ Style/DocumentDynamicEvalDefinition:
91
+ 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/Appraisals CHANGED
@@ -1,13 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  appraise 'rails-5.2' do
4
- gem 'activemodel', '~> 5.2.2'
5
- gem 'activesupport', '~> 5.2.2'
6
- gem 'railties', '~> 5.2.2'
7
- end
8
-
9
- appraise 'rails-6.0' do
10
- gem 'activemodel', '~> 6.0.0'
11
- gem 'activesupport', '~> 6.0.0'
12
- gem 'railties', '~> 6.0.0'
4
+ gem 'activemodel', '~> 5.2.0'
5
+ gem 'activesupport', '~> 5.2.0'
13
6
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 1.0.0
2
+
3
+ * Bundler >= 2.3 is from now on required as minimal version (#5)
4
+ * Dropped support for Ruby < 2.5 (#5)
5
+ * Dropped support for Rails < 5.2 (#5)
6
+ * Updated all development/runtime gems to their latest
7
+ Ruby 2.5 compatible version (#5)
8
+ * [Breaking Change] The `sanitize` argument of the
9
+ `PriceHubble::BaseEntity#attributes(sanitize = false)` method has changed to
10
+ a keyword argument `PriceHubble::BaseEntity#attributes(sanitize: false)` (#5)
11
+
12
+ ### 0.4.2
13
+
14
+ * Migrated to Github Actions
15
+ * Migrated to our own coverage reporting
16
+ * Added the code statistics to the test process
17
+
1
18
  ### 0.4.1
2
19
 
3
20
  * 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/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/pricehubble.rb}) { 'spec' }
37
+ watch(%r{^spec/.+_spec\.rb$})
38
+ watch(%r{^lib/pricehubble/([^\\]+)\.rb$}) do |m|
39
+ "spec/pricehubble/#{m[1]}_spec.rb"
40
+ end
41
+ watch(%r{^lib/pricehubble/([^\\]+)/(.*)\.rb$}) do |m|
42
+ "spec/#{m[1]}/#{m[2]}_spec.rb"
43
+ end
44
+ end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 HAUSGOLD | talocasa GmbH
3
+ Copyright (c) 2023 HAUSGOLD | talocasa GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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
- YARD ?= yard
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 bash -c 'sleep 0.1; echo; $(1)'
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
@@ -63,6 +66,7 @@ all:
63
66
  #
64
67
  # test Run the whole test suite
65
68
  # test-style Test the code styles
69
+ # watch Watch for code changes and rerun the test suite
66
70
  #
67
71
  # docs Generate the Ruby documentation of the library
68
72
  # stats Print the code statistics (library and test suite)
@@ -72,27 +76,37 @@ all:
72
76
  # shell Run an interactive shell on the container
73
77
  # shell-irb Run an interactive IRB shell on the container
74
78
 
79
+ .interactive:
80
+ @$(eval BASH_RUN_SHELL_FLAGS = --login)
81
+
75
82
  install:
76
83
  # Install the dependencies
77
84
  @$(MKDIR) -p $(VENDOR_DIR)
78
85
  @$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
79
- @$(call run-shell,GEM_HOME=vendor/bundle/ruby/$${RUBY_MAJOR}.0 \
80
- $(GEM) install bundler -v "~> 1.0")
81
86
  @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) install)
82
87
 
83
- update: install
88
+ update:
84
89
  # Install the dependencies
85
90
  @$(MKDIR) -p $(VENDOR_DIR)
91
+ @$(call run-shell,$(BUNDLE) update)
86
92
  @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) update)
87
93
 
88
- test: #install
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:
89
103
  # Run the whole test suite
90
- @$(call run-shell,$(BUNDLE) exec $(RAKE))
104
+ @$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec)
91
105
 
92
106
  $(TEST_GEMFILES): GEMFILE=$(@:test-%=%)
93
107
  $(TEST_GEMFILES):
94
108
  # Run the whole test suite ($(GEMFILE))
95
- @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RAKE))
109
+ @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RSPEC))
96
110
 
97
111
  test-style: \
98
112
  test-style-ruby
@@ -107,8 +121,8 @@ clean:
107
121
  @$(RM) -rf $(VENDOR_DIR)/Gemfile.lock
108
122
  @$(RM) -rf $(GEMFILES_DIR)/vendor
109
123
  @$(RM) -rf $(GEMFILES_DIR)/*.lock
110
- @$(RM) -rf pkg
111
- @$(RM) -rf coverage
124
+ @$(RM) -rf .bundle .yardoc coverage pkg Gemfile.lock doc/api \
125
+ .rspec_status
112
126
 
113
127
  clean-containers:
114
128
  # Clean running containers
@@ -119,31 +133,31 @@ endif
119
133
  clean-images:
120
134
  # Clean build images
121
135
  ifeq ($(MAKE_ENV),docker)
122
- @-$(DOCKER) images | $(GREP) pricehubble \
136
+ @-$(DOCKER) images | $(GREP) $(shell basename "`pwd`") \
123
137
  | $(AWK) '{ print $$3 }' \
124
138
  | $(XARGS) -rn1 $(DOCKER) rmi -f
125
139
  endif
126
140
 
127
141
  distclean: clean clean-containers clean-images
128
142
 
129
- shell: install
143
+ shell:
130
144
  # Run an interactive shell on the container
131
145
  @$(call run-shell,$(BASH) -i)
132
146
 
133
- shell-irb: install
147
+ shell-irb:
134
148
  # Run an interactive IRB shell on the container
135
149
  @$(call run-shell,bin/console)
136
150
 
137
- docs: install
151
+ docs:
138
152
  # Build the API documentation
139
153
  @$(call run-shell,$(BUNDLE) exec $(YARD) -q && \
140
154
  $(BUNDLE) exec $(YARD) stats --list-undoc --compact)
141
155
 
142
- notes: install
156
+ notes:
143
157
  # Print the code statistics (library and test suite)
144
158
  @$(call run-shell,$(BUNDLE) exec $(RAKE) notes)
145
159
 
146
- stats: install
160
+ stats:
147
161
  # Print all the notes from the code
148
162
  @$(call run-shell,$(BUNDLE) exec $(RAKE) stats)
149
163
 
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ![PriceHubble](doc/assets/project.svg)
2
2
 
3
- [![Build Status](https://travis-ci.com/hausgold/pricehubble.svg?token=4XcyqxxmkyBSSV3wWRt7&branch=master)](https://travis-ci.com/hausgold/pricehubble)
3
+ [![Continuous Integration](https://github.com/hausgold/pricehubble/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/hausgold/pricehubble/actions/workflows/test.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/pricehubble.svg)](https://badge.fury.io/rb/pricehubble)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/cd15f59fc84566e4b200/maintainability)](https://codeclimate.com/repos/5da572bd60163201b800c255/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/cd15f59fc84566e4b200/test_coverage)](https://codeclimate.com/repos/5da572bd60163201b800c255/test_coverage)
7
- [![API docs](https://img.shields.io/badge/docs-API-blue.svg)](https://www.rubydoc.info/gems/pricehubble)
5
+ [![Test Coverage](https://automate-api.hausgold.de/v1/coverage_reports/pricehubble/coverage.svg)](https://knowledge.hausgold.de/coverage)
6
+ [![Test Ratio](https://automate-api.hausgold.de/v1/coverage_reports/pricehubble/ratio.svg)](https://knowledge.hausgold.de/coverage)
7
+ [![API docs](https://automate-api.hausgold.de/v1/coverage_reports/pricehubble/documentation.svg)](https://www.rubydoc.info/gems/pricehubble)
8
8
 
9
9
  This project is dedicated to build a client/API wrapper around the
10
10
  [PriceHubble](https://pricehubble.com) REST API. It follows strictly the
data/Rakefile CHANGED
@@ -2,79 +2,30 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
- require 'rails/code_statistics'
6
- require 'pp'
5
+ require 'countless/rake_tasks'
7
6
 
8
7
  RSpec::Core::RakeTask.new(:spec)
9
8
 
10
9
  task default: :spec
11
10
 
12
- # Load some railties tasks
13
- load 'rails/tasks/statistics.rake'
14
- load 'rails/tasks/annotations.rake'
15
-
16
- # Clear the default statistics directory constant
17
- #
18
- # rubocop:disable Style/MutableConstant because we define it
19
- Object.send(:remove_const, :STATS_DIRECTORIES)
20
- ::STATS_DIRECTORIES = []
21
- # rubocop:enable Style/MutableConstant
22
-
23
- # Monkey patch the Rails +CodeStatistics+ class to support configurable
24
- # patterns per path. This is reuqired to support top-level only file matches.
25
- class CodeStatistics
26
- DEFAULT_PATTERN = /^(?!\.).*?\.(rb|js|coffee|rake)$/.freeze
27
-
28
- # Pass the possible +pattern+ argument down to the
29
- # +calculate_directory_statistics+ method call.
30
- def calculate_statistics
31
- Hash[@pairs.map do |pair|
32
- [pair.first, calculate_directory_statistics(*pair[1..-1])]
33
- end]
34
- end
35
-
36
- # Match the pattern against the individual file name and the relative file
37
- # path. This allows top-level only matches.
38
- def calculate_directory_statistics(directory, pattern = DEFAULT_PATTERN)
39
- stats = CodeStatisticsCalculator.new
40
-
41
- Dir.foreach(directory) do |file_name|
42
- path = "#{directory}/#{file_name}"
43
-
44
- if File.directory?(path) && (/^\./ !~ file_name)
45
- stats.add(calculate_directory_statistics(path, pattern))
46
- elsif file_name =~ pattern || path =~ pattern
47
- stats.add_by_file_path(path)
48
- end
49
- end
50
-
51
- stats
52
- end
53
- end
54
-
55
11
  # Configure all code statistics directories
56
- vendors = [
57
- [:unshift, 'Clients', 'lib/pricehubble/client'],
58
- [:unshift, 'Entities', 'lib/pricehubble/entity'],
59
- [:unshift, 'Utilities', 'lib/pricehubble/utils'],
60
- [:unshift, 'Top-levels', 'lib', %r{lib(/pricehubble)?/[^/]+\.rb$}],
61
-
62
- [:unshift, 'Clients specs', 'spec/client'],
63
- [:unshift, 'Entities specs', 'spec/entity'],
64
- [:unshift, 'Utilities specs', 'spec/utils'],
65
- [:unshift, 'Top-levels specs', 'spec',
66
- %r{spec/pricehubble(_spec\.rb|/[^/]+\.rb$)}]
67
- ].reverse
68
-
69
- vendors.each do |method, type, dir, pattern|
70
- ::STATS_DIRECTORIES.send(method, [type, dir, pattern].compact)
71
- ::CodeStatistics::TEST_TYPES << type if type.include? 'specs'
72
- end
73
-
74
- # Setup annotations
75
- ENV['SOURCE_ANNOTATION_DIRECTORIES'] = 'spec,doc'
76
-
77
- desc 'Enumerate all annotations'
78
- task :notes do
79
- SourceAnnotationExtractor.enumerate '@?OPTIMIZE|@?FIXME|@?TODO', tag: true
12
+ Countless.configure do |config|
13
+ config.stats_base_directories = [
14
+ { name: 'Top-levels', dir: 'lib',
15
+ pattern: %r{/lib(/pricehubble)?/[^/]+\.rb$} },
16
+ { name: 'Top-levels specs', test: true, dir: 'spec',
17
+ pattern: %r{/spec(/pricehubble)?/[^/]+_spec\.rb$} },
18
+ { name: 'Clients', pattern: 'lib/pricehubble/client/**/*.rb' },
19
+ { name: 'Clients specs', test: true,
20
+ pattern: 'spec/client/**/*_spec.rb' },
21
+ { name: 'Entities', pattern: 'lib/pricehubble/entity/**/*.rb' },
22
+ { name: 'Entities specs', test: true,
23
+ pattern: 'spec/entity/**/*_spec.rb' },
24
+ { name: 'Utilities', pattern: 'lib/pricehubble/utils/**/*.rb' },
25
+ { name: 'Utilities specs', test: true,
26
+ pattern: 'spec/utils/**/*_spec.rb' },
27
+ { name: 'Instrumentation',
28
+ pattern: 'lib/pricehubble/instrumentation/**/*.rb' },
29
+ { name: 'Core Extensions', pattern: 'lib/pricehubble/core_ext/**/*.rb' }
30
+ ]
80
31
  end
@@ -1,11 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
1
  # This file was generated by Appraisal
4
2
 
5
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
6
4
 
7
- gem 'activemodel', '~> 5.2.2'
8
- gem 'activesupport', '~> 5.2.2'
9
- gem 'railties', '~> 5.2.2'
5
+ gem "activemodel", "~> 5.2.0"
6
+ gem "activesupport", "~> 5.2.0"
10
7
 
11
- gemspec path: '../'
8
+ gemspec path: "../"
@@ -65,8 +65,7 @@ module PriceHubble
65
65
  # @param entity [PriceHubble::Dossier] the entity to delete
66
66
  # @param args [Hash{Symbol => Mixed}] additional arguments
67
67
  #
68
- # rubocop:disable Metrics/MethodLength because thats the bare minimum
69
- # rubocop:disable Metrics/AbcSize because the decission
68
+ # rubocop:disable Metrics/MethodLength because thats the bare minimumbecause the decission
70
69
  # handling is quite complex
71
70
  def delete_dossier(entity, **args)
72
71
  res = connection.delete do |req|
@@ -82,9 +81,8 @@ module PriceHubble
82
81
  successful?(res)
83
82
  end
84
83
  end
85
- # rubocop:enable Metrics/MethodLength
86
- # rubocop:enable Metrics/AbcSize
87
84
 
85
+ # rubocop:enable Metrics/MethodLength
88
86
  # Update a dossier entity.
89
87
  #
90
88
  # TODO: Implement this.
@@ -18,7 +18,7 @@ module PriceHubble
18
18
  # Perform the data compaction and the hash key transformation,
19
19
  # when the body is available and a hash
20
20
  env[:body] = body.deep_compact.deep_camelize_keys \
21
- if body&.is_a?(Hash)
21
+ if body.is_a?(Hash)
22
22
 
23
23
  @app.call(env)
24
24
  end
@@ -8,15 +8,15 @@ module PriceHubble
8
8
  module Request
9
9
  extend ActiveSupport::Concern
10
10
 
11
- included do
12
- # A common HTTP content type to symbol
13
- # mapping for correct header settings.
14
- CONTENT_TYPE = {
15
- json: 'application/json',
16
- multipart: 'multipart/form-data',
17
- url_encoded: 'application/x-www-form-urlencoded'
18
- }.freeze
11
+ # A common HTTP content type to symbol
12
+ # mapping for correct header settings.
13
+ CONTENT_TYPE = {
14
+ json: 'application/json',
15
+ multipart: 'multipart/form-data',
16
+ url_encoded: 'application/x-www-form-urlencoded'
17
+ }.freeze
19
18
 
19
+ included do
20
20
  # Use the configured identity to authenticate the given request.
21
21
  #
22
22
  # @param req [Faraday::Request] the request to manipulate
@@ -12,8 +12,9 @@ module PriceHubble
12
12
  # or +nil+ on error
13
13
  #
14
14
  # rubocop:disable Metrics/MethodLength because of the request handling
15
+ # rubocop:disable Metrics/AbcSize dito
15
16
  def property_value(request, **args)
16
- data = request.attributes(true)
17
+ data = request.attributes(sanitize: true)
17
18
  res = connection.post do |req|
18
19
  req.path = '/api/v1/valuation/property_value'
19
20
  req.body = data
@@ -27,6 +28,7 @@ module PriceHubble
27
28
  end
28
29
  end
29
30
  # rubocop:enable Metrics/MethodLength
31
+ # rubocop:enable Metrics/AbcSize
30
32
 
31
33
  # Map and assign the valuation response to our local
32
34
  # +PriceHubble::Valuation+ representation. While taking care of the
@@ -42,6 +44,7 @@ module PriceHubble
42
44
  #
43
45
  # rubocop:disable Metrics/MethodLength because of the request
44
46
  # to response mapping
47
+ # rubocop:disable Metrics/AbcSize dito
45
48
  def assign_valuations(data, request)
46
49
  lambda do
47
50
  # valuations[i][j] contains the valuation for property i on date j
@@ -60,6 +63,7 @@ module PriceHubble
60
63
  end
61
64
  end
62
65
  # rubocop:enable Metrics/MethodLength
66
+ # rubocop:enable Metrics/AbcSize
63
67
 
64
68
  # Generate bang method variants
65
69
  bangers :property_value