<commit_before>require 'highline'

module Pendulum::Command
  class Apply
    class Schedule
      attr_accessor :client, :from, :to, :dry_run, :force, :color
      def initialize(client, from, to, dry_run=false, force=false, color=false)
        self.client  = client
        self.from    = from
        self.to      = to
        self.dry_run = dry_run
        self.force   = force
        self.color   = color
      end

      def apply
        case
        when will_create? then create
        when will_update? then update
        when will_delete? then delete
        end
      end

      def create
        puts message_for_create
        client.create_schedule(to.name, to.to_params) unless dry_run?
      end

      def update
        puts message_for_update
        puts message_for_diff if has_diff?
        if force? || has_diff?
          client.update_schedule(to.name, to.to_params) unless dry_run?
        end
      end

      def delete
        puts message_for_delete
        client.update_schedule(from.name) if force? && !dry_run?
      end

      private

      def will_create?
        !from && to
      end
<commit_msg>Fixed wrong API call when schedule delete.<commit_after>require 'highline'

module Pendulum::Command
  class Apply
    class Schedule
      attr_accessor :client, :from, :to, :dry_run, :force, :color
      def initialize(client, from, to, dry_run=false, force=false, color=false)
        self.client  = client
        self.from    = from
        self.to      = to
        self.dry_run = dry_run
        self.force   = force
        self.color   = color
      end

      def apply
        case
        when will_create? then create
        when will_update? then update
        when will_delete? then delete
        end
      end

      def create
        puts message_for_create
        client.create_schedule(to.name, to.to_params) unless dry_run?
      end

      def update
        puts message_for_update
        puts message_for_diff if has_diff?
        if force? || has_diff?
          client.update_schedule(to.name, to.to_params) unless dry_run?
        end
      end

      def delete
        puts message_for_delete
        client.delete_schedule(from.name) if force? && !dry_run?
      end

      private

      def will_create?
        !from && to
      end

{'fraction_non_alphanumeric': 0.06528318201469953, 'fraction_numerical': 0.0, 'mean_word_length': 1.8925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2963004', 'n_tokens_mistral': 687, 'n_tokens_neox': 676, 'n_words': 192}