<commit_before># frozen_string_literal: true

module Lokka
  module AmazonAssociate
    class Item
      attr_reader :item_id

      def initialize(item_id)
        @item_id = item_id
      end

      def title
        @title ||= item_info['Title']['DisplayValue']
      end

      def link
        @link ||= item['DetailPageURL']
      end


      def image
        @image ||= begin
                     image_url = item.dig('Images', 'Primary', 'Medium', 'URL').presence
                     image_url || '/plugin/lokka-amazon_associate/assets/no-image.png'
                   end
      end

      def manufacturer
        @manufacturer ||= Value.new(item_info.dig('ByLineInfo', 'Manufacturer')).to_s
      end

      def contributors
        @contributors ||= item_info.dig('ByLineInfo', 'Contributors')
      end

      def binding
        @binding ||= Value.new(classifications['Binding'])
      end

      def product_group
        @product_group ||= Value.new(classifications['ProductGroup'])
      end
<commit_msg>Fix amazon associate plugin bug<commit_after># frozen_string_literal: true

module Lokka
  module AmazonAssociate
    class Item
      attr_reader :item_id

      def initialize(item_id)
        @item_id = item_id
      end

      def title
        @title ||= item_info['Title']['DisplayValue']
      end

      def link
        @link ||= item['DetailPageURL']
      end


      def image
        @image ||= begin
                     image_url = item.dig('Images', 'Primary', 'Medium', 'URL').presence
                     image_url || '/plugin/lokka-amazon_associate/assets/no-image.png'
                   end
      end

      def manufacturer
        @manufacturer ||= Value.new(item_info.dig('ByLineInfo', 'Manufacturer')).to_s
      end

      def contributors
        @contributors ||= item_info.dig('ByLineInfo', 'Contributors')
      end

      def binding
        @binding ||= Value.new(classifications['Binding']).to_s
      end

      def product_group
        @product_group ||= Value.new(classifications['ProductGroup']).to_s
      end

{'fraction_non_alphanumeric': 0.10810810810810811, 'fraction_numerical': 0.0, 'mean_word_length': 2.1172932330827066, 'pattern_counts': {'":': 0, '<': 3, '<?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': '983556', 'n_tokens_mistral': 614, 'n_tokens_neox': 581, 'n_words': 126}