<commit_before>module Interactors
  module Facts
    class ShareOnFacebook
      include Pavlov::Interactor
      include Util::CanCan

      # How to use this interactor:
      # Pavlov.interactor :'facts/share_on_facebook', :fact_id,
      #                     ability: Ability.new(user),
      #                     facebook_app_namespace: FactlinkUI::Application.config.facebook_app_namespace

      arguments :fact_id

      def authorized?
        can? :share, Fact
      end

      def execute
        command :'facebook/share_factlink', fact_id
      end

      def validate
        validate_integer_string  :fact_id, fact_id
        validate_not_nil         :current_user, @options[:current_user]
        validate_nonempty_string :facebook_app_namespace,
                                    @options[:facebook_app_namespace]
      end
    end
  end
end
<commit_msg>Added TODO<commit_after>module Interactors
  module Facts
    class ShareOnFacebook
      include Pavlov::Interactor
      include Util::CanCan

      # TODO: rewrite this to use Console once we also have a facebook_app_namespace
      # in pavlov_options in ApplicationController
      # How to use this interactor:
      # Pavlov.interactor :'facts/share_on_facebook', '10',
      #                     current_user: user,
      #                     ability: Ability.new(user),
      #                     facebook_app_namespace: FactlinkUI::Application.config.facebook_app_namespace

      arguments :fact_id

      def authorized?
        can? :share, Fact
      end

      def execute
        command :'facebook/share_factlink', fact_id
      end

      def validate
        validate_integer_string  :fact_id, fact_id
        validate_not_nil         :current_user, @options[:current_user]
        validate_nonempty_string :facebook_app_namespace,
                                    @options[:facebook_app_namespace]
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.05967825635703165, 'fraction_numerical': 0.0010378827192527244, 'mean_word_length': 2.0947030497592296, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7318739', 'n_tokens_mistral': 534, 'n_tokens_neox': 498, 'n_words': 121}