materialist 3.8.2 → 3.8.3

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: ce1a473a4a182ebbf80364ac65046c146796067e5901d2bec1fac4f24fe9d39f
4
- data.tar.gz: 61a6d7e77e9d044490b5a2fc92a9c69ce4ece93237344a6b0332fb0d376c9dd8
3
+ metadata.gz: dd1ef7f5805827d74ef21e82711656a04d402a7b8e5e03a636538aced1e6f491
4
+ data.tar.gz: cf0e8a01fbdc6751f9eadb59307fc46cba53bb4ca04f562fe2c51531a893e051
5
5
  SHA512:
6
- metadata.gz: b46b98674ee9d5482a505bb6aea3d8683b31b74e25a72fb1b25515d13a8d8c8de4afd7389d20b89ea8bbe0480fcab5a1699347f50bd9f38d807465a88c6816b9
7
- data.tar.gz: 72eae6ef4cbe277c1c45a9ad5dff11ada17c8392b3ec709048e6baf1f85e7b195e184d41341b9634513d0520a8c0cd67ddda8f7ba33287f20b3bd918f3f20595
6
+ metadata.gz: de64d93e429085b0aefe268c346c42a56c669507e867f1b40ab7d0f7f6ddcf4b63023391e7468b8fac472304a1959e5eb0b0a8fda4c00c3ed26395a13f08195b
7
+ data.tar.gz: b593a01f94002824f1068dc36873ff1ae364d2b2a8147116ee97ecb5c408faf7202c60add6886e1ca5b35fc496c5b04cc32e16e43dc7d2766b3a53bec1594382
data/lib/configuration.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'routemaster/api_client'
2
-
3
1
  module Materialist
4
2
  class << self
5
3
  def configuration
@@ -21,11 +19,14 @@ module Materialist
21
19
  def initialize
22
20
  @topics = []
23
21
  @sidekiq_options = {}
24
- @api_client = Routemaster::APIClient.new(response_class: ::Routemaster::Responses::HateoasResponse)
25
22
  @metrics_client = NullMetricsClient
26
23
  @notice_error = nil
27
24
  end
28
25
 
26
+ def api_client
27
+ @api_client || (raise StandardError.new('missing HTTP client'))
28
+ end
29
+
29
30
  class NullMetricsClient
30
31
  def self.increment(_, tags:); end
31
32
  def self.histogram(_, _v, tags:); end
@@ -1,3 +1,3 @@
1
1
  module Materialist
2
- VERSION = '3.8.2'
2
+ VERSION = '3.8.3'
3
3
  end
@@ -29,6 +29,9 @@ RSpec.describe Materialist::MaterializedRecord do
29
29
  let(:source_url) { 'https://service.dev/foobars/1' }
30
30
  let(:source_body) {{ _links: { city: { href: city_url }}, name: 'jack', age: 30 }}
31
31
  before do
32
+ Materialist.configure do |c|
33
+ c.api_client = Routemaster::APIClient.new(response_class: ::Routemaster::Responses::HateoasResponse)
34
+ end
32
35
  stub_request(:get, source_url).to_return(
33
36
  status: 200,
34
37
  body: source_body.to_json,
@@ -63,6 +63,9 @@ RSpec.describe Materialist::Materializer::Internals::Materializer do
63
63
  let!(:source_stub) { stub_resource source_url, source_body }
64
64
 
65
65
  before do
66
+ Materialist.configure do |c|
67
+ c.api_client = Routemaster::APIClient.new(response_class: ::Routemaster::Responses::HateoasResponse)
68
+ end
66
69
  stub_resource country_url, country_body
67
70
  stub_resource city_url, city_body
68
71
  stub_resource defined_source_url, defined_source_body
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'materialist/workers/event'
3
+ require 'routemaster/api_client'
3
4
 
4
5
  RSpec.describe Materialist::Workers::Event do
5
6
  describe "#perform" do
@@ -10,7 +11,10 @@ RSpec.describe Materialist::Workers::Event do
10
11
 
11
12
  before do
12
13
  allow(FoobarMaterializer).to receive(:perform)
13
- Materialist.configure { |c| c.metrics_client = metrics_client }
14
+ Materialist.configure do |c|
15
+ c.metrics_client = metrics_client
16
+ c.api_client = Routemaster::APIClient.new(response_class: ::Routemaster::Responses::HateoasResponse)
17
+ end
14
18
  end
15
19
 
16
20
  after { Object.send(:remove_const, :FoobarMaterializer) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: materialist
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.2
4
+ version: 3.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mo Valipour
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-10 00:00:00.000000000 Z
11
+ date: 2021-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq