cfoundry 0.5.1.rc2 → 0.5.1.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/lib/cc_api_stub.rb +17 -0
  2. data/lib/cc_api_stub/applications.rb +53 -0
  3. data/lib/cc_api_stub/domains.rb +16 -0
  4. data/lib/cc_api_stub/frameworks.rb +22 -0
  5. data/lib/cc_api_stub/helper.rb +131 -0
  6. data/lib/cc_api_stub/login.rb +21 -0
  7. data/lib/cc_api_stub/organization_users.rb +21 -0
  8. data/lib/cc_api_stub/organizations.rb +70 -0
  9. data/lib/cc_api_stub/routes.rb +26 -0
  10. data/lib/cc_api_stub/runtimes.rb +22 -0
  11. data/lib/cc_api_stub/service_bindings.rb +22 -0
  12. data/lib/cc_api_stub/service_instances.rb +22 -0
  13. data/lib/cc_api_stub/services.rb +25 -0
  14. data/lib/cc_api_stub/spaces.rb +49 -0
  15. data/lib/cc_api_stub/users.rb +84 -0
  16. data/lib/cfoundry/baseclient.rb +24 -0
  17. data/lib/cfoundry/errors.rb +16 -133
  18. data/lib/cfoundry/v1/app.rb +6 -2
  19. data/lib/cfoundry/v2/app.rb +16 -4
  20. data/lib/cfoundry/v2/base.rb +10 -11
  21. data/lib/cfoundry/v2/client.rb +4 -0
  22. data/lib/cfoundry/version.rb +1 -1
  23. data/spec/cc_api_stub/applications_spec.rb +69 -0
  24. data/spec/cc_api_stub/domains_spec.rb +19 -0
  25. data/spec/cc_api_stub/frameworks_spec.rb +19 -0
  26. data/spec/cc_api_stub/login_spec.rb +20 -0
  27. data/spec/cc_api_stub/organization_users_spec.rb +19 -0
  28. data/spec/cc_api_stub/organizations_spec.rb +103 -0
  29. data/spec/cc_api_stub/routes_spec.rb +19 -0
  30. data/spec/cc_api_stub/runtimes_spec.rb +19 -0
  31. data/spec/cc_api_stub/service_bindings_spec.rb +13 -0
  32. data/spec/cc_api_stub/service_instances_spec.rb +19 -0
  33. data/spec/cc_api_stub/services_spec.rb +12 -0
  34. data/spec/cc_api_stub/spaces_spec.rb +38 -0
  35. data/spec/cc_api_stub/users_spec.rb +107 -0
  36. data/spec/cfoundry/baseclient_spec.rb +42 -2
  37. data/spec/cfoundry/v2/app_spec.rb +95 -0
  38. data/spec/fixtures/fake_cc_application.json +24 -0
  39. data/spec/fixtures/fake_cc_application_summary.json +57 -0
  40. data/spec/fixtures/fake_cc_created_application.json +11 -0
  41. data/spec/fixtures/fake_cc_created_domain.json +10 -0
  42. data/spec/fixtures/fake_cc_created_organization.json +11 -0
  43. data/spec/fixtures/fake_cc_created_route.json +13 -0
  44. data/spec/fixtures/fake_cc_created_service_instance.json +11 -0
  45. data/spec/fixtures/fake_cc_created_space.json +11 -0
  46. data/spec/fixtures/fake_cc_created_user.json +11 -0
  47. data/spec/fixtures/fake_cc_empty_search.json +7 -0
  48. data/spec/fixtures/fake_cc_frameworks.json +20 -0
  49. data/spec/fixtures/fake_cc_organization.json +144 -0
  50. data/spec/fixtures/fake_cc_organization_domains.json +34 -0
  51. data/spec/fixtures/fake_cc_organization_search.json +37 -0
  52. data/spec/fixtures/fake_cc_organization_summary.json +19 -0
  53. data/spec/fixtures/fake_cc_organization_users.json +81 -0
  54. data/spec/fixtures/fake_cc_runtimes.json +20 -0
  55. data/spec/fixtures/fake_cc_service_binding.json +22 -0
  56. data/spec/fixtures/fake_cc_service_bindings.json +24 -0
  57. data/spec/fixtures/fake_cc_service_instance.json +81 -0
  58. data/spec/fixtures/fake_cc_service_instances.json +0 -0
  59. data/spec/fixtures/fake_cc_service_types.json +124 -0
  60. data/spec/fixtures/fake_cc_space.json +45 -0
  61. data/spec/fixtures/fake_cc_space_summary.json +86 -0
  62. data/spec/fixtures/fake_cc_stats.json +29 -0
  63. data/spec/fixtures/fake_cc_user.json +112 -0
  64. data/spec/fixtures/fake_cc_user_organizations.json +92 -0
  65. data/spec/fixtures/fake_cc_user_with_managers.json +85 -0
  66. data/spec/spec_helper.rb +3 -0
  67. data/spec/support/fake_helper.rb +0 -36
  68. data/spec/support/shared_examples/cc_api_stub_request_examples.rb +79 -0
  69. metadata +254 -144
