<commit_before># frozen_string_literal: true

module ServiceLayerNg
  class MasterdataCockpitService < Core::ServiceLayerNg::Service
    def available?(_action_name_sym = nil)
      elektron.service?('sapcc-billing')
    end

    def elektron_billing
      @elektron_billing ||= elektron(debug: Rails.env.development?).service(
        'sapcc-billing', path_prefix: '/masterdata'
      )
    end

    def project_map
      @project_map ||= class_map_proc(MasterdataCockpit::ProjectMasterdata)
    end

    def domain_map
      @domain_map ||= class_map_proc(MasterdataCockpit::DomainMasterdata)
    end

    def missing_projects
      elektron_billing.get('missing').map_to('body', &project_map)
    end

    def get_project(id)
      elektron_billing.get("projects/#{id}").map_to('body', &project_map)
    end

    def get_domain(id)
      elektron_billing.get("domains/#{id}").map_to('body', &domain_map)
    end
<commit_msg>pin billing on public interface<commit_after># frozen_string_literal: true

module ServiceLayerNg
  class MasterdataCockpitService < Core::ServiceLayerNg::Service
    def available?(_action_name_sym = nil)
      elektron.service?('sapcc-billing')
    end

    def elektron_billing
      @elektron_billing ||= elektron(debug: Rails.env.development?).service(
        'sapcc-billing', path_prefix: '/masterdata', interface: 'public'
      )
    end

    def project_map
      @project_map ||= class_map_proc(MasterdataCockpit::ProjectMasterdata)
    end

    def domain_map
      @domain_map ||= class_map_proc(MasterdataCockpit::DomainMasterdata)
    end

    def missing_projects
      elektron_billing.get('missing').map_to('body', &project_map)
    end

    def get_project(id)
      elektron_billing.get("projects/#{id}").map_to('body', &project_map)
    end

    def get_domain(id)
      elektron_billing.get("domains/#{id}").map_to('body', &domain_map)
    end

{'fraction_non_alphanumeric': 0.11410459587955626, 'fraction_numerical': 0.0, 'mean_word_length': 3.9194805194805196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1377668', 'n_tokens_mistral': 651, 'n_tokens_neox': 631, 'n_words': 100}