Class: Billing::ProductCatalogue

Inherits:
ApplicationRecord show all
Defined in:
app/models/billing/product_catalogue.rb

Overview

a group of products

Instance Method Summary collapse

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#find_product_for_request(request) ⇒ Object


9
10
11
12
13
# File 'app/models/billing/product_catalogue.rb', line 9

def find_product_for_request(request)
  return billing_products.first if single_product?

  billing_products.find_by(identifier: request.billing_product_identifier)
end

#single_product?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'app/models/billing/product_catalogue.rb', line 15

def single_product?
  billing_products.size == 1
end