lib/cfoundry/v1/client.rb in cfoundry-0.5.0 vs lib/cfoundry/v1/client.rb in cfoundry-0.5.1.rc1
- old
+ new
@@ -104,17 +104,29 @@
meta[:supported_versions].each do |ver|
state = meta[:version_aliases].find { |k, v| v == ver }
services <<
Service.new(vendor.to_s, ver.to_s, meta[:description],
- type.to_s, provider.to_s, state && state.first)
+ type.to_s, provider.to_s, state && state.first,
+ generate_plans(meta))
end
end
end
end
end
services
+ end
+
+ def generate_plans(meta)
+ names = meta[:plans]
+ descriptions = meta[:plan_descriptions]
+ default_name = meta[:default_plan]
+ names.map { |name|
+ description = descriptions[name] if descriptions
+ is_default = name == default_name || names.length == 1
+ ServicePlan.new(name, description, is_default)
+ }
end
# Retrieve available runtimes.
def runtimes(options = {})
runtimes = []