Class: KB::ClientResolver
- Inherits:
-
Object
- Object
- KB::ClientResolver
- Defined in:
- lib/kb/client_resolver.rb
Instance Attribute Summary collapse
-
#bounded_context ⇒ Object
readonly
Returns the value of attribute bounded_context.
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
- .admin ⇒ Object
- .breed ⇒ Object
- .call(*args, **kwargs, &block) ⇒ Object
- .consultation ⇒ Object
- .hubspot ⇒ Object
- .pet ⇒ Object
- .pet_contract ⇒ Object
- .pet_parent ⇒ Object
- .plan ⇒ Object
- .product ⇒ Object
Instance Method Summary collapse
- #base_url ⇒ Object
- #call ⇒ Object
-
#initialize(bounded_context, entity, version = 'v1', template: ENV['KB_API_URL_TEMPLATE']) ⇒ ClientResolver
constructor
A new instance of ClientResolver.
Constructor Details
#initialize(bounded_context, entity, version = 'v1', template: ENV['KB_API_URL_TEMPLATE']) ⇒ ClientResolver
Returns a new instance of ClientResolver.
47 48 49 50 51 52 |
# File 'lib/kb/client_resolver.rb', line 47 def initialize(bounded_context, entity, version = 'v1', template: ENV['KB_API_URL_TEMPLATE']) @bounded_context = bounded_context @entity = entity @version = version @template = template end |
Instance Attribute Details
#bounded_context ⇒ Object (readonly)
Returns the value of attribute bounded_context.
45 46 47 |
# File 'lib/kb/client_resolver.rb', line 45 def bounded_context @bounded_context end |
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
45 46 47 |
# File 'lib/kb/client_resolver.rb', line 45 def entity @entity end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
45 46 47 |
# File 'lib/kb/client_resolver.rb', line 45 def template @template end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
45 46 47 |
# File 'lib/kb/client_resolver.rb', line 45 def version @version end |
Class Method Details
.admin ⇒ Object
8 9 10 |
# File 'lib/kb/client_resolver.rb', line 8 def admin call :petfamily, :admin end |
.breed ⇒ Object
24 25 26 |
# File 'lib/kb/client_resolver.rb', line 24 def breed call :petfamily, :breeds end |
.call(*args, **kwargs, &block) ⇒ Object
40 41 42 |
# File 'lib/kb/client_resolver.rb', line 40 def call(*args, **kwargs, &block) new(*args, **kwargs, &block).call end |
.consultation ⇒ Object
4 5 6 |
# File 'lib/kb/client_resolver.rb', line 4 def consultation call :petfamily, :consultations, :v1 end |
.hubspot ⇒ Object
36 37 38 |
# File 'lib/kb/client_resolver.rb', line 36 def hubspot call :petfamily, :hubspot end |
.pet ⇒ Object
16 17 18 |
# File 'lib/kb/client_resolver.rb', line 16 def pet call :petfamily, :pets end |
.pet_contract ⇒ Object
20 21 22 |
# File 'lib/kb/client_resolver.rb', line 20 def pet_contract call :petfamily, :petcontracts end |
.pet_parent ⇒ Object
12 13 14 |
# File 'lib/kb/client_resolver.rb', line 12 def pet_parent call :petfamily, :petparents end |
.plan ⇒ Object
28 29 30 |
# File 'lib/kb/client_resolver.rb', line 28 def plan call :petfamily, :plans end |
.product ⇒ Object
32 33 34 |
# File 'lib/kb/client_resolver.rb', line 32 def product call :petfamily, :products end |
Instance Method Details
#base_url ⇒ Object
58 59 60 |
# File 'lib/kb/client_resolver.rb', line 58 def base_url format(template, bounded_context: bounded_context, entity: entity, version: version).gsub('..', '.') end |