<commit_before>module Milkman
  class Authorizer

    include Utility

    attr_accessor :options

    def initialize(attributes)
      @options = attributes.merge! default_options
    end

    def self.authorize(options)
      new(options).authorize
    end

    def authorize
      puts I18n.t("milkman.authorization.frob_message", url: frob_message_url)

      signed_options = sign options[:shared_secret], options.merge!(method: "rtm.auth.getToken", frob: frob)
      response       = Milkman::Request.call request_url(signed_options)

      puts I18n.t("milkman.authorization.auth_token_message", username: response["rsp"]["auth"]["user"]["username"], api_key: options[:api_key], shared_secret: options[:shared_secret], auth_token: response["rsp"]["auth"]["token"])
    end

    private

    def frob
      STDIN.gets.strip
    end

    def frob_message_url
      authorization_url sign(options[:shared_secret], options)
    end
<commit_msg>Split up the authorize method into multiple methods.<commit_after>module Milkman
  class Authorizer

    include Utility

    attr_accessor :options

    def initialize(attributes)
      @options = attributes.merge! default_options
    end

    def self.authorize(options)
      new(options).authorize
    end

    def authorize
      puts I18n.t("milkman.authorization.frob_message", url: frob_message_url)
      puts I18n.t("milkman.authorization.auth_token_message", username: response["rsp"]["auth"]["user"]["username"], api_key: options[:api_key], shared_secret: options[:shared_secret], auth_token: response["rsp"]["auth"]["token"])
    end

    private

    def response
      @response ||= Milkman::Request.call request_url(signed_options)
    end

    def signed_options
      sign options[:shared_secret], options.merge!(method: "rtm.auth.getToken", frob: frob)
    end

    def frob
      STDIN.gets.strip
    end

    def frob_message_url
      authorization_url sign(options[:shared_secret], options)
    end

{'fraction_non_alphanumeric': 0.10716099542915185, 'fraction_numerical': 0.004062976130015236, 'mean_word_length': 3.8402948402948405, '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': '3068897', 'n_tokens_mistral': 606, 'n_tokens_neox': 598, 'n_words': 124}