<commit_before>module QuickTravel
  class Route < Adapter
    # find_by_id -- but the API only does lookup by product_type_id
    def self.find_by_route_id_and_product_type_id(route_id, product_type_id)
      all_by_route_ids_and_product_type_id([route_id.to_i], product_type_id).first
    end

    # Return routes that match the given ids and product_type_id
    #
    # Initializes with path set
    def self.all_by_route_ids_and_product_type_id(route_ids, product_type_id)
      all(product_type_id).select do |route|
        route_ids.include?(route.id.to_i)
      end
    end

    # All routes for a given product type
    def self.all(product_type_id)
      find_all!("/product_types/#{product_type_id}/routes.json",
                cache: "QuickTravel::Route.all-#{product_type_id}-attrs",
                # expires_in will only work with something like Rails.cache
                cache_options: { expires_in: 1440.minutes })<commit_msg>Route can go back to standard cache expiry (1 day)<commit_after>module QuickTravel
  class Route < Adapter
    # find_by_id -- but the API only does lookup by product_type_id
    def self.find_by_route_id_and_product_type_id(route_id, product_type_id)
      all_by_route_ids_and_product_type_id([route_id.to_i], product_type_id).first
    end

    # Return routes that match the given ids and product_type_id
    #
    # Initializes with path set
    def self.all_by_route_ids_and_product_type_id(route_ids, product_type_id)
      all(product_type_id).select do |route|
        route_ids.include?(route.id.to_i)
      end
    end

    # All routes for a given product type
    def self.all(product_type_id)
      find_all!("/product_types/#{product_type_id}/routes.json",
                cache: "QuickTravel::Route.all-#{product_type_id}-attrs")
{'fraction_non_alphanumeric': 0.07709497206703911, 'fraction_numerical': 0.002793296089385475, 'mean_word_length': 3.5, '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': '3363186', 'n_tokens_mistral': 598, 'n_tokens_neox': 582, 'n_words': 128}