Class: Lambdagate::CreateCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/lambdagate/create_command.rb

Constant Summary collapse

DEFAULT_MODEL_NAMES =
%w(Empty Error)

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Lambdagate::Command

Instance Method Details

#runObject

TODO:
Note:

Implementation for Lambdagate::Command



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/lambdagate/create_command.rb', line 11

def run
  puts "[DEBUG] Creating API"
  response = create_restapi
  restapi_id = response.body["id"]

  puts "[DEBUG] Deleting default models"
  delete_default_models(restapi_id: restapi_id)

  puts "[DEBUG] Creating resources"
  api_gateway_client.create_resources(
    paths: paths,
    restapi_id: restapi_id,
  )

  puts "[DEBUG] Creating methods"
  methods.each do |method|
    resource = api_gateway_client.find_resource(path: method[:path], restapi_id: restapi_id)
    api_gateway_client.put_method(
      api_key_required: method[:api_key_required],
      authorization_type: method[:authorization_type],
      http_method: method[:http_method],
      request_models: method[:request_models],
      request_parameters: method[:request_parameters],
      resource_id: resource["id"],
      restapi_id: restapi_id,
    )
  end
end