Sha256: 7cda6579e80aff4bfbcc74e9285e0e20a2329ca8fba65257e68df4f331fc9878
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module CFoundry class Service attr_reader :name def initialize(name, client, manifest = nil) @name = name @client = client @manifest = manifest end def inspect "#<Service '#@name'>" end def manifest @manifest ||= @client.rest.service(@name) end def delete! @client.rest.delete_service(@name) end def create! @client.rest.create_service(@manifest.merge("name" => @name)) end def exists? @client.rest.service(@name) true rescue CFoundry::NotFound false end def created Time.at(meta["created"]) end def updated Time.at(meta["updated"]) end { :type => "type", :vendor => "vendor", :version => "version", :properties => "properties", :tier => "tier", :meta => "meta" }.each do |meth, attr| define_method(meth) do manifest[attr] end define_method(:"#{meth}=") do |v| @manifest ||= {} @manifest[attr] = v end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cfoundry-0.2.0 | lib/cfoundry/service.rb |
cfoundry-0.1.2 | lib/cfoundry/service.rb |
cfoundry-0.1.1 | lib/cfoundry/service.rb |
cfoundry-0.1.0 | lib/cfoundry/service.rb |