class Hula::ServiceBroker::Service

Attributes

bindable[R]
description[R]
id[R]
name[R]
plans[R]

Public Class Methods

new(args = {}) click to toggle source
# File lib/hula/service_broker/service.rb, line 17
def initialize(args = {})
  @id          = args.fetch(:id)
  @name        = args.fetch(:name)
  @description = args.fetch(:description)
  @bindable    = !!args.fetch(:bindable)
  @plans       = args.fetch(:plans).map { |p| Plan.new(p.merge(service_id: self.id)) }
end

Public Instance Methods

==(other) click to toggle source
# File lib/hula/service_broker/service.rb, line 27
def ==(other)
  is_a?(other.class) &&
    id == other.id &&
    name == other.name &&
    description == other.description &&
    bindable == other.bindable &&
    plans == other.plans
end
plan(plan_name) click to toggle source
# File lib/hula/service_broker/service.rb, line 36
def plan(plan_name)
  plans.find { |p| p.name == plan_name } or
    fail(PlanNotFoundError, [
      %{Unknown plan with name: #{plan_name.inspect}},
      "  Known plan names are: #{plans.map(&:name).inspect}"
      ].join("\n")
    )
end