cfoundry 0.3.26 → 0.3.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,6 +29,7 @@ module CFoundry::V2
29
29
  attribute :disk_quota, :integer, :default => 256
30
30
  attribute :state, :integer, :default => "STOPPED"
31
31
  to_many :service_bindings
32
+ to_many :routes
32
33
 
33
34
  alias :total_instances :instances
34
35
  alias :total_instances= :instances=
@@ -63,13 +64,15 @@ module CFoundry::V2
63
64
  nil
64
65
  end
65
66
 
66
- def uris # TODO v2
67
- []
67
+ def uris
68
+ routes.collect do |r|
69
+ "#{r.host}.#{r.domain.name}"
70
+ end
68
71
  end
69
72
  alias :urls :uris
70
73
 
71
74
  def uris=(x)
72
- nil
75
+ raise "App#uris= is invalid against V2 APIs. Use add/remove_route."
73
76
  end
74
77
  alias :urls= :uris=
75
78
 
@@ -47,7 +47,7 @@ module CFoundry::V2
47
47
 
48
48
 
49
49
  [ :app, :organization, :space, :user, :runtime, :framework, :service,
50
- :domain, :service_plan, :service_binding, :service_instance,
50
+ :domain, :route, :service_plan, :service_binding, :service_instance,
51
51
  :service_auth_token
52
52
  ].each do |obj|
53
53
  plural = "#{obj}s"
@@ -15,6 +15,7 @@ require "cfoundry/v2/service_auth_token"
15
15
  require "cfoundry/v2/space"
16
16
  require "cfoundry/v2/user"
17
17
  require "cfoundry/v2/domain"
18
+ require "cfoundry/v2/route"
18
19
 
19
20
  module CFoundry::V2
20
21
  # The primary API entrypoint. Wraps a BaseClient to provide nicer return
@@ -123,7 +124,7 @@ module CFoundry::V2
123
124
 
124
125
 
125
126
  [ :app, :organization, :space, :user, :runtime, :framework, :service,
126
- :domain, :service_plan, :service_binding, :service_instance,
127
+ :domain, :route, :service_plan, :service_binding, :service_instance,
127
128
  :service_auth_token
128
129
  ].each do |singular|
129
130
  plural = :"#{singular}s"
@@ -3,6 +3,6 @@ require "cfoundry/v2/model"
3
3
  module CFoundry::V2
4
4
  class Domain < Model
5
5
  attribute :name, :string
6
- to_one :organization
6
+ to_one :owning_organization, :as => :organization
7
7
  end
8
8
  end
@@ -130,8 +130,8 @@ module CFoundry::V2
130
130
  manifest[:entity][:"#{plural}_url"]
131
131
  }
132
132
 
133
- # TODO: these are hacky
134
133
  define_method(:"add_#{singular}") { |x|
134
+ # TODO: reflect this change in the app manifest?
135
135
  Model.validate_type(x, CFoundry::V2.const_get(kls))
136
136
 
137
137
  @client.base.request_path(
@@ -140,7 +140,10 @@ module CFoundry::V2
140
140
  nil => :json)
141
141
  }
142
142
 
143
- define_method(:"remove_#{singular}") {
143
+ define_method(:"remove_#{singular}") { |x|
144
+ # TODO: reflect this change in the app manifest?
145
+ Model.validate_type(x, CFoundry::V2.const_get(kls))
146
+
144
147
  @client.base.request_path(
145
148
  :delete,
146
149
  ["v2", "#{object_name}s", @guid, plural, x.guid],
@@ -0,0 +1,9 @@
1
+ require "cfoundry/v2/model"
2
+
3
+ module CFoundry::V2
4
+ class Route < Model
5
+ attribute :host, :string
6
+ to_one :domain
7
+ to_one :organization
8
+ end
9
+ end
@@ -1,4 +1,4 @@
1
1
  module CFoundry # :nodoc:
2
2
  # CFoundry library version number.
3
- VERSION = "0.3.26"
3
+ VERSION = "0.3.27"
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfoundry
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 26
10
- version: 0.3.26
9
+ - 27
10
+ version: 0.3.27
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Suraci
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-30 00:00:00 Z
18
+ date: 2012-08-31 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rest-client
@@ -131,6 +131,7 @@ files:
131
131
  - lib/cfoundry/v2/framework.rb
132
132
  - lib/cfoundry/v2/model.rb
133
133
  - lib/cfoundry/v2/organization.rb
134
+ - lib/cfoundry/v2/route.rb
134
135
  - lib/cfoundry/v2/runtime.rb
135
136
  - lib/cfoundry/v2/service.rb
136
137
  - lib/cfoundry/v2/service_auth_token.rb