@@ -0,0 +1,34 @@
1
+ {
2
+ "total_results": 1,
3
+ "total_pages": 1,
4
+ "prev_url": null,
5
+ "next_url": null,
6
+ "resources": [
7
+ {
8
+ "metadata": {
9
+ "guid": "domain-id-1",
10
+ "url": "/v2/domains/domain-id-1",
11
+ "created_at": "2012-09-19 21:03:47 +0000",
12
+ "updated_at": null
13
+ },
14
+ "entity": {
15
+ "name": "domain.com",
16
+ "owning_organization_guid": null,
17
+ "wildcard": true
18
+ }
19
+ },
20
+ {
21
+ "metadata": {
22
+ "guid": "domain-id-2",
23
+ "url": "/v2/domains/domain-id-2",
24
+ "created_at": "2012-09-19 21:03:47 +0000",
25
+ "updated_at": null
26
+ },
27
+ "entity": {
28
+ "name": "domain2.com",
29
+ "owning_organization_guid": "organization-id-1",
30
+ "wildcard": true
31
+ }
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "total_results": 3,
3
+ "total_pages": 1,
4
+ "prev_url": null,
5
+ "next_url": null,
6
+ "resources": [
7
+ {
8
+ "metadata": {
9
+ "guid": "organization-id-1",
10
+ "url": "/v2/organizations/organization-id-1"
11
+ },
12
+ "entity": {
13
+ "name": "organization-name-1",
14
+ "spaces": [{
15
+ "metadata": {
16
+ "guid": "space-id-1",
17
+ "url": "/v2/users/space-id-1"
18
+ },
19
+ "entity": {
20
+ "name": "space-name-1"
21
+ }
22
+ }],
23
+ "managers": [{
24
+ "metadata": {
25
+ "guid": "user-id-1",
26
+ "url": "/v2/users/user-id-1"
27
+ },
28
+ "entity": {
29
+ "admin": false,
30
+ "active": false,
31
+ "default_space_guid": "space-id-1"
32
+ }
33
+ }]
34
+ }
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "guid": "organization-id-1",
3
+ "name": "organization-name-1",
4
+ "spaces": [{
5
+ "guid": "space-id-1",
6
+ "name": "space-name-1",
7
+ "service_count": 1,
8
+ "app_count": 2,
9
+ "mem_dev_total": 64,
10
+ "mem_prod_total": 128
11
+ }, {
12
+ "guid": "space-id-2",
13
+ "name": "space-name-2",
14
+ "service_count": 2,
15
+ "app_count": 3,
16
+ "mem_dev_total": 2048,
17
+ "mem_prod_total": 4096
18
+ }]
19
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "total_results": 1,
3
+ "total_pages": 1,
4
+ "prev_url": null,
5
+ "next_url": null,
6
+ "resources": [
7
+ {
8
+ "metadata": {
9
+ "guid": "user-id-1",
10
+ "url": "/v2/users/user-id-1",
11
+ "created_at": "2012-08-13 12:48:41 -0700",
12
+ "updated_at": "2012-08-13 12:55:10 -0700"
13
+ },
14
+ "entity": {
15
+ "managed_organizations": [{
16
+ "metadata": {
17
+ "guid": "organization-id-1"
18
+ },
19
+ "entity": {}
20
+ }],
21
+ "billing_managed_organizations": [],
22
+ "audited_organizations": [],
23
+ "spaces": [{
24
+ "metadata": {
25
+ "guid": "space-id-1"
26
+ },
27
+ "entity": {}
28
+ }],
29
+ "managed_spaces": [],
30
+ "audited_spaces": []
31
+ }
32
+ },
33
+ {
34
+ "metadata": {
35
+ "guid": "user-id-2",
36
+ "url": "/v2/users/user-id-2",
37
+ "created_at": "2012-08-13 12:48:41 -0700",
38
+ "updated_at": "2012-08-13 12:55:10 -0700"
39
+ },
40
+ "entity": {
41
+ "managed_organizations": [{
42
+ "metadata": {
43
+ "guid": "organization-id-1"
44
+ },
45
+ "entity": {}
46
+ }],
47
+ "billing_managed_organizations": [],
48
+ "audited_organizations": [],
49
+ "spaces": [],
50
+ "managed_spaces": [{
51
+ "metadata": {
52
+ "guid": "space-id-1"
53
+ },
54
+ "entity": {}
55
+ }],
56
+ "audited_spaces": []
57
+ }
58
+ },
59
+ {
60
+ "metadata": {
61
+ "guid": "user-id-3",
62
+ "url": "/v2/users/user-id-3",
63
+ "created_at": "2012-08-13 12:48:41 -0700",
64
+ "updated_at": "2012-08-13 12:55:10 -0700"
65
+ },
66
+ "entity": {
67
+ "managed_organizations": [],
68
+ "billing_managed_organizations": [],
69
+ "audited_organizations": [],
70
+ "spaces": [],
71
+ "managed_spaces": [],
72
+ "audited_spaces": [{
73
+ "metadata": {
74
+ "guid": "space-id-2"
75
+ },
76
+ "entity": {}
77
+ }]
78
+ }
79
+ }
80
+ ]
81
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "total_results": 1,
3
+ "total_pages": 1,
4
+ "prev_url": null,
5
+ "next_url": null,
6
+ "resources": [{
7
+ "metadata": {
8
+ "guid": "ruby19-runtime-id-1",
9
+ "url": "/v2/runtimes/ruby19-runtime-id-1",
10
+ "created_at": "2012-11-21 14:24:19 -0800",
11
+ "updated_at": "2012-11-23 22:25:28 -0800"
12
+ },
13
+ "entity": {
14
+ "name": "ruby19",
15
+ "description": "Ruby 1.9",
16
+ "apps_url": "/v2/runtimes/ruby19-runtime-id-1/apps",
17
+ "apps": []
18
+ }
19
+ }]
20
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "metadata": {
3
+ "guid": "service-binding-id-1",
4
+ "url": "/v2/service_bindings/service-binding-id-1",
5
+ "created_at": "2012-10-23 00:00:00 +0000",
6
+ "updated_at": null
7
+ },
8
+ "entity": {
9
+ "app_guid": "application-id-1",
10
+ "service_instance_guid": "service-instance-id-1",
11
+ "binding_options": null,
12
+ "gateway_data": {
13
+ "plan": "100",
14
+ "version": "9.0",
15
+ "data": {
16
+ "binding_options": {}
17
+ }
18
+ },
19
+ "app_url": "/v2/apps/application-id-1",
20
+ "service_instance_url": "/v2/service_instances/service-instance-id-1"
21
+ }
22
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "resources": [{
3
+ "metadata": {
4
+ "guid": "service-binding-id-1",
5
+ "url": "/v2/service_bindings/service-binding-id-1",
6
+ "created_at": "2012-10-23 00:00:00 +0000",
7
+ "updated_at": null
8
+ },
9
+ "entity": {
10
+ "app_guid": "application-id-1",
11
+ "service_instance_guid": "service-instance-id-1",
12
+ "binding_options": null,
13
+ "gateway_data": {
14
+ "plan": "100",
15
+ "version": "9.0",
16
+ "data": {
17
+ "binding_options": {}
18
+ }
19
+ },
20
+ "app_url": "/v2/apps/application-id-1",
21
+ "service_instance_url": "/v2/service_instances/service-instance-id-1"
22
+ }
23
+ }]
24
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "metadata": {
3
+ "guid": "service-instance-id-1",
4
+ "url": "/v2/service_instances/service-instance-id-1",
5
+ "created_at": "2012-10-23 00:00:00 +0000",
6
+ "updated_at": null
7
+ },
8
+ "entity": {
9
+ "name": "wut",
10
+ "service_plan_guid": "service-plan-id-1",
11
+ "space_guid": "space-id-1",
12
+ "gateway_data": {
13
+ "plan": "100",
14
+ "version": "9.0"
15
+ },
16
+ "service_bindings_url": "/v2/service_instances/service-instance-id-1/service_bindings",
17
+ "service_bindings": [
18
+ {
19
+ "metadata": {
20
+ "guid": "service-binding-id-1",
21
+ "url": "/v2/service_bindings/service-binding-id-1",
22
+ "created_at": "2012-10-23 00:34:18 +0000",
23
+ "updated_at": null
24
+ },
25
+ "entity": {
26
+ "app_guid": "application-id-1",
27
+ "service_instance_guid": "service-instance-id-1",
28
+ "binding_options": null,
29
+ "gateway_data": {
30
+ "plan": "100",
31
+ "version": "9.0",
32
+ "data": {
33
+ "binding_options": {}
34
+ }
35
+ },
36
+ "app_url": "/v2/apps/application-id-1",
37
+ "service_instance_url": "/v2/service_instances/service-instance-id-1"
38
+ }
39
+ }
40
+ ],
41
+ "space_url": "/v2/spaces/space-id-1",
42
+ "space": {
43
+ "metadata": {
44
+ "guid": "space-id-1",
45
+ "url": "/v2/spaces/space-id-1",
46
+ "created_at": "2012-09-26 00:00:00 +0000",
47
+ "updated_at": null
48
+ },
49
+ "entity": {
50
+ "name": "organization-name-1",
51
+ "organization_guid": "organization-id-1",
52
+ "developers_url": "/v2/spaces/space-id-1/developers",
53
+ "managers_url": "/v2/spaces/space-id-1/managers",
54
+ "auditors_url": "/v2/spaces/space-id-1/auditors",
55
+ "apps_url": "/v2/spaces/space-id-1/apps",
56
+ "domains_url": "/v2/spaces/space-id-1/domains",
57
+ "service_instances_url": "/v2/spaces/space-id-1/service_instances",
58
+ "organization_url": "/v2/organizations/organization-id-1"
59
+ }
60
+ },
61
+ "service_plan_url": "/v2/service_plans/service-plan-id-1",
62
+ "service_plan": {
63
+ "metadata": {
64
+ "guid": "service-plan-id-1",
65
+ "url": "/v2/service_plans/service-plan-id-1",
66
+ "created_at": "2012-09-19 21:00:00 +0000",
67
+ "updated_at": "2012-10-23 00:00:00 +0000"
68
+ },
69
+ "entity": {
70
+ "name": "100",
71
+ "description": "dummy description",
72
+ "service_guid": "service-id-1",
73
+ "service_instance_guids": [
74
+ "service-instance-id-1"
75
+ ],
76
+ "service_instances_url": "/v2/service_plans/service-plan-id-1/service_instances",
77
+ "service_url": "/v2/services/service-id-1"
78
+ }
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,124 @@
1
+ {
2
+ "total_results": 1,
3
+ "total_pages": 1,
4
+ "prev_url": null,
5
+ "next_url": null,
6
+ "resources": [
7
+ {
8
+ "metadata": {
9
+ "guid": "service-id-1",
10
+ "url": "/v2/services/service-id-1"
11
+ },
12
+ "entity": {
13
+ "label": "postgresql",
14
+ "provider": "core",
15
+ "version": "9.1",
16
+ "url": "service-url",
17
+ "info_url": "service-info-url",
18
+ "description": "service1-description",
19
+ "service_plans_url": "/v2/services/service-id-1/service_plans",
20
+ "service_plans": [
21
+ {
22
+ "metadata": {
23
+ "guid": "paid-postgresql-id-1",
24
+ "url": "/v2/service_plans/paid-postgresql-id-1"
25
+ },
26
+ "entity": {
27
+ "name": "300",
28
+ "description": "2TB, 1.7GB Memory, 100 Connections, CPU? (Dedicated)",
29
+ "service_guid": "service-id-1",
30
+ "service_url": "/v2/services/service-id-1",
31
+ "service_instances_url": "/v2/service_plans/paid-postgresql-id-1/service_instances"
32
+ }
33
+ },
34
+ {
35
+ "metadata": {
36
+ "guid": "development-postgresql-id-1",
37
+ "url": "/v2/service_plans/development-postgresql-id-1"
38
+ },
39
+ "entity": {
40
+ "name": "100",
41
+ "description": "Free Postgres...",
42
+ "service_guid": "service-id-1",
43
+ "service_url": "/v2/services/service-id-1",
44
+ "service_instances_url": "/v2/service_plans/development-postgresql-id-1/service_instances"
45
+ }
46
+ }
47
+ ]
48
+ }
49
+ },
50
+ {
51
+ "metadata": {
52
+ "guid": "service-id-2",
53
+ "url": "/v2/services/service-id-2"
54
+ },
55
+ "entity": {
56
+ "label": "mongodb",
57
+ "provider": "core",
58
+ "version": "1.8",
59
+ "url": "service2-url",
60
+ "info_url": "service2-info-url",
61
+ "description": "service2-description",
62
+ "service_plans_url": "/v2/services/service-id-2/service_plans",
63
+ "service_plans": [
64
+ {
65
+ "metadata": {
66
+ "guid": "development-mongodb-id-1",
67
+ "url": "/v2/service_plans/development-mongodb-id-1"
68
+ },
69
+ "entity": {
70
+ "name": "100",
71
+ "description": "service-plan-description",
72
+ "service_guid": "service-id-1",
73
+ "service_url": "/v2/services/service-id-1",
74
+ "service_instances_url": "/v2/service_plans/development-mongodb-id-1/service_instances"
75
+ }
76
+ },
77
+ {
78
+ "metadata": {
79
+ "guid": "paid-mongodb-id-1",
80
+ "url": "/v2/service_plans/paid-mongodb-id-1"
81
+ },
82
+ "entity": {
83
+ "name": "200",
84
+ "description": "20GB, 1GB Memory, 10 Connections, CPU? (Shared)",
85
+ "service_guid": "service-id-2",
86
+ "service_url": "/v2/services/service-id-2",
87
+ "service_instances_url": "/v2/service_plans/paid-mongodb-id-1/service_instances"
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ },
93
+ {
94
+ "metadata": {
95
+ "guid": "service-id-3",
96
+ "url": "/v2/services/service-id-3"
97
+ },
98
+ "entity": {
99
+ "label": "mongolab-mongodb",
100
+ "provider": "mongolab",
101
+ "version": "1.0",
102
+ "url": "service3-url",
103
+ "info_url": "service3-info-url",
104
+ "description": "service3-description",
105
+ "service_plans_url": "/v2/services/service-id-3/service_plans",
106
+ "service_plans": [
107
+ {
108
+ "metadata": {
109
+ "guid": "paid-mongolab-mongodb-id-1",
110
+ "url": "/v2/service_plans/paid-mongolab-mongodb-id-1"
111
+ },
112
+ "entity": {
113
+ "name": "200",
114
+ "description": "20GB, 1GB Memory, 10 Connections, CPU? (Shared)",
115
+ "service_guid": "service-id-3",
116
+ "service_url": "/v2/services/service-id-3",
117
+ "service_instances_url": "/v2/service_plans/paid-mongolab-mongodb-id-1/service_instances"
118
+ }
119
+ }
120
+ ]
121
+ }
122
+ }
123
+ ]
124
+ }