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.9.1 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.8.1 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.20 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.19 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.18 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.17 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.16 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.15 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.14 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.13 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.12 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.11 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.10 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.9 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.8 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.2.7 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.10 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.0.17 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.0.16 app/controllers/redhat_access/api/attachments_controller.rb
redhat_access-2.1.9 app/controllers/redhat_access/api/attachments_controller.rb