Class: Jets::Resource::ApiGateway::RestApi::Routes::Change::Variable
- Defined in:
- lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
Instance Method Summary collapse
- #changed? ⇒ Boolean
- #collision ⇒ Object
-
#deployed_routes ⇒ Object
Only consider deployed routes with variables.
-
#new_paths ⇒ Object
Only consider paths with variables.
Methods inherited from Base
changed?, #controller_action_from_api, #controller_action_from_string, #get_controller_action, #lambda_function_description, #method_uri, #new_routes, #recreate_path, #recreate_to, #rest_api_id, #to
Methods included from AwsServices
#apigateway, #aws_lambda, #cfn, #dynamodb, #logs, #s3, #s3_resource, #sns, #sqs, #sts
Methods included from AwsServices::StackStatus
#lookup, #stack_exists?, #stack_in_progress?
Methods included from AwsServices::GlobalMemoist
Instance Method Details
#changed? ⇒ Boolean
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb', line 4 def changed? changed = false deployed_routes.each do |deployed_route| parent = collision.variable_parent(deployed_route.path) parent_variables = collision.parent_variables(parent, [deployed_route.path]) new_parent_variables = collision.parent_variables(parent, new_paths) changed = parent_variables.size > 0 && new_parent_variables.size > 0 && parent_variables != new_parent_variables break if changed end changed end |
#collision ⇒ Object
31 32 33 |
# File 'lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb', line 31 def collision @collision ||= Jets::Resource::ApiGateway::RestApi::Routes::Collision.new end |
#deployed_routes ⇒ Object
Only consider deployed routes with variables
24 25 26 27 28 29 |
# File 'lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb', line 24 def deployed_routes deployed_routes = super deployed_routes.select do |route| route.path.include?(':') end end |
#new_paths ⇒ Object
Only consider paths with variables
19 20 21 |
# File 'lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb', line 19 def new_paths new_routes.map(&:path).select {|p| p.include?(':')}.uniq end |