Sha256: 1bd273ebb113f75fecb69e10ff3a107d374e0a778ebf61a1e89ff371d9ed3f85

Contents?: true

Size: 1.3 KB

Versions: 51

Compression:

Stored size: 1.3 KB

Contents

require_dependency "redhat_access/application_controller"
require_dependency "redhat_access/strata/client"
require_dependency "redhat_access/sos_reports/generator"

module RedhatAccess
  module Api
    class AttachmentsController < RedhatAccess::Api::ApiController
      wrap_parameters :attach_payload, format: :json
      def index
        render :text => "SOS Report?checked=true",
          :layout => false
      end

      def create
        data = params[:attach_payload]
        begin
          case_number = data[:caseNum]
          sos_file = RedhatAccess::SosReports::Generator.create_report case_number
          strata = RedhatAccess::Strata::Client.new(data[:authToken])
          strata.api.attachment_broker.add(case_number,
                                           false,
                                           sos_file,
                                           "Attachment for case #{case_number}")
          render :nothing => true,
            :status => 201
        rescue => e
          logger.error e.backtrace
          #logger.error "Failed to import facts for Host::Discovered: #{e}"
          render :text => "Error attaching sos file " + e.message,
            :layout => false ,
            :status => 500
        end
      end

      def api_version
        'v1'
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
redhat_access-2.2.6 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.0.15 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.8 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.5 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.4 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.3 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.0.14 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.7 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.2 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.0 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.6 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.5 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.4 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.3 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.2 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.1 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.0 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.0.13 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.0.12 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.0.11 app/controllers/redhat_access/api/attachments_controller.rb