Class: MiniCamel::RouteDefinition
- Inherits:
-
Object
- Object
- MiniCamel::RouteDefinition
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/mini_camel/route_definition.rb
Instance Method Summary collapse
- #add_processor_definition(processor_definition) ⇒ Object
- #desc(description) ⇒ Object
- #expose_field(field, **options) ⇒ Object
- #expose_fields(*fields, **options) ⇒ Object
- #extract_result(**options) ⇒ Object
- #from(route_name) ⇒ Object
- #mutate(field, **options) ⇒ Object
- #mutate_each(field, **options) ⇒ Object
- #pipeline(*routes) ⇒ Object
- #process(*fields, **options) ⇒ Object
- #process_each(field, **options) ⇒ Object
- #produce(field, **options) ⇒ Object
- #to(route) ⇒ Object
- #transform(*fields, **options) ⇒ Object
- #transform_each(field, **options) ⇒ Object
- #validate(field, **options) ⇒ Object
- #wrap_in_dto(field, **options) ⇒ Object
Instance Method Details
#add_processor_definition(processor_definition) ⇒ Object
141 142 143 |
# File 'lib/mini_camel/route_definition.rb', line 141 def add_processor_definition(processor_definition) processor_definitions << processor_definition end |
#desc(description) ⇒ Object
21 22 23 24 |
# File 'lib/mini_camel/route_definition.rb', line 21 def desc(description) self.description = description self end |
#expose_field(field, **options) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/mini_camel/route_definition.rb', line 101 def expose_field(field, **) definition = ProcessorDefinition::ExposeField.new(.merge(field: field)) add_processor_definition(definition) self end |
#expose_fields(*fields, **options) ⇒ Object
109 110 111 112 113 114 115 |
# File 'lib/mini_camel/route_definition.rb', line 109 def expose_fields(*fields, **) definition = ProcessorDefinition::ExposeFields.new(.merge(fields: fields)) add_processor_definition(definition) self end |
#extract_result(**options) ⇒ Object
125 126 127 128 129 130 131 |
# File 'lib/mini_camel/route_definition.rb', line 125 def extract_result(**) definition = ProcessorDefinition::ExtractResult.new() add_processor_definition(definition) self end |
#from(route_name) ⇒ Object
17 18 19 |
# File 'lib/mini_camel/route_definition.rb', line 17 def from(route_name) self.route_name = route_name end |
#mutate(field, **options) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/mini_camel/route_definition.rb', line 76 def mutate(field, **) definition = ProcessorDefinition::Mutate.new(.merge(field: field)) add_processor_definition(definition) self end |
#mutate_each(field, **options) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/mini_camel/route_definition.rb', line 84 def mutate_each(field, **) [:in_field] = .delete(:in) definition = ProcessorDefinition::MutateEach.new(.merge(field: field)) add_processor_definition(definition) self end |
#pipeline(*routes) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/mini_camel/route_definition.rb', line 34 def pipeline(*routes) definition = ProcessorDefinition::Pipeline.new(routes: routes) add_processor_definition(definition) self end |
#process(*fields, **options) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/mini_camel/route_definition.rb', line 42 def process(*fields, **) definition = ProcessorDefinition::Process.new(.merge(fields: fields)) add_processor_definition(definition) self end |
#process_each(field, **options) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/mini_camel/route_definition.rb', line 50 def process_each(field, **) [:in_field] = .delete(:in) definition = ProcessorDefinition::ProcessEach.new(.merge(field: field)) add_processor_definition(definition) self end |
#produce(field, **options) ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/mini_camel/route_definition.rb', line 93 def produce(field, **) definition = ProcessorDefinition::Produce.new(.merge(field: field)) add_processor_definition(definition) self end |
#to(route) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/mini_camel/route_definition.rb', line 26 def to(route) definition = ProcessorDefinition::To.new(route: route) add_processor_definition(definition) self end |
#transform(*fields, **options) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/mini_camel/route_definition.rb', line 59 def transform(*fields, **) definition = ProcessorDefinition::Transform.new(.merge(fields: fields)) add_processor_definition(definition) self end |
#transform_each(field, **options) ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/mini_camel/route_definition.rb', line 67 def transform_each(field, **) [:in_field] = .delete(:in) definition = ProcessorDefinition::TransformEach.new(.merge(field: field)) add_processor_definition(definition) self end |
#validate(field, **options) ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/mini_camel/route_definition.rb', line 133 def validate(field, **) definition = ProcessorDefinition::Validate.new(.merge(field: field)) add_processor_definition(definition) self end |
#wrap_in_dto(field, **options) ⇒ Object
117 118 119 120 121 122 123 |
# File 'lib/mini_camel/route_definition.rb', line 117 def wrap_in_dto(field, **) definition = ProcessorDefinition::WrapInDto.new(.merge(field: field)) add_processor_definition(definition) self end |