cfoundry 1.1.0.rc1 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
@@ -159,6 +159,10 @@ module CFoundry::V2
159
159
  true
160
160
  end
161
161
 
162
+ def to_param
163
+ persisted? ? @guid.to_s : nil
164
+ end
165
+
162
166
  def to_key
163
167
  persisted? ? [@guid] : nil
164
168
  end
@@ -151,6 +151,7 @@ module CFoundry::V2
151
151
 
152
152
  define_method(name) do
153
153
  return @cache[name] if @cache.key?(name)
154
+ return nil unless persisted?
154
155
 
155
156
  @cache[name] =
156
157
  if manifest[:entity].key?(json_name)
@@ -3,6 +3,7 @@ require "cfoundry/v2/model"
3
3
  module CFoundry::V2
4
4
  class ServiceInstance < Model
5
5
  attribute :name, :string
6
+ attribute :dashboard_url, :string
6
7
  to_one :space
7
8
  to_one :service_plan
8
9
  to_many :service_bindings
@@ -1,4 +1,4 @@
1
1
  module CFoundry # :nodoc:
2
2
  # CFoundry library version number.
3
- VERSION = "1.1.0.rc1".freeze
3
+ VERSION = "1.1.0.rc2".freeze
4
4
  end
@@ -216,6 +216,23 @@ describe CFoundry::V2::Model do
216
216
  end
217
217
  end
218
218
 
219
+ describe "#to_param" do
220
+ context "when persisted" do
221
+ it "returns the guid as a string" do
222
+ subject.to_param.should be_a(String)
223
+ subject.to_param.should == guid
224
+ end
225
+ end
226
+
227
+ context "when not persisted" do
228
+ let(:guid) { nil }
229
+
230
+ it "returns nil" do
231
+ subject.to_param.should be_nil
232
+ end
233
+ end
234
+ end
235
+
219
236
  describe "#persisted?" do
220
237
  context "on a new object" do
221
238
  let(:guid) { nil }
@@ -241,4 +258,27 @@ describe CFoundry::V2::Model do
241
258
  end
242
259
  end
243
260
  end
261
+
262
+ describe "creating a new object" do
263
+ describe "getting attributes" do
264
+ let(:new_object) {
265
+ client.fake_model_with_attribute
266
+ }
267
+
268
+ it "does not go to cloud controller" do
269
+ expect {
270
+ new_object.time
271
+ }.to_not raise_error
272
+ end
273
+
274
+ it "remembers set values" do
275
+ new_object.time = "now"
276
+ new_object.time.should == "now"
277
+ end
278
+ end
279
+ end
280
+ end
281
+
282
+ class FakeModelWithAttribute < CFoundry::V2::FakeModel
283
+ attribute :time, :string
244
284
  end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module CFoundry::V2
@@ -6,13 +6,14 @@
6
6
  "updated_at": null
7
7
  },
