Module: PriceHubble::EntityConcern::Client

Extended by:
ActiveSupport::Concern
Included in:
BaseEntity
Defined in:
lib/pricehubble/entity/concern/client.rb

Overview

Allow entities to define their low level HTTP client to use.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.client(name) ⇒ Object

Allows an entity to configure the client it depends on.

Parameters:

  • name (Symbol, String)

    the client name, in snake_case



25
26
27
# File 'lib/pricehubble/entity/concern/client.rb', line 25

def client(name)
  self.client_class = PriceHubble.client(name).class
end

Instance Method Details

#clientMixed

Get the cached low level client instance.

Returns:

  • (Mixed)

    the client instance



16
17
18
# File 'lib/pricehubble/entity/concern/client.rb', line 16

def client
  @client ||= client_class.new
end