pricehubble 1.3.0 → 1.5.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: a07bc69bd21da2ef882a604b4fe9004058e498b55e054d570028bbf68f7c62cc
4
- data.tar.gz: 47aa8a135d82dfadcff96647cfcbed8d676edcab4afa2b4c95c080d8ee11bac7
3
+ metadata.gz: 9721bb7bde0466664e06c6669668eb4bfe18afbcd922b3e9780cbccf7fab38c4
4
+ data.tar.gz: 96cbc3748db0776ad37c56d0cae090d4c7f181ba5357dc94fdcc05cd138f7fd1
5
5
  SHA512:
6
- metadata.gz: f470b76681cdb721ea601c90ff82e09fec7dec6d6788a784e818060520cbd356fb4c2719cc193e592e13e48a50c373aad6b3994e23779d9ecd6dacd86127a16c
7
- data.tar.gz: 7d4a5c14802732b4564287c6f535a0bfa857b44e4a8e5020084b900aed62197eb5a07d111de2c74e13a2e35f9f32101a3530a15ac810351fc60d6fa1cc8a4f94
6
+ metadata.gz: ed6ada92ef2cb5a3ff5a1d715fe1aad5bc68adc9482cf5b383b6497d253552f02c42b908c48e326337886227dc616dcd3210a59e70da3591d5bbb18242a7174c
7
+ data.tar.gz: 17461520b2a3631e0706da2c6b5355ee5fe6c9f0d2228eee4497f6ac068780431f9c5da0585f1862227c4cd86e6b562f19a7e4a1bbcd3a4d9db9c14d878e23c1
@@ -18,8 +18,8 @@ jobs:
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
- ruby: ['2.7']
22
- rails: ['5.2', '6.1', '7.1']
21
+ ruby: ['2.7', '3.0']
22
+ rails: ['6.1', '7.1']
23
23
  env:
24
24
  BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
25
25
  steps:
data/.rubocop.yml CHANGED
@@ -13,7 +13,7 @@ AllCops:
13
13
  SuggestExtensions: false
14
14
  DisplayCopNames: true
15
15
  TargetRubyVersion: 2.7
16
- TargetRailsVersion: 5.2
16
+ TargetRailsVersion: 6.1
17
17
  Exclude:
18
18
  - bin/**/*
19
19
  - vendor/**/*
data/Appraisals CHANGED
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise 'rails-5.2' do
4
- gem 'activemodel', '~> 5.2.0'
5
- gem 'activesupport', '~> 5.2.0'
6
- end
7
-
8
3
  appraise 'rails-6.1' do
9
4
  gem 'activemodel', '~> 6.1.0'
10
5
  gem 'activesupport', '~> 6.1.0'
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO: Replace this bullet point with an actual description of a change.
4
4
 
