cfoundry 4.0.4.rc1 → 4.0.4.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/cfoundry/client.rb +1 -1
- data/lib/cfoundry/v2/client.rb +8 -0
- data/lib/cfoundry/v2/managed_service_instance.rb +13 -0
- data/lib/cfoundry/v2/service_instance.rb +0 -3
- data/lib/cfoundry/v2/user_provided_service_instance.rb +2 -6
- data/lib/cfoundry/version.rb +1 -1
- data/spec/cfoundry/client_spec.rb +0 -9
- data/spec/cfoundry/v2/client_spec.rb +21 -0
- data/spec/cfoundry/v2/{service_instance_spec.rb → managed_service_instance_spec.rb} +3 -1
- data/spec/factories/service_instances_factory.rb +1 -1
- data/spec/fixtures/fake_cc_managed_service_instance.json +83 -0
- data/spec/fixtures/fake_cc_user_provided_service_instance.json +51 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzcyYjhmZjYxNzg5Yzg5NDFhZDJiZThlZmQzMjdiOGE4ZTg3ODEzMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTFlMTk5ODQ5YTQxMTM2NmJkYjQ2YmFkZDRkOTM5ZDhmNmE1N2JjYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTUwNTA2ZmRiN2JhM2MzNjIxZWQ5MzJlMzAwMTRmNGFmN2I4OWQ0MmU0MWFl
|
10
|
+
Y2YwOWMxMTk1NGUzOWQ3NjJhODgwOTA5ZjY2Y2E5YjRlODJmMjY2ODQ4MDI5
|
11
|
+
YWYzYjM0MzUwZTkwY2U2NTVjZDNmYjdlNjI1NGY2YTEyZGMxMDQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmMyYTBjMDM0MmNmY2ZjMzVlMzQwY2JmMWY4NDlmMzRjMjlhMzllMzI4N2Uy
|
14
|
+
MWRjNGEyOGM3ZjM4NjZkOGE0NGRkOTFlODkxZWIwMGExYzcyZTU0NTZhMjU4
|
15
|
+
MTRmNWE0NjBlMmZkNDQ1ZWIyMzM2NTlkZmIxMzYxNzIxMmY3M2Q=
|
data/lib/cfoundry/client.rb
CHANGED
@@ -5,7 +5,7 @@ require "cfoundry/auth_token"
|
|
5
5
|
require "cfoundry/v2/app"
|
6
6
|
require "cfoundry/v2/service"
|
7
7
|
require "cfoundry/v2/service_binding"
|
8
|
-
require "cfoundry/v2/
|
8
|
+
require "cfoundry/v2/managed_service_instance"
|
9
9
|
require "cfoundry/v2/user_provided_service_instance"
|
10
10
|
require "cfoundry/v2/service_plan"
|
11
11
|
require "cfoundry/v2/service_auth_token"
|
data/lib/cfoundry/v2/client.rb
CHANGED
@@ -92,5 +92,13 @@ module CFoundry::V2
|
|
92
92
|
opts[:user_provided] = true
|
93
93
|
super(path, opts, *args)
|
94
94
|
end
|
95
|
+
|
96
|
+
def make_service_instance(json)
|
97
|
+
klass = "CFoundry::V2::#{json[:entity][:type].camelize}".constantize
|
98
|
+
klass.new(
|
99
|
+
json[:metadata][:guid],
|
100
|
+
self,
|
101
|
+
json)
|
102
|
+
end
|
95
103
|
end
|
96
104
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "cfoundry/v2/service_instance"
|
2
|
+
|
3
|
+
module CFoundry::V2
|
4
|
+
class ManagedServiceInstance < ServiceInstance
|
5
|
+
attribute :dashboard_url, :string
|
6
|
+
attribute :credentials, :hash
|
7
|
+
to_one :service_plan
|
8
|
+
|
9
|
+
def self.object_name
|
10
|
+
'service_instance'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -3,10 +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
|
7
|
-
attribute :credentials, :hash
|
8
6
|
to_one :space
|
9
|
-
to_one :service_plan
|
10
7
|
to_many :service_bindings
|
11
8
|
|
12
9
|
scoped_to_space
|
@@ -1,11 +1,7 @@
|
|
1
|
-
require "cfoundry/v2/
|
1
|
+
require "cfoundry/v2/service_instance"
|
2
2
|
|
3
3
|
module CFoundry::V2
|
4
|
-
class UserProvidedServiceInstance <
|
5
|
-
attribute :name, :string
|
4
|
+
class UserProvidedServiceInstance < ServiceInstance
|
6
5
|
attribute :credentials, :hash
|
7
|
-
to_one :space
|
8
|
-
|
9
|
-
scoped_to_space
|
10
6
|
end
|
11
7
|
end
|
data/lib/cfoundry/version.rb
CHANGED
@@ -10,13 +10,4 @@ describe CFoundry::Client do
|
|
10
10
|
it "returns a v2 client" do
|
11
11
|
subject.should be_a(CFoundry::V2::Client)
|
12
12
|
end
|
13
|
-
|
14
|
-
describe "#service_instances" do
|
15
|
-
let(:client) { build(:client) }
|
16
|
-
|
17
|
-
it "includes user-provided instances" do
|
18
|
-
client.base.should_receive(:service_instances).with(hash_including(user_provided: true)).and_return([])
|
19
|
-
client.service_instances
|
20
|
-
end
|
21
|
-
end
|
22
13
|
end
|
@@ -84,6 +84,27 @@ module CFoundry
|
|
84
84
|
expect{client.target = new_target}.to change{client.base.target}.from("http://api.example.com").to(new_target)
|
85
85
|
end
|
86
86
|
end
|
87
|
+
|
88
|
+
describe "#service_instances" do
|
89
|
+
let(:client) { build(:client) }
|
90
|
+
|
91
|
+
it "includes user-provided instances" do
|
92
|
+
expect(client.base).to receive(:service_instances).with(hash_including(user_provided: true)).and_return([])
|
93
|
+
client.service_instances
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "#make_service_instance" do
|
98
|
+
it "returns a UserProvidedServiceInstance when json[:type] is user_provided_service_instance" do
|
99
|
+
json = MultiJson.load(CcApiStub::Helper.load_fixtures(:fake_cc_user_provided_service_instance).to_json, :symbolize_keys => true)
|
100
|
+
instance = client.make_service_instance(json)
|
101
|
+
expect(instance).to be_a(CFoundry::V2::UserProvidedServiceInstance)
|
102
|
+
|
103
|
+
json = MultiJson.load(CcApiStub::Helper.load_fixtures(:fake_cc_managed_service_instance).to_json, :symbolize_keys => true)
|
104
|
+
instance = client.make_service_instance(json)
|
105
|
+
expect(instance).to be_a(CFoundry::V2::ManagedServiceInstance)
|
106
|
+
end
|
107
|
+
end
|
87
108
|
end
|
88
109
|
end
|
89
110
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module CFoundry
|
4
4
|
module V2
|
5
|
-
describe
|
5
|
+
describe ManagedServiceInstance do
|
6
6
|
let(:client) { build(:client) }
|
7
7
|
subject { build(:service_instance, :client => client) }
|
8
8
|
|
@@ -56,6 +56,7 @@ module CFoundry
|
|
56
56
|
"updated_at": null
|
57
57
|
},
|
58
58
|
"entity": {
|
59
|
+
"type": "user_provided_service_instance",
|
59
60
|
"name": "user-provided-6a19d",
|
60
61
|
"credentials": {
|
61
62
|
"thing": "a"
|
@@ -73,6 +74,7 @@ module CFoundry
|
|
73
74
|
"updated_at": null
|
74
75
|
},
|
75
76
|
"entity": {
|
77
|
+
"type": "managed_service_instance",
|
76
78
|
"name": "rds-mysql-3991f",
|
77
79
|
"credentials": {
|
78
80
|
"name": "da2f110d519d848a1a677f8df77890cc3",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
FactoryGirl.define do
|
2
|
-
factory :service_instance, :class => CFoundry::V2::
|
2
|
+
factory :service_instance, :class => CFoundry::V2::ManagedServiceInstance do
|
3
3
|
sequence(:guid) { |n| "service-instance-guid-#{n}" }
|
4
4
|
ignore do
|
5
5
|
client { FactoryGirl.build(:client) }
|
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"metadata": {
|
3
|
+
"guid": "managed-service-instance-id-1",
|
4
|
+
"url": "/v2/service_instances/managed-service-instance-id-1",
|
5
|
+
"created_at": "2012-10-23 00:00:00 +0000",
|
6
|
+
"updated_at": null
|
7
|
+
},
|
8
|
+
"entity": {
|
9
|
+
"type": "managed_service_instance",
|
10
|
+
"name": "service-instance-name-1",
|
11
|
+
"service_plan_guid": "service-plan-id-1",
|
12
|
+
"space_guid": "space-id-1",
|
13
|
+
"gateway_data": {
|
14
|
+
"plan": "100",
|
15
|
+
"version": "9.0"
|
16
|
+
},
|
17
|
+
"dashboard_url": "https://dev3cloudfoundry.appdirect.com/api/custom/cloudfoundry/v1/services/managed-service-instance-id-1/sso",
|
18
|
+
"service_bindings_url": "/v2/service_instances/managed-service-instance-id-1/service_bindings",
|
19
|
+
"service_bindings": [
|
20
|
+
{
|
21
|
+
"metadata": {
|
22
|
+
"guid": "service-binding-id-1",
|
23
|
+
"url": "/v2/service_bindings/service-binding-id-1",
|
24
|
+
"created_at": "2012-10-23 00:34:18 +0000",
|
25
|
+
"updated_at": null
|
26
|
+
},
|
27
|
+
"entity": {
|
28
|
+
"app_guid": "application-id-1",
|
29
|
+
"service_instance_guid": "managed-service-instance-id-1",
|
30
|
+
"binding_options": null,
|
31
|
+
"gateway_data": {
|
32
|
+
"plan": "100",
|
33
|
+
"version": "9.0",
|
34
|
+
"data": {
|
35
|
+
"binding_options": {}
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"app_url": "/v2/apps/application-id-1",
|
39
|
+
"service_instance_url": "/v2/service_instances/managed-service-instance-id-1"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
],
|
43
|
+
"space_url": "/v2/spaces/space-id-1",
|
44
|
+
"space": {
|
45
|
+
"metadata": {
|
46
|
+
"guid": "space-id-1",
|
47
|
+
"url": "/v2/spaces/space-id-1",
|
48
|
+
"created_at": "2012-09-26 00:00:00 +0000",
|
49
|
+
"updated_at": null
|
50
|
+
},
|
51
|
+
"entity": {
|
52
|
+
"name": "organization-name-1",
|
53
|
+
"organization_guid": "organization-id-1",
|
54
|
+
"developers_url": "/v2/spaces/space-id-1/developers",
|
55
|
+
"managers_url": "/v2/spaces/space-id-1/managers",
|
56
|
+
"auditors_url": "/v2/spaces/space-id-1/auditors",
|
57
|
+
"apps_url": "/v2/spaces/space-id-1/apps",
|
58
|
+
"domains_url": "/v2/spaces/space-id-1/domains",
|
59
|
+
"service_instances_url": "/v2/spaces/space-id-1/service_instances",
|
60
|
+
"organization_url": "/v2/organizations/organization-id-1"
|
61
|
+
}
|
62
|
+
},
|
63
|
+
"service_plan_url": "/v2/service_plans/service-plan-id-1",
|
64
|
+
"service_plan": {
|
65
|
+
"metadata": {
|
66
|
+
"guid": "service-plan-id-1",
|
67
|
+
"url": "/v2/service_plans/service-plan-id-1",
|
68
|
+
"created_at": "2012-09-19 21:00:00 +0000",
|
69
|
+
"updated_at": "2012-10-23 00:00:00 +0000"
|
70
|
+
},
|
71
|
+
"entity": {
|
72
|
+
"name": "100",
|
73
|
+
"description": "dummy description",
|
74
|
+
"service_guid": "service-id-1",
|
75
|
+
"service_instance_guids": [
|
76
|
+
"managed-service-instance-id-1"
|
77
|
+
],
|
78
|
+
"service_instances_url": "/v2/service_plans/service-plan-id-1/service_instances",
|
79
|
+
"service_url": "/v2/services/service-id-1"
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
{
|
2
|
+
"metadata": {
|
3
|
+
"guid": "user-provided-service-instance-id-1",
|
4
|
+
"url": "/v2/service_instances/user-provided-service-instance-id-1",
|
5
|
+
"created_at": "2012-10-23 00:00:00 +0000",
|
6
|
+
"updated_at": null
|
7
|
+
},
|
8
|
+
"entity": {
|
9
|
+
"type": "user_provided_service_instance",
|
10
|
+
"name": "service-instance-name-1",
|
11
|
+
"space_guid": "space-id-1",
|
12
|
+
"service_bindings_url": "/v2/service_instances/user-provided-service-instance-id-1/service_bindings",
|
13
|
+
"service_bindings": [
|
14
|
+
{
|
15
|
+
"metadata": {
|
16
|
+
"guid": "service-binding-id-1",
|
17
|
+
"url": "/v2/service_bindings/service-binding-id-1",
|
18
|
+
"created_at": "2012-10-23 00:34:18 +0000",
|
19
|
+
"updated_at": null
|
20
|
+
},
|
21
|
+
"entity": {
|
22
|
+
"app_guid": "application-id-1",
|
23
|
+
"service_instance_guid": "user-provided-service-instance-id-1",
|
24
|
+
"binding_options": null,
|
25
|
+
"app_url": "/v2/apps/application-id-1",
|
26
|
+
"service_instance_url": "/v2/service_instances/user-provided-service-instance-id-1"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
],
|
30
|
+
"space_url": "/v2/spaces/space-id-1",
|
31
|
+
"space": {
|
32
|
+
"metadata": {
|
33
|
+
"guid": "space-id-1",
|
34
|
+
"url": "/v2/spaces/space-id-1",
|
35
|
+
"created_at": "2012-09-26 00:00:00 +0000",
|
36
|
+
"updated_at": null
|
37
|
+
},
|
38
|
+
"entity": {
|
39
|
+
"name": "organization-name-1",
|
40
|
+
"organization_guid": "organization-id-1",
|
41
|
+
"developers_url": "/v2/spaces/space-id-1/developers",
|
42
|
+
"managers_url": "/v2/spaces/space-id-1/managers",
|
43
|
+
"auditors_url": "/v2/spaces/space-id-1/auditors",
|
44
|
+
"apps_url": "/v2/spaces/space-id-1/apps",
|
45
|
+
"domains_url": "/v2/spaces/space-id-1/domains",
|
46
|
+
"service_instances_url": "/v2/spaces/space-id-1/service_instances",
|
47
|
+
"organization_url": "/v2/organizations/organization-id-1"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
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: 4.0.4.
|
4
|
+
version: 4.0.4.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloud Foundry Team
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -247,6 +247,7 @@ files:
|
|
247
247
|
- lib/cfoundry/v2/base.rb
|
248
248
|
- lib/cfoundry/v2/client.rb
|
249
249
|
- lib/cfoundry/v2/domain.rb
|
250
|
+
- lib/cfoundry/v2/managed_service_instance.rb
|
250
251
|
- lib/cfoundry/v2/model.rb
|
251
252
|
- lib/cfoundry/v2/model_magic/attribute.rb
|
252
253
|
- lib/cfoundry/v2/model_magic/client_extensions.rb
|
@@ -301,6 +302,7 @@ files:
|
|
301
302
|
- spec/cfoundry/v2/base_spec.rb
|
302
303
|
- spec/cfoundry/v2/client_spec.rb
|
303
304
|
- spec/cfoundry/v2/domain_spec.rb
|
305
|
+
- spec/cfoundry/v2/managed_service_instance_spec.rb
|
304
306
|
- spec/cfoundry/v2/model_magic/model_magic/attribute_spec.rb
|
305
307
|
- spec/cfoundry/v2/model_magic/model_magic/has_summary_spec.rb
|
306
308
|
- spec/cfoundry/v2/model_magic/model_magic/to_many_spec.rb
|
@@ -310,7 +312,6 @@ files:
|
|
310
312
|
- spec/cfoundry/v2/organization_spec.rb
|
311
313
|
- spec/cfoundry/v2/quota_definition_spec.rb
|
312
314
|
- spec/cfoundry/v2/route_spec.rb
|
313
|
-
- spec/cfoundry/v2/service_instance_spec.rb
|
314
315
|
- spec/cfoundry/v2/space_spec.rb
|
315
316
|
- spec/cfoundry/v2/user_spec.rb
|
316
317
|
- spec/cfoundry/validator_spec.rb
|
@@ -353,6 +354,7 @@ files:
|
|
353
354
|
- spec/fixtures/fake_cc_domain_spaces.json
|
354
355
|
- spec/fixtures/fake_cc_empty_search.json
|
355
356
|
- spec/fixtures/fake_cc_frameworks.json
|
357
|
+
- spec/fixtures/fake_cc_managed_service_instance.json
|
356
358
|
- spec/fixtures/fake_cc_organization.json
|
357
359
|
- spec/fixtures/fake_cc_organization_domains.json
|
358
360
|
- spec/fixtures/fake_cc_organization_search.json
|
@@ -371,6 +373,7 @@ files:
|
|
371
373
|
- spec/fixtures/fake_cc_stats.json
|
372
374
|
- spec/fixtures/fake_cc_user.json
|
373
375
|
- spec/fixtures/fake_cc_user_organizations.json
|
376
|
+
- spec/fixtures/fake_cc_user_provided_service_instance.json
|
374
377
|
- spec/fixtures/fake_cc_user_with_managers.json
|
375
378
|
- spec/integration/client_spec.rb
|
376
379
|
- spec/spec_helper.rb
|
@@ -429,6 +432,7 @@ test_files:
|
|
429
432
|
- spec/cfoundry/v2/base_spec.rb
|
430
433
|
- spec/cfoundry/v2/client_spec.rb
|
431
434
|
- spec/cfoundry/v2/domain_spec.rb
|
435
|
+
- spec/cfoundry/v2/managed_service_instance_spec.rb
|
432
436
|
- spec/cfoundry/v2/model_magic/model_magic/attribute_spec.rb
|
433
437
|
- spec/cfoundry/v2/model_magic/model_magic/has_summary_spec.rb
|
434
438
|
- spec/cfoundry/v2/model_magic/model_magic/to_many_spec.rb
|
@@ -438,7 +442,6 @@ test_files:
|
|
438
442
|
- spec/cfoundry/v2/organization_spec.rb
|
439
443
|
- spec/cfoundry/v2/quota_definition_spec.rb
|
440
444
|
- spec/cfoundry/v2/route_spec.rb
|
441
|
-
- spec/cfoundry/v2/service_instance_spec.rb
|
442
445
|
- spec/cfoundry/v2/space_spec.rb
|
443
446
|
- spec/cfoundry/v2/user_spec.rb
|
444
447
|
- spec/cfoundry/validator_spec.rb
|
@@ -481,6 +484,7 @@ test_files:
|
|
481
484
|
- spec/fixtures/fake_cc_domain_spaces.json
|
482
485
|
- spec/fixtures/fake_cc_empty_search.json
|
483
486
|
- spec/fixtures/fake_cc_frameworks.json
|
487
|
+
- spec/fixtures/fake_cc_managed_service_instance.json
|
484
488
|
- spec/fixtures/fake_cc_organization.json
|
485
489
|
- spec/fixtures/fake_cc_organization_domains.json
|
486
490
|
- spec/fixtures/fake_cc_organization_search.json
|
@@ -499,6 +503,7 @@ test_files:
|
|
499
503
|
- spec/fixtures/fake_cc_stats.json
|
500
504
|
- spec/fixtures/fake_cc_user.json
|
501
505
|
- spec/fixtures/fake_cc_user_organizations.json
|
506
|
+
- spec/fixtures/fake_cc_user_provided_service_instance.json
|
502
507
|
- spec/fixtures/fake_cc_user_with_managers.json
|
503
508
|
- spec/integration/client_spec.rb
|
504
509
|
- spec/spec_helper.rb
|