<commit_before>require 'faraday'
require 'faraday_middleware'
require 'json'

require 'line_change/connection/response_handler'

module LineChange
  class Connection

    APK_MIME_TYPE = 'application/vnd.android.package-archive'.freeze
    API_KEY_HEADER = 'X-HockeyAppToken'.freeze

    def initialize(adapters = [Faraday.default_adapter], logging = false)
      @conn = Faraday.new(url: 'https://rink.hockeyapp.net') do |faraday|
        faraday.request  :multipart
        faraday.request  :url_encoded
        faraday.request  :json

        faraday.response :logger if logging
        faraday.response :json
        faraday.use ResponseHandler

        faraday.adapter  *adapters
      end
    end

    def upload(path, id)
      conn.post do |req|
        req.url url(id)
        req.headers[API_KEY_HEADER] = LineChange.configuration.api_key
        req.body = body(path)
      end
    end

    private
<commit_msg>No need to use a block, just inline everything<commit_after>require 'faraday'
require 'faraday_middleware'
require 'json'

require 'line_change/connection/response_handler'

module LineChange
  class Connection

    APK_MIME_TYPE = 'application/vnd.android.package-archive'.freeze
    API_KEY_HEADER = 'X-HockeyAppToken'.freeze

    def initialize(adapters = [Faraday.default_adapter], logging = false)
      @conn = Faraday.new(url: 'https://rink.hockeyapp.net') do |faraday|
        faraday.request  :multipart
        faraday.request  :url_encoded
        faraday.request  :json

        faraday.response :logger if logging
        faraday.response :json
        faraday.use ResponseHandler

        faraday.adapter  *adapters
      end
    end

    def upload(path, id)
      conn.post(url(id), body(path), API_KEY_HEADER => LineChange.configuration.api_key)
    end

    private

{'fraction_non_alphanumeric': 0.08859357696567, 'fraction_numerical': 0.0, 'mean_word_length': 3.024498886414254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '3803505', 'n_tokens_mistral': 591, 'n_tokens_neox': 546, 'n_words': 120}