Class: MiniCamel::RouteDefinition

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/mini_camel/route_definition.rb

Instance Method Summary collapse

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, **options)
  definition = ProcessorDefinition::ExposeField.new(options.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, **options)
  definition = ProcessorDefinition::ExposeFields.new(options.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(**options)
  definition = ProcessorDefinition::ExtractResult.new(options)

  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, **options)
  definition = ProcessorDefinition::Mutate.new(options.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, **options)
  options[:in_field] = options.delete(:in)
  definition = ProcessorDefinition::MutateEach.new(options.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, **options)
  definition = ProcessorDefinition::Process.new(options.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, **options)
  options[:in_field] = options.delete(:in)
  definition = ProcessorDefinition::ProcessEach.new(options.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, **options)
  definition = ProcessorDefinition::Produce.new(options.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, **options)
  definition = ProcessorDefinition::Transform.new(options.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, **options)
  options[:in_field] = options.delete(:in)
  definition = ProcessorDefinition::TransformEach.new(options.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, **options)
  definition = ProcessorDefinition::Validate.new(options.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, **options)
  definition = ProcessorDefinition::WrapInDto.new(options.merge(field: field))

  add_processor_definition(definition)

  self
end