pricehubble 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33987d92db690afe5bda03fb225a11915166847840da54779347bace0d2fb6ae
4
- data.tar.gz: 263b4b48cebe63c82ba29ef27c12fbb136c81124f86dd3281c06442794695dae
3
+ metadata.gz: 9721bb7bde0466664e06c6669668eb4bfe18afbcd922b3e9780cbccf7fab38c4
4
+ data.tar.gz: 96cbc3748db0776ad37c56d0cae090d4c7f181ba5357dc94fdcc05cd138f7fd1
5
5
  SHA512:
6
- metadata.gz: 2dd1447b16620cb4920c875a9ad5dfdb8b30e56db3a3958f80f43493e679c8abd5b9e0a81cd069511867fc76ba885fd95615f30b02c7210a77184ab8734f5bff
7
- data.tar.gz: 3f16a3a4de7f81c71ac4e5c944390d8c6c628831eeded218f022e5f615a1166091911922d99fcdafcb60438f0976dab10f720afbd3b3abab223a47fcb53dcd3e
6
+ metadata.gz: ed6ada92ef2cb5a3ff5a1d715fe1aad5bc68adc9482cf5b383b6497d253552f02c42b908c48e326337886227dc616dcd3210a59e70da3591d5bbb18242a7174c
7
+ data.tar.gz: 17461520b2a3631e0706da2c6b5355ee5fe6c9f0d2228eee4497f6ac068780431f9c5da0585f1862227c4cd86e6b562f19a7e4a1bbcd3a4d9db9c14d878e23c1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
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
+
5
9
  ### 1.4.0 (3 January 2025)
6
10
 
7
11
  * Raised minimum supported Ruby/Rails version to 2.7/6.1 (#11)
@@ -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
@@ -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.4.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
@@ -38,4 +38,5 @@ Gem::Specification.new do |spec|
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.4.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: 2025-01-03 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
@@ -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
@@ -123,6 +137,7 @@ files:
123
137
  - gemfiles/rails_6.1.gemfile
124
138
  - gemfiles/rails_7.1.gemfile
125
139
  - lib/price_hubble.rb
140
+ - lib/price_hubble/base_entity.rb
126
141
  - lib/price_hubble/client.rb
127
142
  - lib/price_hubble/client/authentication.rb
128
143
  - lib/price_hubble/client/base.rb
@@ -139,7 +154,6 @@ files:
139
154
  - lib/price_hubble/core_ext/hash.rb
140
155
  - lib/price_hubble/entity/address.rb
141
156
  - lib/price_hubble/entity/authentication.rb
142
- - lib/price_hubble/entity/base_entity.rb
143
157
  - lib/price_hubble/entity/concern/associations.rb
144
158
  - lib/price_hubble/entity/concern/attributes.rb
145
159
  - lib/price_hubble/entity/concern/attributes/date_array.rb
@@ -159,9 +173,9 @@ files:
159
173
  - lib/price_hubble/entity/valuation.rb
160
174
  - lib/price_hubble/entity/valuation_request.rb
161
175
  - lib/price_hubble/entity/valuation_scores.rb
162
- - lib/price_hubble/errors.rb
163
- - lib/price_hubble/faraday.rb
164
176
  - lib/price_hubble/identity.rb
177
+ - lib/price_hubble/initializers/errors.rb
178
+ - lib/price_hubble/initializers/faraday.rb
165
179
  - lib/price_hubble/instrumentation.rb
166
180
  - lib/price_hubble/instrumentation/log_subscriber.rb
167
181
  - lib/price_hubble/railtie.rb