<commit_before>module CheddargetterClientRails
  class Subscription
    include ActiveModel::Validations

    Months = ("01".."12").freeze
    Years  = (Date.current.year..Date.current.year+10).collect{|y| y.to_s }.freeze
  
    attr_accessor :planCode,
                  :company,
                  :firstName,
                  :lastName,
                  :ccFirstName,
                  :ccLastName,
                  :ccExpiration,
                  :ccNumber,
                  :ccLastFour,
                  :ccCountry,
                  :ccAddress,
                  :ccCity,
                  :ccState,
                  :customerCode,
                  :email,
                  :zip

    validates_presence_of :firstName,
                          :lastName,
                          :email,
                          :customerCode,
                          :planCode

    validates_presence_of :ccNumber,
                          :ccExpiration,
                          :zip, :if => :paid_plan?

    validate :unexpired
  
    validate :validates_presence_of_humanized
  
    def paid_plan?
      !free_plan?
    end
  
    def free_plan?
      planCode == 'FREE_PLAN'
    end
  
    def unexpired
      if ccExpiration.present?
        month, year = ccExpiration.split("/").collect{|string| string.to_i }
        year  = ('20' + year.to_s).to_i if year.size < 4
        month = ('0' + month.to_s).to_i if month.size < 2<commit_msg>Removing customerCode requirement for subscription.<commit_after>module CheddargetterClientRails
  class Subscription
    include ActiveModel::Validations

    Months = ("01".."12").freeze
    Years  = (Date.current.year..Date.current.year+10).collect{|y| y.to_s }.freeze
  
    attr_accessor :planCode,
                  :company,
                  :firstName,
                  :lastName,
                  :ccFirstName,
                  :ccLastName,
                  :ccExpiration,
                  :ccNumber,
                  :ccLastFour,
                  :ccCountry,
                  :ccAddress,
                  :ccCity,
                  :ccState,
                  :customerCode,
                  :email,
                  :zip

    validates_presence_of :firstName,
                          :lastName,
                          :email,
                          :planCode
                          #:customerCode, generally we call valid before unique identifier is called

    validates_presence_of :ccNumber,
                          :ccExpiration,
                          :zip, :if => :paid_plan?

    validate :unexpired
  
    validate :validates_presence_of_humanized
  
    def paid_plan?
      !free_plan?
    end
  
    def free_plan?
      planCode == 'FREE_PLAN'
    end
  
    def unexpired
      if ccExpiration.present?
        month, year = ccExpiration.split("/").collect{|string| string.to_i }
        year  = ('20' + year.to_s).to_i if year.size < 4
        month = ('0' + month.to_s).to_i if month.size < 2
{'fraction_non_alphanumeric': 0.08684034736138944, 'fraction_numerical': 0.007348029392117568, 'mean_word_length': 1.2741078208048595, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7312157', 'n_tokens_mistral': 883, 'n_tokens_neox': 825, 'n_words': 160}