Class: JCF::CF::Services
- Inherits:
-
Object
- Object
- JCF::CF::Services
- Defined in:
- lib/jcf/cf/services.rb
Class Method Summary collapse
Class Method Details
.first(name:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jcf/cf/services.rb', line 8 def self.first(name:) # Find the broker, then find all offerings for that broker, then all plans # { broker: { offerings: { plans: [] } } # e.g. { "p-mysql (guid)": { "10mb (guid)": [], "100mb (guid)": [] } } broker = ServiceBroker.first(name: name) offerings = ServiceOffering.all(service_broker_guids: broker.guid).map do |offering| plans = ServicePlan.all(service_offering_guids: offering.guid) { offering.to_s => plans } end { broker.to_s => offerings } end |