Class: Kaui::Bundle
- Inherits:
-
KillBillClient::Model::Bundle
- Object
- KillBillClient::Model::Bundle
- Kaui::Bundle
- Defined in:
- app/models/kaui/bundle.rb
Class Method Summary collapse
- .find_by_id_or_key(bundle_id_or_key, options = {}) ⇒ Object
- .list_or_search(search_key = nil, offset = 0, limit = 10, options = {}) ⇒ Object
Class Method Details
.find_by_id_or_key(bundle_id_or_key, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/models/kaui/bundle.rb', line 3 def self.find_by_id_or_key(bundle_id_or_key, = {}) if bundle_id_or_key =~ /[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}/ bundle = find_by_id(bundle_id_or_key, ) rescue nil return bundle unless bundle.nil? end # Return the active one find_by_external_key(bundle_id_or_key, false, ) end |
.list_or_search(search_key = nil, offset = 0, limit = 10, options = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/models/kaui/bundle.rb', line 13 def self.list_or_search(search_key = nil, offset = 0, limit = 10, = {}) if search_key.present? find_in_batches_by_search_key(search_key, offset, limit, ) else find_in_batches(offset, limit, ) end end |