<commit_before>class Moip
  attr_reader :token, :key
 
  def initialize(token = nil, key = nil)
    @token = token || get_token
    @key = key || get_key
  end
 
  def call
    authentication
  end

  def order(data)
    return @conn.post do |req|
      req.url '/v2/orders'
      req.headers['Content-Type'] = 'application/json'
      req.body = data.to_json
    end
  end

  def payment(order, data)
    return @conn.post do |req|
      req.url '/v2/orders/' + order + '/payments'
      req.headers['Content-Type'] = 'application/json'
      req.body = data.to_json
    end
  end
 
  private
 
  def get_token
    ENV['MOIP_TOKEN']
  end
 
  def get_key
    ENV['MOIP_KEY']
  end
 
  def authentication
    url = ENV['MOIP_TEST'] ? 'https://sandbox.moip.com.br/' : 'https://api.moip.com.br/'
    puts "================== MOIP ================"
    puts url
    puts get_token
    puts get_key
    puts "================== FIM MOIP ================"
    @conn = Faraday.new(url: url)
    @conn.basic_auth(token, key)
  end
end<commit_msg>ENV test ok<commit_after>class Moip
  attr_reader :token, :key
 
  def initialize(token = nil, key = nil)
    @token = token || get_token
    @key = key || get_key
  end
 
  def call
    authentication
  end

  def order(data)
    return @conn.post do |req|
      req.url '/v2/orders'
      req.headers['Content-Type'] = 'application/json'
      req.body = data.to_json
    end
  end

  def payment(order, data)
    return @conn.post do |req|
      req.url '/v2/orders/' + order + '/payments'
      req.headers['Content-Type'] = 'application/json'
      req.body = data.to_json
    end
  end
 
  private
 
  def get_token
    ENV['MOIP_TOKEN']
  end
 
  def get_key
    ENV['MOIP_KEY']
  end
 
  def authentication
    url = ENV['MOIP_TEST'] == 'true' ? 'https://sandbox.moip.com.br/' : 'https://api.moip.com.br/'
    puts "================== MOIP ================"
    puts url
    puts ENV['MOIP_TEST']
    puts get_token
    puts get_key
    puts "================== FIM MOIP ================"
    @conn = Faraday.new(url: url)
    @conn.basic_auth(token, key)
  end
end
{'fraction_non_alphanumeric': 0.18371212121212122, 'fraction_numerical': 0.001893939393939394, 'mean_word_length': 2.5996592844974447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '1627208', 'n_tokens_mistral': 766, 'n_tokens_neox': 736, 'n_words': 174}