Class: Apiwork::Adapter::Builder::Contract::Base
- Inherits:
-
Object
- Object
- Apiwork::Adapter::Builder::Contract::Base
show all
- Defined in:
- lib/apiwork/adapter/builder/contract/base.rb
Overview
Base class for Contract-phase type builders.
Contract phase runs once per contract with representation at registration time. Use it to generate contract-specific types based on the representation.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(contract_class, representation_class) ⇒ Base
Returns a new instance of Base.
69
70
71
72
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 69
def initialize(contract_class, representation_class)
@contract_class = contract_class
@representation_class = representation_class
end
|
Instance Attribute Details
#representation_class ⇒ Object
25
26
27
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 25
def representation_class
@representation_class
end
|
Instance Method Details
#api_class ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#build ⇒ void
This method returns an undefined value.
Builds contract-level types.
Override this method to generate types based on the representation.
79
80
81
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 79
def build
raise NotImplementedError
end
|
#contract_for(representation_class) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#enum(name, values:, **options, &block) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#enum?(name) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#import(type_name, from:) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#object(name, **options, &block) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#scoped_enum_name(name) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#scoped_type_name(name) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#type?(name) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|
#union(name, **options, &block) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/apiwork/adapter/builder/contract/base.rb', line 57
delegate :api_class,
:contract_for,
:enum,
:enum?,
:import,
:object,
:scoped_enum_name,
:scoped_type_name,
:type?,
:union,
to: :@contract_class
|