5
+ ### 1.5.0 (12 January 2025)
6
+
7
+ * Switched to Zeitwerk as autoloader (#12)
8
+
9
+ ### 1.4.0 (3 January 2025)
10
+
11
+ * Raised minimum supported Ruby/Rails version to 2.7/6.1 (#11)
12
+
5
13
  ### 1.3.0 (4 October 2024)
6
14
 
7
15
  * Upgraded the `recursive-open-struct` gem to `~> 2.0` (#10)
@@ -13,11 +13,11 @@ module PriceHubble
13
13
  include PriceHubble::Utils::Bangers
14
14
  end
15
15
 
16
- include PriceHubble::EntityConcern::Callbacks
17
- include PriceHubble::EntityConcern::Attributes
18
- include PriceHubble::EntityConcern::Associations
19
- include PriceHubble::EntityConcern::Client
20
- include PriceHubble::EntityConcern::Persistence
16
+ include Concern::Callbacks
17
+ include Concern::Attributes
18
+ include Concern::Associations
19
+ include Concern::Client
20
+ include Concern::Persistence
21
21
 
22
22
  # We collect all unknown attributes instead of raising while creating a new
23
23
  # instance. The unknown attributes are wrapped inside a
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  # Allow simple association mappings like ActiveRecord supports (eg.
6
6
  # +has_one+, +has_many+).
7
7
  module Associations
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  module Attributes
6
6
  # A separated date array typed attribute helper.
7
7
  module DateArray
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  module Attributes
6
6
  # A separated enum typed attribute helper.
7
7
  module Enum
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  module Attributes
6
6
  # A separated range typed attribute helper.
7
7
  module Range
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  module Attributes
6
6
  # A separated string inquirer typed attribute helper.
7
7
  module StringInquirer
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  # An ActiveRecord-like attribute management feature, with the exception
6
6
  # that the attributes are not generated through a schema file, but are
7
7
  # defined inline the entity class.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  # Define all the base callbacks of a common entity.
6
6
  module Callbacks
7
7
  extend ActiveSupport::Concern
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  # Allow entities to define their low level HTTP client to use.
6
6
  module Client
7
7
  extend ActiveSupport::Concern
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PriceHubble
4
- module EntityConcern
4
+ module Concern
5
5
  # Map some of the ActiveRecord::Persistence API methods for an entity
6
6
  # instance for good compatibility. See: http://bit.ly/2W1rjfF and
7
7
  # http://bit.ly/2ARRFYB
@@ -22,17 +22,14 @@ module PriceHubble
22
22
  raise NoMethodError, "#{self}##{meth} does not exit" \
23
23
  unless instance_methods(false).include? meth
24
24
 
25
- raise ArgumentError, "#{self}##{meth} does not accept arguments" \
26
- if instance_method(meth).arity.zero?
25
+ if instance_method(meth).arity.zero?
26
+ raise ArgumentError,
27
+ "#{self}##{meth} does not accept arguments"
28
+ end
27
29
 
28
30
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
29
- def #{meth}!(*args)
30
- if args.last.is_a? Hash
31
- args.last.merge!(bang: true)
32
- else
33
- args.push({ bang: true })
34
- end
35
- #{meth}(*args)
31
+ def #{meth}!(*args, **kwargs, &block)
32
+ #{meth}(*args, **kwargs, bang: true, &block)
36
33
  end
37
34
  RUBY
38
35
  end
@@ -3,7 +3,7 @@
3
3
  # The gem version details.
4
4
  module PriceHubble
5
5
  # The version of the +price-hubble+ gem
6
- VERSION = '1.3.0'
6
+ VERSION = '1.5.0'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
data/lib/price_hubble.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'zeitwerk'
3
4
  require 'active_support'
4
5
  require 'active_support/concern'
5
6
  require 'active_support/configurable'
@@ -14,100 +15,44 @@ require 'recursive-open-struct'
14
15
  require 'faraday'
15
16
  require 'faraday_middleware'
16
17
 
17
- # Load polyfills if needed
18
- require 'price_hubble/core_ext/hash'
19
-
20
18
  # The top level namespace for the PriceHubble gem.
21
19
  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
20
+ # Configure the relative gem code base location
21
+ root_path = Pathname.new("#{__dir__}/price_hubble")
62
22
 
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
23
+ # Setup a Zeitwerk autoloader instance and configure it
24
+ loader = Zeitwerk::Loader.for_gem
69
25
 
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
26
+ # Do not auto load some parts of the gem
27
+ loader.ignore("#{__dir__}/pricehubble*")
28
+ loader.ignore(root_path.join('core_ext'))
29
+ loader.ignore(root_path.join('initializers*'))
30
+ loader.ignore(root_path.join('railtie.rb'))
77
31
 
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
32
+ # Entity definitions, based on core functionalities,
33
+ # all entities are directly located at the namespace root,
34
+ # together with their shared concerns
35
+ loader.push_dir(root_path.join('entity'), namespace: PriceHubble)
83
36
 
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
37
+ # Finish the auto loader configuration
38
+ loader.setup
101
39
 
102
40
  # Load standalone code
103
41
  require 'price_hubble/version'
104
- require 'price_hubble/errors'
105
- require 'price_hubble/faraday'
106
42
  require 'price_hubble/railtie' if defined? Rails
107
43
 
44
+ # Load all core extension of the gem
45
+ Dir[root_path.join('core_ext/**/*.rb')].sort.each { |path| require path }
46
+
47
+ # Load all initializers of the gem
48
+ Dir[root_path.join('initializers/**/*.rb')].sort.each { |path| require path }
49
+
108
50
  # Include top-level features
109
51
  include PriceHubble::ConfigurationHandling
110
52
  include PriceHubble::Client
111
53
  include PriceHubble::Identity
112
54
  include PriceHubble::Instrumentation
55
+
56
+ # Make sure to eager load all constants
57
+ loader.eager_load
113
58
  end
data/pricehubble.gemspec CHANGED
@@ -33,9 +33,10 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.required_ruby_version = '>= 2.7'
35
35
 
36
- spec.add_dependency 'activemodel', '>= 5.2'
37
- spec.add_dependency 'activesupport', '>= 5.2'
36
+ spec.add_dependency 'activemodel', '>= 6.1'
37
+ spec.add_dependency 'activesupport', '>= 6.1'
38
38
  spec.add_dependency 'faraday', '~> 1.0'
39
39
  spec.add_dependency 'faraday_middleware', '~> 1.0'
40
40
  spec.add_dependency 'recursive-open-struct', '~> 2.0'
41
+ spec.add_dependency 'zeitwerk', '~> 2.6'
41
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pricehubble
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-04 00:00:00.000000000 Z
11
+ date: 2025-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.2'
33
+ version: '6.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5.2'
40
+ version: '6.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: zeitwerk
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.6'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.6'
83
97
  description: Ruby client for the PriceHubble REST API
84
98
  email:
85
99
  - hermann.mayer92@gmail.com
@@ -120,10 +134,10 @@ files:
120
134
  - doc/examples/property_valuations_errors.rb
121
135
  - doc/examples/simple_property_valuations.rb
122
136
  - docker-compose.yml
123
- - gemfiles/rails_5.2.gemfile
124
137
  - gemfiles/rails_6.1.gemfile
125
138
  - gemfiles/rails_7.1.gemfile
126
139
  - lib/price_hubble.rb
140
+ - lib/price_hubble/base_entity.rb
127
141
  - lib/price_hubble/client.rb
128
142
  - lib/price_hubble/client/authentication.rb
129
143
  - lib/price_hubble/client/base.rb
@@ -140,7 +154,6 @@ files:
140
154
  - lib/price_hubble/core_ext/hash.rb
141
155
  - lib/price_hubble/entity/address.rb
142
156
  - lib/price_hubble/entity/authentication.rb
143
- - lib/price_hubble/entity/base_entity.rb
144
157
  - lib/price_hubble/entity/concern/associations.rb
145
158
  - lib/price_hubble/entity/concern/attributes.rb
146
159
  - lib/price_hubble/entity/concern/attributes/date_array.rb
@@ -160,9 +173,9 @@ files:
160
173
  - lib/price_hubble/entity/valuation.rb
161
174
  - lib/price_hubble/entity/valuation_request.rb
162
175
  - lib/price_hubble/entity/valuation_scores.rb
163
- - lib/price_hubble/errors.rb
164
- - lib/price_hubble/faraday.rb
165
176
  - lib/price_hubble/identity.rb
177
+ - lib/price_hubble/initializers/errors.rb
178
+ - lib/price_hubble/initializers/faraday.rb
166
179
  - lib/price_hubble/instrumentation.rb
167
180
  - lib/price_hubble/instrumentation/log_subscriber.rb
168
181
  - lib/price_hubble/railtie.rb
@@ -1,26 +0,0 @@
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", "~> 5.2.0"
24
- gem "activesupport", "~> 5.2.0"
25
-
26
- gemspec path: "../"