Class: CfRubyClient::Space

Inherits:
Base
  • Object
show all
Defined in:
lib/cf_ruby_client/space.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#api_endpoint, #authorization_string, #cloud_foundry_config, #delete_entity, #fetch_entities, #logger, #patch_entity, #post_entity, #put_entity, #resource, #uaa_endpoint

Constructor Details

#initialize(guid) ⇒ Space

Returns a new instance of Space.



11
12
13
# File 'lib/cf_ruby_client/space.rb', line 11

def initialize(guid)
  @guid = guid
end

Instance Attribute Details

#guidObject (readonly)

Returns the value of attribute guid.



9
10
11
# File 'lib/cf_ruby_client/space.rb', line 9

def guid
  @guid
end

Class Method Details

.allObject



4
5
6
7
# File 'lib/cf_ruby_client/space.rb', line 4

def self.all
  url_path = "/v2/spaces"
  JSON::parse(CfRubyClient::Base.new.fetch_entities(url_path))
end

Instance Method Details

#app_guidsObject



20
21
22
23
24
25
26
# File 'lib/cf_ruby_client/space.rb', line 20

def app_guids
  if not(apps.nil? or apps.empty?)
    apps["resources"].collect {|entry| entry["metadata"]["guid"]}
  else
    []
  end
end

#appsObject



15
16
17
18
# File 'lib/cf_ruby_client/space.rb', line 15

def apps
  url_path = "/v2/spaces/#{guid}/apps"
  JSON::parse(fetch_entities(url_path))
end