8
8
  "entity": {
9
- "name": "wut",
9
+ "name": "service-instance-name-1",
10
10
  "service_plan_guid": "service-plan-id-1",
11
11
  "space_guid": "space-id-1",
12
12
  "gateway_data": {
13
13
  "plan": "100",
14
14
  "version": "9.0"
15
15
  },
16
+ "dashboard_url": "https://dev3cloudfoundry.appdirect.com/api/custom/cloudfoundry/v1/services/service-instance-id-1/sso",
16
17
  "service_bindings_url": "/v2/service_instances/service-instance-id-1/service_bindings",
17
18
  "service_bindings": [
18
19
  {
@@ -0,0 +1,70 @@
1
+ {
2
+ "total_results": 3,
3
+ "total_pages": 1,
4
+ "prev_url": null,
5
+ "next_url": null,
6
+ "resources": [
7
+ {
8
+ "metadata": {
9
+ "guid": "service-instance-id-1",
10
+ "url": "/v2/service_instances/service-instance-id-1",
11
+ "created_at": "2013-05-02 22:20:15 +0000",
12
+ "updated_at": null
13
+ },
14
+ "entity": {
15
+ "name": "billing-db",
16
+ "credentials": {
17
+ "name": "dfba7bcc1e4984d6e865dacf9f46624a1",
18
+ "hostname": "mysql-service-cf-internal.csvbuoabzxev.us-east-1.rds.amazonaws.com",
19
+ "host": "mysql-service-cf-internal.csvbuoabzxev.us-east-1.rds.amazonaws.com",
20
+ "port": 3306,
21
+ "user": "u5Ly7kM6yR54H",
22
+ "username": "u5Ly7kM6yR54H",
23
+ "password": "p6GsdwKKQRmes",
24
+ "node_id": "rds_mysql_node_cfinternal_0"
25
+ },
26
+ "service_plan_guid": "3757e197-8f8b-4e19-9bc0-111eac4ede21",
27
+ "space_guid": "space-id-1",
28
+ "gateway_data": {
29
+ "plan": "cfinternal",
30
+ "version": "n/a"
31
+ },
32
+ "dashboard_url": "https://dev3cloudfoundry.appdirect.com/api/custom/cloudfoundry/v1/services/service-instance-id-1/sso",
33
+ "service_bindings_url": "/v2/service_instances/service-instance-id-1/service_bindings",
34
+ "space_url": "/v2/spaces/space-id-1",
35
+ "service_plan_url": "/v2/service_plans/3757e197-8f8b-4e19-9bc0-111eac4ede21"
36
+ }
37
+ },
38
+ {
39
+ "metadata": {
40
+ "guid": "service-instance-id-2",
41
+ "url": "/v2/service_instances/service-instance-id-2",
42
+ "created_at": "2013-05-02 23:59:58 +0000",
43
+ "updated_at": null
44
+ },
45
+ "entity": {
46
+ "name": "console-db",
47
+ "credentials": {
48
+ "name": "d253638cc55d64088ab5fe4639c68464c",
49
+ "hostname": "mysql-service-cf-internal.csvbuoabzxev.us-east-1.rds.amazonaws.com",
50
+ "host": "mysql-service-cf-internal.csvbuoabzxev.us-east-1.rds.amazonaws.com",
51
+ "port": 3306,
52
+ "user": "ujkG3BChhB7g4",
53
+ "username": "ujkG3BChhB7g4",
54
+ "password": "piNlqVQM7iJ62",
55
+ "node_id": "rds_mysql_node_cfinternal_0"
56
+ },
57
+ "service_plan_guid": "3757e197-8f8b-4e19-9bc0-111eac4ede21",
58
+ "space_guid": "space-id-1",
59
+ "gateway_data": {
60
+ "plan": "cfinternal",
61
+ "version": "n/a"
62
+ },
63
+ "dashboard_url": null,
64
+ "service_bindings_url": "/v2/service_instances/service-instance-id-2/service_bindings",
65
+ "space_url": "/v2/spaces/space-id-1",
66
+ "service_plan_url": "/v2/service_plans/3757e197-8f8b-4e19-9bc0-111eac4ede21"
67
+ }
68
+ }
69
+ ]
70
+ }
@@ -45,7 +45,7 @@
45
45
  ],
46
46
  "services":[
47
47
  {
48
- "guid":"service-id-1",
48
+ "guid":"service-instance-id-1",
49
49
  "name":"service-name-1",
50
50
  "bound_app_count":1,
51
51
  "service_plan": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfoundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.rc1
4
+ version: 1.1.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-17 00:00:00.000000000 Z
13
+ date: 2013-05-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multipart-post
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: '1.3'
38
+ version: '1.7'
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: '1.3'
46
+ version: '1.7'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rubyzip
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -189,13 +189,13 @@ dependencies:
189
189
  - !ruby/object:Gem::Version
190
190
  version: 0.6.1
191
191
  - !ruby/object:Gem::Dependency
192
- name: json_pure
192
+ name: shoulda-matchers
193
193
  requirement: !ruby/object:Gem::Requirement
194
194
  none: false
195
195
  requirements:
196
196
  - - ~>
197
197
  - !ruby/object:Gem::Version
198
- version: 1.7.7
198
+ version: 1.5.6
199
199
  type: :development
200
200
  prerelease: false
201
201
  version_requirements: !ruby/object:Gem::Requirement
@@ -203,15 +203,15 @@ dependencies:
203
203
  requirements:
204
204
  - - ~>
205
205
  - !ruby/object:Gem::Version
206
- version: 1.7.7
206
+ version: 1.5.6
207
207
  - !ruby/object:Gem::Dependency
208
- name: shoulda-matchers
208
+ name: json_pure
209
209
  requirement: !ruby/object:Gem::Requirement
210
210
  none: false
211
211
  requirements:
212
212
  - - ~>
213
213
  - !ruby/object:Gem::Version
214
- version: 1.5.6
214
+ version: '1.8'
215
215
  type: :development
216
216
  prerelease: false
217
217
  version_requirements: !ruby/object:Gem::Requirement
@@ -219,7 +219,7 @@ dependencies:
219
219
  requirements:
220
220
  - - ~>
221
221
  - !ruby/object:Gem::Version
222
- version: 1.5.6
222
+ version: '1.8'
223
223
  description:
224
224
  email:
225
225
  - vcap-dev@googlegroups.com
@@ -390,7 +390,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
390
390
  version: '0'
391
391
  segments:
392
392
  - 0
393
- hash: -1889885215026340519
393
+ hash: 2694169785835555618
394
394
  required_rubygems_version: !ruby/object:Gem::Requirement
395
395
  none: false
396
396
  requirements:
@@ -399,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
399
  version: 1.3.1
400
400
  requirements: []
401
401
  rubyforge_project: cfoundry
402
- rubygems_version: 1.8.25
402
+ rubygems_version: 1.8.24
403
403
  signing_key:
404
404
  specification_version: 3
405
405
  summary: High-level library for working with the Cloud Foundry API.