<commit_before>class Authentication
  
  include Mongoid::Document
  
  embedded_in :user
  
  field :provider,      type: String
  field :uid,           type: String
  
end<commit_msg>Added a method to build a Authentication.rb model from an oAuth hash as well as adding attr_accessors for :provider and :uid.<commit_after>class Authentication
  
  include Mongoid::Document
  
  attr_accessible :provider, :uid
  
  embedded_in :user
  
  field :provider,      type: String
  field :uid,           type: String
  
  # Public: Helps you build an authentication directly from an Cloudsdale oAuth hash.
  # 
  # Examples
  #
  # auth = @user.authentications.build_from_oauth { uid: "1234", provider: "someprovider", cli_type: "ios" }
  # => <Authentication uid: "1234", provider: "someprovider">
  #
  # Returns the Authentication object instance.
  def self.build_from_oauth(raw_hash={})
    filtered_hash = raw_hash.reject { |key,value| !["provider","uid"].include?(key) }
    self.find_or_initialize(filtered_hash)
  end
  
end
{'fraction_non_alphanumeric': 0.09523809523809523, 'fraction_numerical': 0.007774538386783284, 'mean_word_length': 3.618834080717489, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4525557', 'n_tokens_mistral': 325, 'n_tokens_neox': 315, 'n_words': 91}