initialize

in src/shapes.rb [52:73]


  def initialize(event_json)
    @task_id = event_json["pathParameters"]["id"]
    body = event_json["body"]
    if event_json["isBase64Encoded"]
      body = Base64.decode64(body)
      puts "[DEBUG] Decoded #{body} from base64 encoded body #{event_json["body"]}"
    end
    if body.nil?
      @errors = ["Request body must be present."]
    else
      begin
        body_json = JSON.parse(body)
        @errors = []
        @title = body_json["title"]
        @description = body_json["description"]
        @status = body_json["status"]
      rescue JSON::ParserError
        @errors = ["Request body must be valid JSON."]
      end
    end
  end