<commit_before>object @shipment
cache @shipment
attributes *shipment_attributes

child selected_shipping_rate: :selected_shipping_rate do
  extends "spree/api/shipping_rates/show"
end

child inventory_units: :inventory_units do
  object @inventory_unit
  attributes *inventory_unit_attributes

  child :variant do
    extends "spree/api/variants/small"
    attributes :product_id
    child(images: :images) { extends "spree/api/images/show" }
  end

  child :line_item do
    attributes *line_item_attributes
    node(:single_display_amount) { |li| li.single_display_amount.to_s }
    node(:display_amount) { |li| li.display_amount.to_s }
    node(:total) { |li| li.total }
  end
end

child order: :order do
  extends "spree/api/orders/order"

  child billing_address: :bill_address do
    extends "spree/api/addresses/show"
  end

  child shipping_address: :ship_address do
    extends "spree/api/addresses/show"
  end

  child adjustments: :adjustments do
    extends "spree/api/adjustments/show"
  end

  child payments: :payments do
    attributes :id, :amount, :display_amount, :state
    child source: :source do |s|
      if s.is_a?(Spree::CreditCard)
        attributes :id, :cc_type
      else
        attributes :id
      end<commit_msg>Make the attribute list more flexible<commit_after>object @shipment
cache @shipment
attributes *shipment_attributes

child selected_shipping_rate: :selected_shipping_rate do
  extends "spree/api/shipping_rates/show"
end

child inventory_units: :inventory_units do
  object @inventory_unit
  attributes *inventory_unit_attributes

  child :variant do
    extends "spree/api/variants/small"
    attributes :product_id
    child(images: :images) { extends "spree/api/images/show" }
  end

  child :line_item do
    attributes *line_item_attributes
    node(:single_display_amount) { |li| li.single_display_amount.to_s }
    node(:display_amount) { |li| li.display_amount.to_s }
    node(:total) { |li| li.total }
  end
end

child order: :order do
  extends "spree/api/orders/order"

  child billing_address: :bill_address do
    extends "spree/api/addresses/show"
  end

  child shipping_address: :ship_address do
    extends "spree/api/addresses/show"
  end

  child adjustments: :adjustments do
    extends "spree/api/adjustments/show"
  end

  child payments: :payments do
    attributes :id, :amount, :display_amount, :state
    child source: :source do |s|
      attrs = [:id]
      if s.respond_to?(:cc_type)
        attrs << :cc_type
      end
      attributes *attrs
{'fraction_non_alphanumeric': 0.09173947577442415, 'fraction_numerical': 0.0, 'mean_word_length': 3.9007782101167314, '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': '1779924', 'n_tokens_mistral': 837, 'n_tokens_neox': 828, 'n_words': 202}