<commit_before>module Venmo
  module Pay
    def pay_by_email(email, amount, note, access_token, privacy)
      # -d email= \
      @send_hash= common(amount,note,access_token,privacy, { :email => email})
      core_pay
    end

    def pay_by_user_id(user_id, amount, note, access_token, privacy)
      # -d user_id= \
      @send_hash= common(amount,note,access_token,privacy, {:user_id => user_id})
      core_pay
    end

    def pay_by_phone_number(phone_number, amount, note, access_token, privacy)
      # -d phone= \
      @send_hash = common(amount,note,access_token,privacy, {:phone=> phone_number})
      core_pay
    end

    protected
    def common(new_amount, new_note, access_token, privacy, merge_in)
      {
       amount: new_amount,
       note: new_note,
       access_token: access_token,
       audience: privacy,
      }.merge(merge_in)
    end

    def core_pay
      h = @send_hash.collect{|k,v| "#{k.to_s}=#{v.respond_to?(:gsub) ? CGI::escape(v) : v}"}.join('&')
      to_send = "curl https://api.venmo.com/payments --data \"#{h}\""
      `#{to_send}`
    end
  end
end
<commit_msg>Update pay.rb<commit_after>module Venmo
  module Pay
    def pay_by_email(email, amount, note, access_token, privacy)
      # -d email= \
      @send_hash= common(amount,note,access_token,privacy, { :email => email})
      core_pay
    end

    def pay_by_user_id(user_id, amount, note, access_token, privacy)
      # -d user_id= \
      @send_hash= common(amount,note,access_token,privacy, {:user_id => user_id})
      core_pay
    end

    def pay_by_phone_number(phone_number, amount, note, access_token, privacy)
      # -d phone= \
      @send_hash = common(amount,note,access_token,privacy, {:phone=> phone_number})
      core_pay
    end

    protected
    def common(new_amount, new_note, access_token, privacy, merge_in)
      {
       amount: new_amount,
       note: new_note,
       access_token: access_token,
       audience: privacy,
      }.merge(merge_in)
    end

    def core_pay
      h = @send_hash.collect{|k,v| "#{k.to_s}=#{v.respond_to?(:gsub) ? CGI::escape(v) : v}"}.join('&')
      if Rails.env.production?
        to_send = "curl https://api.venmo.com/v1/payments --data \"#{h}\""
      else
        to_send = "curl https://sandbox-api.venmo.com/v1/payments --data \"#{h}\""
      end
      `#{to_send}`
    end
  end
end

{'fraction_non_alphanumeric': 0.136980491942324, 'fraction_numerical': 0.0008481764206955047, 'mean_word_length': 2.8608837970540097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 3, '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': '1019091', 'n_tokens_mistral': 855, 'n_tokens_neox': 844, 'n_words': 168}