lib/materialist/materializer/internals/materializer.rb in materialist-3.4.0 vs lib/materialist/materializer/internals/materializer.rb in materialist-3.5.0
- old
+ new
@@ -1,6 +1,5 @@
-require 'routemaster/api_client'
require_relative '../../workers/event'
require_relative './resources'
module Materialist
module Materializer
@@ -8,11 +7,11 @@
class Materializer
def initialize(url, klass, resource_payload: nil, api_client: nil)
@url = url
@instance = klass.new
@options = klass.__materialist_options
- @api_client = api_client || Routemaster::APIClient.new(response_class: HateoasResource)
+ @api_client = api_client || Materialist.configuration.api_client
if resource_payload
@resource = PayloadResource.new(resource_payload, client: @api_client)
end
end
@@ -122,10 +121,10 @@
def resource
@resource ||= fetch_resource
end
def fetch_resource
- api_client.get(url, options: { enable_caching: false })
+ api_client.get(url, options: { enable_caching: false, response_class: HateoasResource })
rescue Routemaster::Errors::ResourceNotFound
nil
end
def send_messages(messages, arguments)