Class: Generator::ParameterBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/generator/parameter_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(operation, shared_parameters, rate_limit) ⇒ ParameterBuilder

Returns a new instance of ParameterBuilder.



5
6
7
8
9
# File 'lib/generator/parameter_builder.rb', line 5

def initialize(operation, shared_parameters, rate_limit)
  @operation = operation
  @shared_parameters = shared_parameters
  @rate_limit = rate_limit
end

Instance Method Details

#buildObject



11
12
13
14
15
16
17
18
# File 'lib/generator/parameter_builder.rb', line 11

def build
  parameters = (@shared_parameters + (@operation["parameters"] || [])).uniq { |p| p["name"] }
  parameters = parameters.select { |p| p["name"] }
  parameters << build_rate_limit_param
  parameters << build_notification_type_param if needs_notification_type?

  parameters
end