Sha256: f7f64fac812e89b37f51d5acb12b1ebe5bdd8f2faf7a19f23967605c5445a013
Contents?: true
Size: 789 Bytes
Versions: 15
Compression:
Stored size: 789 Bytes
Contents
# frozen_string_literal: true module PriceHubble module EntityConcern # Allow entities to define their low level HTTP client to use. module Client extend ActiveSupport::Concern included do # The class constant of the low level client class_attribute :client_class # Get the cached low level client instance. # # @return [Mixed] the client instance def client @client ||= client_class.new end end class_methods do # Allows an entity to configure the client it depends on. # # @param name [Symbol, String] the client name, in snake_case def client(name) self.client_class = PriceHubble.client(name).class end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems