<commit_before>module Apruve
  class CorporateAccount < Apruve::ApruveObject
    attr_accessor :id, :merchant_uuid, :customer_uuid, :type, :created_at, :updated_at, :payment_term_strategy_name,
                  :disabled_at, :name, :creditor_term_id, :payment_method_id, :status, :trusted_merchant

    def self.find(merchant_id, email)
      response = Apruve.get("merchants/#{merchant_id}/corporate_accounts?email=#{email}")
      return CorporateAccount.new(response.body.empty? ? {} : response.body[0])
    end
  end
end<commit_msg>AP-5533: Added get all corporate accounts for merchant method to CorporateAccount as well as specs<commit_after>module Apruve
  class CorporateAccount < Apruve::ApruveObject
    attr_accessor :id, :merchant_uuid, :customer_uuid, :type, :created_at, :updated_at, :payment_term_strategy_name,
                  :disabled_at, :name, :creditor_term_id, :payment_method_id, :status, :trusted_merchant

    def self.find(merchant_id, email=nil)
      if email.nil?
        return find_all(merchant_id)
      end
      response = Apruve.get("merchants/#{merchant_id}/corporate_accounts?email=#{email}")
      CorporateAccount.new(response.body.empty? ? {} : response.body[0])
    end

    def self.find_all(merchant_id)
      response = Apruve.get("merchants/#{merchant_id}/corporate_accounts")
      response.body.map { |ca| CorporateAccount.new(ca.empty? ? {} : ca) }
    end
  end
end
{'fraction_non_alphanumeric': 0.11573747353563868, 'fraction_numerical': 0.004234297812279464, 'mean_word_length': 4.391634980988593, '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': '7379331', 'n_tokens_mistral': 488, 'n_tokens_neox': 473, 'n_words': 86}