<commit_before>module Etsy
  module Model # :nodoc:all
    
    module ClassMethods
      
      def attribute(name, options = {})
        from = options.fetch(:from, name)

        class_eval <<-CODE
          def #{name}
            @result['#{from}']
          end
        CODE
      end
      
      def attributes(*names)
        names.each {|name| attribute(name) }
      end

      def finder(type, endpoint)
        parameter = endpoint.scan(/:\w+/).first
        parameter.sub!(/^:/, '')

        endpoint.sub!(":#{parameter}", '#{' + parameter + '}')

        send("find_#{type}", parameter, endpoint)
      end
      
      def find_all(parameter, endpoint)
        class_eval <<-CODE
          def self.find_all_by_#{parameter}(#{parameter})
            response = Request.get("#{endpoint}")
            response.result.map {|listing| new(listing) }
          end
        CODE
      end
      
      def find_one(parameter, endpoint)
        class_eval <<-CODE
          def self.find_by_#{parameter}(#{parameter})
            response = Request.get("#{endpoint}")
            new response.result
          end
        CODE
      end
      
    end
    
    module InstanceMethods
      
      def initialize(result = nil)
        @result = result
      end
      
    end
    
    def self.included(other)
      other.send(:extend, Etsy::Model::ClassMethods)
      other.send(:include, Etsy::Model::InstanceMethods)
    end
    
    <commit_msg>Remove unused model code<commit_after>module Etsy
  module Model # :nodoc:all

    module ClassMethods

      def attribute(name, options = {})
        from = options.fetch(:from, name)

        class_eval <<-CODE
          def #{name}
            @result['#{from}']
          end
        CODE
      end

      def attributes(*names)
        names.each {|name| attribute(name) }
      end

    end

    module InstanceMethods

      def initialize(result = nil)
        @result = result
      end

    end

    def self.included(other)
      other.send(:extend, Etsy::Model::ClassMethods)
      other.send(:include, Etsy::Model::InstanceMethods)
    end


{'fraction_non_alphanumeric': 0.11642214860388074, 'fraction_numerical': 0.0, 'mean_word_length': 1.8074369189907038, 'pattern_counts': {'":': 1, '<': 11, '<?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': '303064', 'n_tokens_mistral': 612, 'n_tokens_neox': 601, 'n_words': 132}