<commit_before>require 'twilio-ruby'

class MessagesController < ApplicationController
  skip_before_filter :verify_authenticity_token
  # If using Devise gem for authorization
  #skip_before_filter :authenticate_user!, :only => "reply"

  def new
    account_sid = Rails.application.secrets.twilio_sid
    auth_token  = Rails.application.secrets.twilio_token
    @client = Twilio::REST::Client.new account_sid, auth_token
  end

  def reply
    body = params[:body]
    from_phone_number = params[:phone]
    account_sid = Rails.application.secrets.twilio_sid
    auth_token  = Rails.application.secrets.twilio_token
    @client = Twilio::REST::Client.new account_sid, auth_token

    @twilio_number = Rails.application.secrets.twilio_number

    @client.account.messages.create({
      from: @twilio_number,
      # from: '+15005550006', # Twilio test number
      to:   '19252128979',
      body: "#{body}",
    })
    redirect_to root_path
  end


  private

    def boot_twilio
      account_sid = Rails.application.secrets.twilio_sid
      auth_token  = Rails.application.secrets.twilio_token
      @client = Twilio::REST::Client.new account_sid, auth_token
    end
end<commit_msg>Change number and refactor.<commit_after>require 'twilio-ruby'

class MessagesController < ApplicationController
  skip_before_filter :verify_authenticity_token
  # If using Devise gem for authorization
  #skip_before_filter :authenticate_user!, :only => "reply"

  def new
    boot_twilio
  end

  def reply
    body = params[:body]
    from_phone_number = params[:phone]

    boot_twilio
    @twilio_number = Rails.application.secrets.twilio_number

    @client.account.messages.create({
      from: @twilio_number,
      # from: '+15005550006', # Twilio test number
      to:   '18056805036',
      body: "#{body}",
    })
    redirect_to root_path
  end


  private

    def boot_twilio
      account_sid = Rails.application.secrets.twilio_sid
      auth_token  = Rails.application.secrets.twilio_token
      @client = Twilio::REST::Client.new account_sid, auth_token
    end
end
{'fraction_non_alphanumeric': 0.0893719806763285, 'fraction_numerical': 0.021256038647342997, 'mean_word_length': 3.696145124716553, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5884982', 'n_tokens_mistral': 721, 'n_tokens_neox': 642, 'n_words': 132}