# require 'twilio-ruby'

class UsersController < ActionController::API

  def send_verification_code
    setup_sms
    send_sms(params[:number],
      "Your verification code is: " + generate_verification_code)
  end

  private

    def generate_verification_code
      totp = ROTP::TOTP.new("base32secret3232")
      totp.now.to_s
    end

    def setup_sms
      account_sid = ENV['TWILIO_ACCOUNT_SID']
      auth_token = ENV['TWILIO_AUTH_TOKEN']
      @client = Twilio::REST::Client.new(account_sid, auth_token)
    end

    def send_sms(deliver_to, body)
      @client.messages.create(
        from: ENV['TWILIO_NUMBER'],
        to: deliver_to,
        body: body)
    end

end

# require 'twilio-ruby'

class UsersController < ActionController::API

  def send_verification_code
    setup_sms
    send_sms(params[:number],
      "Your verification code is: " + generate_verification_code)
  end

  private

    def generate_verification_code
      totp = ROTP::TOTP.new("base32secret3232")
      totp.now.to_s
    end

    def setup_sms
      account_sid = ENV['TWILIO_ACCOUNT_SID']
      auth_token = ENV['TWILIO_AUTH_TOKEN']
      @client = Twilio::REST::Client.new(account_sid, auth_token)
    end

    def send_sms(to, body)
      @client.messages.create(
        from: ENV['TWILIO_NUMBER'],
        to: to,
        body: body)
    end

end

Rename deliver_to as 'to' coinciding with decision to change the column name in the migration
Rename deliver_to as 'to' coinciding with decision to change the column name in the migration
