<commit_before>module Etsy
  class Transaction
    include Model

    attribute :id, :from => :transaction_id
    attribute :buyer_id, :from => :buyer_user_id
    attribute :seller_id, :from => :seller_user_id
    attributes :quantity, :listing_id

    attribute :created, :from => :creation_tsz
    attribute :shipped, :from => :shipped_tsz
    attribute :paid, :from => :paid_tsz

    attributes :title, :description, :price, :currency_code, :quantity,
               :tags, :materials, :image_listing_id, :receipt_id,
               :is_digital, :file_data, :listing_id, :url, :product_data,
               :variations, :transaction_type, :buyer_feedback_id,
               :seller_feedback_id


    def self.find_all_by_shop_id(shop_id, options = {})
      get_all("/shops/#{shop_id}/transactions", options)
    end

    #Find all Transactions by the buyer_id
    #
    def self.find_all_by_buyer_id(user_id, options = {})
      get_all("/users/#{user_id}/transactions", options)
    end

    def self.find_all_by_receipt_id(receipt_id, options = {})
      get_all("/receipts/#{receipt_id}/transactions", options)
    end

    def receipt
      @receipt ||= Receipt.find(receipt_id)
    end

    def buyer
      @buyer ||= User.find(buyer_id)
    end

  end
end<commit_msg>Adding helpers<commit_after>module Etsy
  class Transaction
    include Model

    attribute :id, :from => :transaction_id
    attribute :buyer_id, :from => :buyer_user_id
    attribute :seller_id, :from => :seller_user_id
    attributes :quantity, :listing_id

    attribute :created, :from => :creation_tsz
    attribute :shipped, :from => :shipped_tsz
    attribute :paid, :from => :paid_tsz

    attributes :title, :description, :price, :currency_code, :quantity,
               :tags, :materials, :image_listing_id, :receipt_id,
               :is_digital, :file_data, :listing_id, :url, :product_data,
               :variations, :transaction_type, :buyer_feedback_id,
               :seller_feedback_id


    def self.find_all_by_shop_id(shop_id, options = {})
      get_all("/shops/#{shop_id}/transactions", options)
    end

    def created_at
      Time.at(created)
    end

    def shipped_at
      Time.at(shipped)
    end

    def paid_at
      Time.at(paid)
    end

    #Find all Transactions by the buyer_id
    #
    def self.find_all_by_buyer_id(user_id, options = {})
      get_all("/users/#{user_id}/transactions", options)
    end

    def self.find_all_by_receipt_id(receipt_id, options = {})
      get_all("/receipts/#{receipt_id}/transactions", options)
    end

    def receipt
      @receipt ||= Receipt.find(receipt_id)
    end

    def buyer
      @buyer ||= User.find(buyer_id)
    end

  end
end
{'fraction_non_alphanumeric': 0.11213915618060696, 'fraction_numerical': 0.0, 'mean_word_length': 3.0343283582089553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5289196', 'n_tokens_mistral': 971, 'n_tokens_neox': 904, 'n_words': 188}