Class: Apiwork::Adapter::Builder::API::Base
- Inherits:
-
Object
- Object
- Apiwork::Adapter::Builder::API::Base
- Defined in:
- lib/apiwork/adapter/builder/api/base.rb
Overview
Base class for API-phase type builders.
API phase runs once per API at initialization time. Use it to register shared types used across all contracts.
Direct Known Subclasses
Capability::API::Base, Serializer::Error::Default::APIBuilder
Instance Attribute Summary collapse
- #data_type ⇒ Object readonly
Instance Method Summary collapse
-
#build ⇒ void
Builds API-level types.
- #enum(name, values:, **options, &block) ⇒ Object
- #enum?(name) ⇒ Object
-
#initialize(api_class, data_type: nil) ⇒ Base
constructor
A new instance of Base.
- #object(name, **options, &block) ⇒ Object
- #type?(name) ⇒ Object
- #union(name, **options, &block) ⇒ Object
Constructor Details
#initialize(api_class, data_type: nil) ⇒ Base
Returns a new instance of Base.
49 50 51 52 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 49 def initialize(api_class, data_type: nil) @api_class = api_class @data_type = data_type end |
Instance Attribute Details
#data_type ⇒ Object (readonly)
25 26 27 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 25 def data_type @data_type end |
Instance Method Details
#build ⇒ void
This method returns an undefined value.
Builds API-level types.
Override this method to register shared types.
59 60 61 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 59 def build raise NotImplementedError end |
#enum(name, values:, **options, &block) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 42 delegate :enum, :enum?, :object, :type?, :union, to: :@api_class |
#enum?(name) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 42 delegate :enum, :enum?, :object, :type?, :union, to: :@api_class |
#object(name, **options, &block) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 42 delegate :enum, :enum?, :object, :type?, :union, to: :@api_class |
#type?(name) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 42 delegate :enum, :enum?, :object, :type?, :union, to: :@api_class |
#union(name, **options, &block) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/apiwork/adapter/builder/api/base.rb', line 42 delegate :enum, :enum?, :object, :type?, :union, to: :@api_class |