lib/wolf_core/application/burnett/positions_operations/positions_operations.rb



module WolfCore
  module Burnett
    module PositionsOperations
      include WolfCore::HttpOperations

      def create_position!(erecruit_token:, erecruit_platform_url:, position:, error_message:, error_data: nil)
        response = safe_http_post(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Position",
          body: position,
          error_message: error_message,
          error_data: error_data
        )
        response.body
      end

      def create_position(erecruit_token:, erecruit_platform_url:, position:)
        parsed_http_post(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Position",
          body: position
        )
      end

      def update_position!(erecruit_token:, erecruit_platform_url:, position_id:, position:, error_message:)
        response = safe_http_put(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Position/#{position_id}",
          body: position,
          error_message: error_message
        )
        response.body
      end

      def update_position(erecruit_token:, erecruit_platform_url:, position_id:, position:)
        parsed_http_put(
          headers: { "Authorization" => "Bearer #{erecruit_token}" },
          url: "#{erecruit_platform_url}/Position/#{position_id}",
          body: position
        )
      end
    end
  end
end