<commit_before>require 'rest-client'
require 'json'

module Roadmapster
  module Wizeline
    module BaseApi

      BASE_ENDPOINT = 'https://platform.wizelineroadmap.com/api/'

      def get(resource)
        JSON.parse(
          RestClient.get(
            "#{BASE_ENDPOINT}#{resource}",
            headers
          ).body,
          symbolize_names: true
        )
      end

      private

      def headers
        { authorization: "Bearer #{@api_token}", }
      end
    end
  end
end
<commit_msg>Refactor the base endpoint generation to support organization subdomains<commit_after>require 'rest-client'
require 'json'

module Roadmapster
  module Wizeline
    module BaseApi

      BASE_ENDPOINT = "https://<subdomain>.wizelineroadmap.com/api/"

      def get(resource, **options)
        @resource_options = options
        JSON.parse(
          RestClient.get(
            "#{base_endpoint(options)}#{resource}",
            headers
          ).body,
          symbolize_names: true
        )
      end

      private

      def headers
        { authorization: "Bearer #{@api_token}", }
      end

      def base_endpoint(options)
        if options.empty?
          BASE_ENDPOINT.sub('<subdomain>', 'platform')
        else
          BASE_ENDPOINT.sub('<subdomain>', options[:organization_domain])
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09615384615384616, 'fraction_numerical': 0.0, 'mean_word_length': 2.0336322869955157, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '2747372', 'n_tokens_mistral': 396, 'n_tokens_neox': 382, 'n_words': 86}