code42 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/code42.gemspec +1 -1
- data/lib/code42/attribute_serializer.rb +4 -2
- data/lib/code42/version.rb +1 -1
- data/spec/cassettes/Code42_Client/_create_org/returns_created_org.yml +43 -16
- data/spec/cassettes/Code42_Client/_create_user/returns_created_user.yml +34 -13
- data/spec/cassettes/Code42_Client/_create_user/when_sending_an_invalid_email/raises_an_exception.yml +8 -6
- data/spec/cassettes/Code42_Client/_find_org_by_name/returns_the_org_with_the_specified_name.yml +54 -34
- data/spec/cassettes/Code42_Client/_get_token/returns_valid_tokens.yml +17 -7
- data/spec/cassettes/Code42_Client/_get_token/when_providing_invalid_credentials/should_raise_an_exception.yml +8 -6
- data/spec/cassettes/Code42_Client/_org/when_ID_is_not_passed/returns_my_org.yml +51 -33
- data/spec/cassettes/Code42_Client/_org/when_ID_is_passed_in/returns_a_specific_org.yml +51 -33
- data/spec/cassettes/Code42_Client/_ping/returns_a_ping.yml +22 -27
- data/spec/cassettes/Code42_Client/_user/when_ID_is_not_passed/returns_my_user.yml +42 -32
- data/spec/cassettes/Code42_Client/_user/when_ID_is_passed_in/returns_a_specific_user.yml +42 -32
- data/spec/cassettes/Code42_Client/_user/when_blocked/returns_the_blocked_status.yml +53 -39
- data/spec/cassettes/Code42_Client/_user/when_unblocked/returns_the_blocked_status.yml +55 -41
- data/spec/cassettes/Code42_Client/_user_roles/returns_an_enumerable.yml +29 -29
- data/spec/cassettes/Code42_Client/_validate_token/returns_a_valid_response.yml +43 -35
- metadata +4 -5
data/README.md
CHANGED
@@ -173,7 +173,7 @@ https://github.com/code42/code42_api_ruby/wiki
|
|
173
173
|
|
174
174
|
The Code 42 open source project is a set of frameworks and examples for developing solutions based on the Code 42 CrashPlan REST API.
|
175
175
|
|
176
|
-
* [CrashPlan product website](http://www.
|
176
|
+
* [CrashPlan product website](http://www.crashplan.com/enterprise)
|
177
177
|
* [CrashPlan online API documentation](http://www.crashplan.com/apidocviewer)
|
178
178
|
* [Code 42 Open Source on Github](https://github.com/code42)
|
179
179
|
|
data/code42.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
|
15
15
|
gem.add_development_dependency 'rspec', '~> 2.11.0'
|
16
16
|
gem.add_development_dependency 'webmock', '~> 1.11.0'
|
17
|
-
gem.add_development_dependency 'vcr', '~> 2.
|
17
|
+
gem.add_development_dependency 'vcr', '~> 2.5.0'
|
18
18
|
gem.add_dependency 'faraday', '~> 0.8.7'
|
19
19
|
gem.add_dependency 'activesupport', '~> 3.2.0'
|
20
20
|
gem.add_dependency 'faraday_middleware', '~> 0.9.0'
|
@@ -64,9 +64,11 @@ module Code42
|
|
64
64
|
end
|
65
65
|
else
|
66
66
|
if value.is_a?(Hash)
|
67
|
-
value.inject({}) do |h,
|
68
|
-
h.merge! deserialize(
|
67
|
+
value.inject({}) do |h,(key, value)|
|
68
|
+
h.merge! deserialize(key, value)
|
69
69
|
end
|
70
|
+
elsif value.is_a?(Array)
|
71
|
+
value.map { |item| deserialize_value(nil, item) }
|
70
72
|
else
|
71
73
|
value
|
72
74
|
end
|
data/lib/code42/version.rb
CHANGED
@@ -5,14 +5,16 @@ http_interactions:
|
|
5
5
|
uri: http://admin:admin@localhost:7280/api/org
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
8
|
+
string: '{"orgName":"IBM"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.8.7
|
12
12
|
Content-Type:
|
13
13
|
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
16
|
Accept:
|
15
|
-
-
|
17
|
+
- '*/*'
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -29,19 +31,44 @@ http_interactions:
|
|
29
31
|
Server:
|
30
32
|
- Jetty(7.6.3.v20120416)
|
31
33
|
body:
|
32
|
-
encoding:
|
33
|
-
string:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
34
|
+
encoding: UTF-8
|
35
|
+
string: |-
|
36
|
+
{
|
37
|
+
"metadata": {
|
38
|
+
"timestamp": "2013-06-13T15:16:29.975-05:00",
|
39
|
+
"params": {}
|
40
|
+
},
|
41
|
+
"data": {
|
42
|
+
"orgId": 87,
|
43
|
+
"orgUid": "587885375444888214",
|
44
|
+
"orgName": "IBM",
|
45
|
+
"status": "Active",
|
46
|
+
"active": true,
|
47
|
+
"blocked": false,
|
48
|
+
"parentOrgId": null,
|
49
|
+
"type": "ENTERPRISE",
|
50
|
+
"externalId": "587885375444888214",
|
51
|
+
"hierarchyCounts": {},
|
52
|
+
"configInheritanceCounts": {},
|
53
|
+
"creationDate": "2013-06-13T15:16:29.859-05:00",
|
54
|
+
"modificationDate": "2013-06-13T15:16:29.957-05:00",
|
55
|
+
"registrationKey": "SCTR-799T-224R-JWTW",
|
56
|
+
"reporting": {},
|
57
|
+
"customConfig": false,
|
58
|
+
"settings": {
|
59
|
+
"maxSeats": null,
|
60
|
+
"maxBytes": null
|
61
|
+
},
|
62
|
+
"settingsInherited": {
|
63
|
+
"maxSeats": "",
|
64
|
+
"maxBytes": ""
|
65
|
+
},
|
66
|
+
"settingsSummary": {
|
67
|
+
"maxSeats": "",
|
68
|
+
"maxBytes": ""
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
45
72
|
http_version:
|
46
|
-
recorded_at:
|
73
|
+
recorded_at: Thu, 13 Jun 2013 20:16:29 GMT
|
47
74
|
recorded_with: VCR 2.5.0
|
@@ -5,14 +5,16 @@ http_interactions:
|
|
5
5
|
uri: http://admin:admin@localhost:7280/api/user
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
8
|
+
string: '{"orgId":2,"username":"testuser"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.8.7
|
12
12
|
Content-Type:
|
13
13
|
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
16
|
Accept:
|
15
|
-
-
|
17
|
+
- '*/*'
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -29,16 +31,35 @@ http_interactions:
|
|
29
31
|
Server:
|
30
32
|
- Jetty(7.6.3.v20120416)
|
31
33
|
body:
|
32
|
-
encoding:
|
33
|
-
string:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
34
|
+
encoding: UTF-8
|
35
|
+
string: |-
|
36
|
+
{
|
37
|
+
"metadata": {
|
38
|
+
"timestamp": "2013-06-13T15:16:29.797-05:00",
|
39
|
+
"params": {}
|
40
|
+
},
|
41
|
+
"data": {
|
42
|
+
"userId": 3,
|
43
|
+
"userUid": "2062352522e63ee1",
|
44
|
+
"status": "Active",
|
45
|
+
"username": "testuser",
|
46
|
+
"email": null,
|
47
|
+
"firstName": null,
|
48
|
+
"lastName": null,
|
49
|
+
"quotaInBytes": -1,
|
50
|
+
"orgId": 2,
|
51
|
+
"orgUid": "proserverdemo",
|
52
|
+
"orgName": "PROServer Demo",
|
53
|
+
"active": true,
|
54
|
+
"blocked": false,
|
55
|
+
"emailPromo": true,
|
56
|
+
"invited": true,
|
57
|
+
"orgType": "ENTERPRISE",
|
58
|
+
"usernameIsAnEmail": null,
|
59
|
+
"creationDate": "2013-06-13T15:14:39.703-05:00",
|
60
|
+
"modificationDate": "2013-06-13T15:16:29.777-05:00"
|
61
|
+
}
|
62
|
+
}
|
42
63
|
http_version:
|
43
|
-
recorded_at:
|
64
|
+
recorded_at: Thu, 13 Jun 2013 20:16:29 GMT
|
44
65
|
recorded_with: VCR 2.5.0
|
data/spec/cassettes/Code42_Client/_create_user/when_sending_an_invalid_email/raises_an_exception.yml
CHANGED
@@ -5,18 +5,20 @@ http_interactions:
|
|
5
5
|
uri: http://admin:admin@localhost:7280/api/user
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
8
|
+
string: '{"orgId":2,"username":"testuser","email":"testuser"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.8.7
|
12
12
|
Content-Type:
|
13
13
|
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
16
|
Accept:
|
15
|
-
-
|
17
|
+
- '*/*'
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 500
|
19
|
-
message:
|
21
|
+
message: '[{ "name": "EMAIL_INVALID", "description": "Email is invalid", "objects":
|
20
22
|
[] }]'
|
21
23
|
headers:
|
22
24
|
Pragma:
|
@@ -30,8 +32,8 @@ http_interactions:
|
|
30
32
|
Server:
|
31
33
|
- Jetty(7.6.3.v20120416)
|
32
34
|
body:
|
33
|
-
encoding:
|
34
|
-
string:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '[{"name":"EMAIL_INVALID","description":"Email is invalid","objects":[]}]'
|
35
37
|
http_version:
|
36
|
-
recorded_at:
|
38
|
+
recorded_at: Thu, 13 Jun 2013 20:16:29 GMT
|
37
39
|
recorded_with: VCR 2.5.0
|
data/spec/cassettes/Code42_Client/_find_org_by_name/returns_the_org_with_the_specified_name.yml
CHANGED
@@ -12,44 +12,64 @@ http_interactions:
|
|
12
12
|
Accept-Encoding:
|
13
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
14
|
Accept:
|
15
|
-
-
|
15
|
+
- '*/*'
|
16
16
|
response:
|
17
17
|
status:
|
18
18
|
code: 200
|
19
|
-
message:
|
20
|
-
T0s=
|
19
|
+
message: OK
|
21
20
|
headers:
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
|
26
|
-
-
|
27
|
-
|
28
|
-
|
29
|
-
-
|
30
|
-
|
31
|
-
|
32
|
-
- !binary |-
|
33
|
-
Z3ppcA==
|
34
|
-
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
35
|
-
- !binary |-
|
36
|
-
Y2h1bmtlZA==
|
37
|
-
!binary "U2VydmVy":
|
38
|
-
- !binary |-
|
39
|
-
SmV0dHkoNy42LjMudjIwMTIwNDE2KQ==
|
21
|
+
Cache-Control:
|
22
|
+
- no-store
|
23
|
+
Pragma:
|
24
|
+
- no-cache
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Server:
|
30
|
+
- Jetty(7.6.3.v20120416)
|
40
31
|
body:
|
41
|
-
encoding:
|
42
|
-
string:
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
32
|
+
encoding: UTF-8
|
33
|
+
string: |-
|
34
|
+
{
|
35
|
+
"metadata": {
|
36
|
+
"timestamp": "2013-06-13T15:16:30.378-05:00",
|
37
|
+
"params": {"q": "PROServer Demo"}
|
38
|
+
},
|
39
|
+
"data": {
|
40
|
+
"totalCount": 1,
|
41
|
+
"orgs": [ {
|
42
|
+
"orgId": 2,
|
43
|
+
"orgUid": "proserverdemo",
|
44
|
+
"orgName": "PROServer Demo",
|
45
|
+
"status": "Active",
|
46
|
+
"active": true,
|
47
|
+
"blocked": false,
|
48
|
+
"parentOrgId": null,
|
49
|
+
"type": "ENTERPRISE",
|
50
|
+
"externalId": "proserverdemo",
|
51
|
+
"hierarchyCounts": {},
|
52
|
+
"configInheritanceCounts": {},
|
53
|
+
"creationDate": "2013-06-13T15:12:53.017-05:00",
|
54
|
+
"modificationDate": "2013-06-13T15:12:53.017-05:00",
|
55
|
+
"registrationKey": "2KKW-9TST-2HU2-UPT8",
|
56
|
+
"reporting": {},
|
57
|
+
"customConfig": false,
|
58
|
+
"settings": {
|
59
|
+
"maxSeats": null,
|
60
|
+
"maxBytes": null
|
61
|
+
},
|
62
|
+
"settingsInherited": {
|
63
|
+
"maxSeats": "",
|
64
|
+
"maxBytes": ""
|
65
|
+
},
|
66
|
+
"settingsSummary": {
|
67
|
+
"maxSeats": "",
|
68
|
+
"maxBytes": ""
|
69
|
+
}
|
70
|
+
}]
|
71
|
+
}
|
72
|
+
}
|
53
73
|
http_version:
|
54
|
-
recorded_at:
|
74
|
+
recorded_at: Thu, 13 Jun 2013 20:16:30 GMT
|
55
75
|
recorded_with: VCR 2.5.0
|
@@ -5,14 +5,16 @@ http_interactions:
|
|
5
5
|
uri: http://admin:admin@localhost:7280/api/authToken
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
8
|
+
string: '{}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.8.7
|
12
12
|
Content-Type:
|
13
13
|
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
16
|
Accept:
|
15
|
-
-
|
17
|
+
- '*/*'
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 200
|
@@ -29,10 +31,18 @@ http_interactions:
|
|
29
31
|
Server:
|
30
32
|
- Jetty(7.6.3.v20120416)
|
31
33
|
body:
|
32
|
-
encoding:
|
33
|
-
string:
|
34
|
-
|
35
|
-
|
34
|
+
encoding: UTF-8
|
35
|
+
string: |-
|
36
|
+
{
|
37
|
+
"metadata": {
|
38
|
+
"timestamp": "2013-06-13T15:16:30.003-05:00",
|
39
|
+
"params": {}
|
40
|
+
},
|
41
|
+
"data": [
|
42
|
+
"1abpbyu8u4ub00aatqoiiv4d6f",
|
43
|
+
"10d01ie6qbuxw0n4iudhoopjxa"
|
44
|
+
]
|
45
|
+
}
|
36
46
|
http_version:
|
37
|
-
recorded_at:
|
47
|
+
recorded_at: Thu, 13 Jun 2013 20:16:30 GMT
|
38
48
|
recorded_with: VCR 2.5.0
|
@@ -5,18 +5,20 @@ http_interactions:
|
|
5
5
|
uri: http://admin:badpassword@localhost:7280/api/authToken
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
8
|
+
string: '{}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Faraday v0.8.7
|
12
12
|
Content-Type:
|
13
13
|
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
16
|
Accept:
|
15
|
-
-
|
17
|
+
- '*/*'
|
16
18
|
response:
|
17
19
|
status:
|
18
20
|
code: 401
|
19
|
-
message:
|
21
|
+
message: '[{ "name": "SYSTEM", "description": "Invalid or missing credentials"
|
20
22
|
}]'
|
21
23
|
headers:
|
22
24
|
Pragma:
|
@@ -30,8 +32,8 @@ http_interactions:
|
|
30
32
|
Server:
|
31
33
|
- Jetty(7.6.3.v20120416)
|
32
34
|
body:
|
33
|
-
encoding:
|
34
|
-
string:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: '[{"name":"SYSTEM","description":"Invalid or missing credentials"}]'
|
35
37
|
http_version:
|
36
|
-
recorded_at:
|
38
|
+
recorded_at: Thu, 13 Jun 2013 20:16:30 GMT
|
37
39
|
recorded_with: VCR 2.5.0
|
@@ -12,43 +12,61 @@ http_interactions:
|
|
12
12
|
Accept-Encoding:
|
13
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
14
|
Accept:
|
15
|
-
-
|
15
|
+
- '*/*'
|
16
16
|
response:
|
17
17
|
status:
|
18
18
|
code: 200
|
19
|
-
message:
|
20
|
-
T0s=
|
19
|
+
message: OK
|
21
20
|
headers:
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
|
26
|
-
-
|
27
|
-
|
28
|
-
|
29
|
-
-
|
30
|
-
|
31
|
-
|
32
|
-
- !binary |-
|
33
|
-
Z3ppcA==
|
34
|
-
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
35
|
-
- !binary |-
|
36
|
-
Y2h1bmtlZA==
|
37
|
-
!binary "U2VydmVy":
|
38
|
-
- !binary |-
|
39
|
-
SmV0dHkoNy42LjMudjIwMTIwNDE2KQ==
|
21
|
+
Cache-Control:
|
22
|
+
- no-store
|
23
|
+
Pragma:
|
24
|
+
- no-cache
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Server:
|
30
|
+
- Jetty(7.6.3.v20120416)
|
40
31
|
body:
|
41
|
-
encoding:
|
42
|
-
string:
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
32
|
+
encoding: UTF-8
|
33
|
+
string: |-
|
34
|
+
{
|
35
|
+
"metadata": {
|
36
|
+
"timestamp": "2013-06-13T15:16:30.279-05:00",
|
37
|
+
"params": {}
|
38
|
+
},
|
39
|
+
"data": {
|
40
|
+
"orgId": 1,
|
41
|
+
"orgUid": "ADMIN",
|
42
|
+
"orgName": "ADMIN",
|
43
|
+
"status": "Active",
|
44
|
+
"active": true,
|
45
|
+
"blocked": false,
|
46
|
+
"parentOrgId": null,
|
47
|
+
"type": "ENTERPRISE",
|
48
|
+
"externalId": "ADMIN",
|
49
|
+
"hierarchyCounts": {},
|
50
|
+
"configInheritanceCounts": {},
|
51
|
+
"creationDate": "2006-05-23T15:11:39.159-05:00",
|
52
|
+
"modificationDate": "2013-06-13T15:14:38.120-05:00",
|
53
|
+
"registrationKey": "xxxxxxxxxxxxxxxx",
|
54
|
+
"reporting": {},
|
55
|
+
"customConfig": true,
|
56
|
+
"settings": {
|
57
|
+
"maxSeats": -1,
|
58
|
+
"maxBytes": -1
|
59
|
+
},
|
60
|
+
"settingsInherited": {
|
61
|
+
"maxSeats": "",
|
62
|
+
"maxBytes": ""
|
63
|
+
},
|
64
|
+
"settingsSummary": {
|
65
|
+
"maxSeats": -1,
|
66
|
+
"maxBytes": -1
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
52
70
|
http_version:
|
53
|
-
recorded_at:
|
71
|
+
recorded_at: Thu, 13 Jun 2013 20:16:30 GMT
|
54
72
|
recorded_with: VCR 2.5.0
|