lib/wolf_core/application/burnett/company_operations/company_operations.rb



module WolfCore # rubocop:disable Style/FrozenStringLiteralComment
  module Burnett
    module CompanyOperations # rubocop:disable Style/Documentation
      include WolfCore::HttpOperations

      def create_company!(erecruit_token:, company:, erecruit_platform_url:, error_message:)
        response = safe_http_post(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Company",
          body: company,
          error_message: error_message
        )
        response.body
      end

      def create_company(erecruit_token:, erecruit_platform_url:, company:)
        parsed_http_post(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Company",
          body: company
        )
      end

      def update_company!(erecruit_token:, erecruit_platform_url:, company:, company_id:, error_message:)
        response = safe_http_put(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Company/#{company_id}",
          body: company,
          error_message: error_message
        )
        response.body
      end

      def update_company(erecruit_token:, erecruit_platform_url:, company:, company_id:)
        parsed_http_put(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Company/#{company_id}",
          body: company
        )
      end
    end
  end
end