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.to_s,
          body: company,
          error_message: error_message
        )
        nil if response.code == 200
      end

      def create_company(erecruit_token:, company:, erecruit_platform_url:)
        http_get(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: erecruit_platform_url.to_s,
          body: company
        )
      end

      def update_company!(erecruit_token:, erecruit_platform_url:, company:, company_id:, error_message:)
        response = safe_http_post(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/#{company_id}",
          body: company,
          error_message: error_message
        )
        nil if response.code == 200
      end

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