code42 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. data/.gitignore +1 -0
  2. data/README.md +82 -64
  3. data/Rakefile +5 -0
  4. data/code42.gemspec +6 -6
  5. data/lib/code42/api/computer.rb +22 -0
  6. data/lib/code42/api/org.rb +60 -0
  7. data/lib/code42/api/role.rb +24 -0
  8. data/lib/code42/api/token.rb +32 -0
  9. data/lib/code42/api/user.rb +72 -0
  10. data/lib/code42/client.rb +7 -178
  11. data/lib/code42/user.rb +8 -0
  12. data/lib/code42/version.rb +1 -1
  13. data/spec/cassettes/Code42_Client/_create_org/returns_created_org.yml +8 -8
  14. data/spec/cassettes/Code42_Client/_create_user/returns_created_user.yml +6 -6
  15. data/spec/cassettes/Code42_Client/_create_user/when_sending_an_invalid_email/raises_an_exception.yml +2 -2
  16. data/spec/cassettes/Code42_Client/_find_org_by_name/returns_the_org_with_the_specified_name.yml +12 -58
  17. data/spec/cassettes/Code42_Client/_get_token/returns_valid_tokens.yml +5 -5
  18. data/spec/cassettes/Code42_Client/_get_token/when_providing_invalid_credentials/should_raise_an_exception.yml +2 -2
  19. data/spec/cassettes/Code42_Client/_org/when_ID_is_not_passed/returns_my_org.yml +11 -11
  20. data/spec/cassettes/Code42_Client/_org/when_ID_is_passed_in/returns_a_specific_org.yml +11 -11
  21. data/spec/cassettes/Code42_Client/_ping/returns_a_ping.yml +5 -5
  22. data/spec/cassettes/Code42_Client/_user/when_ID_is_not_passed/returns_my_user.yml +10 -10
  23. data/spec/cassettes/Code42_Client/_user/when_ID_is_passed_in/returns_a_specific_user.yml +10 -10
  24. data/spec/cassettes/Code42_Client/_user/when_blocked/returns_the_blocked_status.yml +84 -0
  25. data/spec/cassettes/Code42_Client/_user/when_unblocked/returns_the_blocked_status.yml +113 -0
  26. data/spec/cassettes/Code42_Client/_user_roles/returns_an_enumerable.yml +7 -7
  27. data/spec/cassettes/Code42_Client/_validate_token/returns_a_valid_response.yml +10 -10
  28. data/spec/{crashplan → code42}/client_spec.rb +26 -5
  29. data/spec/{crashplan → code42}/connection_spec.rb +0 -0
  30. data/spec/{crashplan → code42}/org_spec.rb +0 -0
  31. data/spec/{crashplan → code42}/ping_spec.rb +0 -0
  32. data/spec/{crashplan → code42}/resource_spec.rb +0 -0
  33. data/spec/{crashplan → code42}/role_spec.rb +0 -0
  34. data/spec/{crashplan → code42}/settings_spec.rb +0 -0
  35. data/spec/{crashplan → code42}/token_spec.rb +0 -0
  36. data/spec/{crashplan → code42}/user_spec.rb +0 -0
  37. metadata +49 -66
  38. data/spec/cassettes/Crashplan_Client/_create_org/returns_created_org.yml +0 -47
  39. data/spec/cassettes/Crashplan_Client/_create_user/returns_created_user.yml +0 -44
  40. data/spec/cassettes/Crashplan_Client/_create_user/when_sending_an_invalid_email/raises_an_exception.yml +0 -37
  41. data/spec/cassettes/Crashplan_Client/_find_org_by_name/returns_the_org_with_the_specified_name.yml +0 -55
  42. data/spec/cassettes/Crashplan_Client/_get_token/returns_valid_tokens.yml +0 -38
  43. data/spec/cassettes/Crashplan_Client/_get_token/when_providing_invalid_credentials/should_raise_an_exception.yml +0 -37
  44. data/spec/cassettes/Crashplan_Client/_org/when_ID_is_not_passed/returns_my_org.yml +0 -54
  45. data/spec/cassettes/Crashplan_Client/_org/when_ID_is_passed_in/returns_a_specific_org.yml +0 -54
  46. data/spec/cassettes/Crashplan_Client/_ping/returns_a_ping.yml +0 -48
  47. data/spec/cassettes/Crashplan_Client/_user/when_ID_is_not_passed/returns_my_user.yml +0 -99
  48. data/spec/cassettes/Crashplan_Client/_user/when_ID_is_passed_in/returns_a_specific_user.yml +0 -53
  49. data/spec/cassettes/Crashplan_Client/_user_roles/returns_an_enumerable.yml +0 -50
  50. data/spec/cassettes/Crashplan_Client/_validate_token/returns_a_valid_response.yml +0 -128
@@ -40,14 +40,14 @@ http_interactions:
40
40
  body:
41
41
  encoding: ASCII-8BIT
42
42
  string: !binary |-
43
- H4sIAAAAAAAAAJWSTW7CMBCF95wi8pogJzQgsktFFlmUIkoPMMROsRrbYE+o
44
- EOLutUsoIaiLLv29mXnz49MgCIjkCAwQSBoEwckRx1BIbhHkzkES02gc0iSk
45
- k3UUpzRJk+lomswcSiklw0vGDgxI68JPZwfOnpJ+1cZyUzBHouENvAtPCG6/
46
- 6m3zehT72B42rNxXUsaMS8XE1cI1hI23IFmJ4sBJp4oCyb0CTAp1FbgEUT/Q
47
- ShiLizY+6yo1/CHsG41QqOcjcu8fXvvX5uNuHvdux8nmL8WC3PBv2S6Hyxhp
48
- gKbhLdvUuvzkvkYFteXdSZZGS90ThDoIfAh3huvj7scwX6zz1XJVvOX9dRU2
49
- U3m7oW5yaTig0GoOyC/np5OQPoXR1J9/TN3RR7MZvT+/1ExUovxHov8lg/M3
50
- 1V5KGIICAAA=
43
+ H4sIAAAAAAAAAJWSTW7CMBCF95wi8pogOym0ZJeKLLIoRTQ9wBA7xWpsQzyh
44
+ Qoi71y6hBFAXXfp7M/Pmx4dBEBAlEDggkCQIgoMjjqFUwiKojYMkoiwO6SRk
45
+ rGDjJJ4kLB6x6Cmk44RSMjxlbKABZV344ejA0VNyW7W1osm5I2x4Ae/SE4Lr
46
+ r3rdvu7lNrK7FS+3lVIRF0pzebZwDWHrLUhaotwJ0quiQQmvAFdSnwWhQNZ3
47
+ tJKNxXkXn/aVGv4Qtq1ByPXzHoX3D8/9m+bjah737sZJZy/5nFzwb9k+h9MY
48
+ SYBNKzq2qk35KXyNCmor+pMsGqPMjSD1TuJduDMs9psfw2xeZMvFMn/LbteV
49
+ 21Rn3Yb6yWUjAKXRM0BxOr+7PX0I2WPBoiSm7uij6ZRen18ZLitZ/iPR/5LB
50
+ 8Rv18F6oggIAAA==
51
51
  http_version:
52
- recorded_at: Mon, 06 May 2013 17:05:57 GMT
53
- recorded_with: VCR 2.4.0
52
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
53
+ recorded_with: VCR 2.5.0
@@ -40,14 +40,14 @@ http_interactions:
40
40
  body:
41
41
  encoding: ASCII-8BIT
42
42
  string: !binary |-
43
- H4sIAAAAAAAAAJWSzW7CMBCE7zxF5DNBTiggcktFDjmUIkrP1eI4xWocg72m
44
- Qoh3rw2hpKnUn6M/z+7srubYCwIiOUIBCCQJguDoiGMoJDcIcusgiWk0DOko
45
- pONVFCd0lIwmg3FMHUooJf1LxRY0SOPkx5MDJ09Jt6s1XOeFI3H/Bp6FJwQ3
46
- 79XGPh7ELjb7dcF2pZRxwWVdwNXCDYTWW5CUodhz0upSg+T+BxhTtsYXsAY1
47
- VOKzmEsQ1Y+KUmiD89/6VPAH0c4qhLy+PyD384ZRw5V+Pe/fejfrp7OHfE5u
48
- +GrxhcNl7SRAbXnD1pVib9z3KKEyvL3tQiupOh+i3gv8JneGq8P2bJjNV9ly
49
- scyfsu55c5PWWXPFdjHTHFCoegbIL3Gh45DehdHEx2VIXUgG02knLlIVohTs
50
- H4U+Vb3TBw/+lrGyAgAA
43
+ H4sIAAAAAAAAAI2SQXOCMBCF7/4KJmdxEqi0ctORA4dax9JzZ4VQMyVEk8WO
44
+ 4/jfGxAqeGh7zJe3+5I37zxyHCI5QgYIJHQc52yJZSgkNwhybyHxKPNdGriM
45
+ JWwa+kHI/AkLApdOQ0rJ+DqxBw3SWPn5YsGlpuR+a2W4jjNLvPENvImaENx9
46
+ Fbvq5SQOnjlus/SQS+llXJYZdBb2QVjVFmSeojjysbMoVPrJM9JbV4LktQTS
47
+ VFUlvkNlUEMhfrZwCaL4VZELbXD1154C/iE6VAohLhcn5PXDXdZypT+aIHrn
48
+ Nof58jlekRvuLAYcmv9bjLriLdu2WQxg89m1VlJZnkNhugtRHgU26j61fslp
49
+ 3/hFqyTarDfxa3SfbmzmZdSG2B9ONQcUqlwC8mttbGfog8seE+aFPrVlmcxm
50
+ dFgbqTKRi/RucNC3aeg9TehTN1i3a3T5Br40MGq6AgAA
51
51
  http_version:
52
- recorded_at: Mon, 06 May 2013 17:05:57 GMT
53
- recorded_with: VCR 2.4.0
52
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
53
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,84 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://admin:admin@localhost:7280/api/userblock/2
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - ! '*/*'
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: No Content
20
+ headers:
21
+ Cache-Control:
22
+ - no-store
23
+ Pragma:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/json
27
+ Server:
28
+ - Jetty(7.6.3.v20120416)
29
+ body:
30
+ encoding: US-ASCII
31
+ string: ''
32
+ http_version:
33
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
34
+ - request:
35
+ method: get
36
+ uri: http://admin:admin@localhost:7280/api/user/2
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ''
40
+ headers:
41
+ User-Agent:
42
+ - Faraday v0.8.7
43
+ Accept-Encoding:
44
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
45
+ Accept:
46
+ - ! '*/*'
47
+ response:
48
+ status:
49
+ code: 200
50
+ message: !binary |-
51
+ T0s=
52
+ headers:
53
+ !binary "Q2FjaGUtQ29udHJvbA==":
54
+ - !binary |-
55
+ bm8tc3RvcmU=
56
+ !binary "UHJhZ21h":
57
+ - !binary |-
58
+ bm8tY2FjaGU=
59
+ !binary "Q29udGVudC1UeXBl":
60
+ - !binary |-
61
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
62
+ !binary "Q29udGVudC1FbmNvZGluZw==":
63
+ - !binary |-
64
+ Z3ppcA==
65
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
66
+ - !binary |-
67
+ Y2h1bmtlZA==
68
+ !binary "U2VydmVy":
69
+ - !binary |-
70
+ SmV0dHkoNy42LjMudjIwMTIwNDE2KQ==
71
+ body:
72
+ encoding: ASCII-8BIT
73
+ string: !binary |-
74
+ H4sIAAAAAAAAAI2SQXOCMBCF7/4KJmdxEqhWuenIgUOtY+m5s0KomRKiyWLH
75
+ cfzvDQgKHtoe8+XtvuTNOw8ch0iOkAICCRzHOVtiGQrJDYLcW0g8ynyXTlzG
76
+ YjYO/EnA/BGdei4dB5SS4XViDxqksfLzxYJLRcnj1tJwHaWWeMM7eBcVIbj7
77
+ znfl60kcPHPcpskhk9JLuSxSaC3sg7CsLMg8QXHkQ2eRq+SLp6SzrgDJKwkk
78
+ iSoL/IDSoIZc3LZwCSL/VZEJbXD1154c/iE6lAohKhYn5NXDXdZwpT/rIDrn
79
+ Jof58iVakTtuLXoc6v9bjLrkDds2WfRg/dm1VlJZnkFu2gtRHAXW6i61fvFp
80
+ X/uFqzjcrDfRW/iYbmTmRdiE2B1ONAcUqlgC8mttbGfok8ueY+YFPrVlGc1m
81
+ tF8bqVKRieRhsNe3ceBNbd/awapdg8sP9oPlU7oCAAA=
82
+ http_version:
83
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
84
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,113 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://admin:admin@localhost:7280/api/userblock/2
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.7
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - ! '*/*'
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: No Content
20
+ headers:
21
+ Cache-Control:
22
+ - no-store
23
+ Pragma:
24
+ - no-cache
25
+ Content-Type:
26
+ - application/json
27
+ Server:
28
+ - Jetty(7.6.3.v20120416)
29
+ body:
30
+ encoding: US-ASCII
31
+ string: ''
32
+ http_version:
33
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
34
+ - request:
35
+ method: delete
36
+ uri: http://admin:admin@localhost:7280/api/userblock/2
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ''
40
+ headers:
41
+ User-Agent:
42
+ - Faraday v0.8.7
43
+ Accept:
44
+ - ! '*/*'
45
+ response:
46
+ status:
47
+ code: 204
48
+ message: No Content
49
+ headers:
50
+ Cache-Control:
51
+ - no-store
52
+ Pragma:
53
+ - no-cache
54
+ Content-Type:
55
+ - application/json
56
+ Server:
57
+ - Jetty(7.6.3.v20120416)
58
+ body:
59
+ encoding: US-ASCII
60
+ string: ''
61
+ http_version:
62
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
63
+ - request:
64
+ method: get
65
+ uri: http://admin:admin@localhost:7280/api/user/2
66
+ body:
67
+ encoding: US-ASCII
68
+ string: ''
69
+ headers:
70
+ User-Agent:
71
+ - Faraday v0.8.7
72
+ Accept-Encoding:
73
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
74
+ Accept:
75
+ - ! '*/*'
76
+ response:
77
+ status:
78
+ code: 200
79
+ message: !binary |-
80
+ T0s=
81
+ headers:
82
+ !binary "Q2FjaGUtQ29udHJvbA==":
83
+ - !binary |-
84
+ bm8tc3RvcmU=
85
+ !binary "UHJhZ21h":
86
+ - !binary |-
87
+ bm8tY2FjaGU=
88
+ !binary "Q29udGVudC1UeXBl":
89
+ - !binary |-
90
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
91
+ !binary "Q29udGVudC1FbmNvZGluZw==":
92
+ - !binary |-
93
+ Z3ppcA==
94
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
95
+ - !binary |-
96
+ Y2h1bmtlZA==
97
+ !binary "U2VydmVy":
98
+ - !binary |-
99
+ SmV0dHkoNy42LjMudjIwMTIwNDE2KQ==
100
+ body:
101
+ encoding: ASCII-8BIT
102
+ string: !binary |-
103
+ H4sIAAAAAAAAAI2SMW/CMBCFd35F5JkgOykgslGRIUMpoulcHY5TrMYx2Bcq
104
+ hPjvdSCUkKK2oz/fu3d3eoee5xElEDJAIJHneQdHHEOphEVQGwdJQFno05HP
105
+ WMqGUTiKWDgIxkOfDiNKSf+s2IABZV354ejAsaak27WywiSZI0H/Cl5lTQiu
106
+ P4t19byX28DuVhnf5koFmVBlBhcLNxBWtQWZcpQ7QVpdSlCi/gHOdVXiG1QW
107
+ DRTyWywUyOLXilwai/O/+hTwj6JtpRGS8nGPop7XZw3X5v20f+vdrD+dPSVz
108
+ csUXixsO57UjD00lGrYqNP8QdY8cCiva2y6MVrrzIcudxB/lzjDdb06G8TyN
109
+ l4tl8hJ3z5vYaRk3V2yLuRGAUpczQHGOi8sKffDZOGVBFFIXksFkQm/jonQm
110
+ c8k7wjs5Cy7COlW94xcVE54ksgIAAA==
111
+ http_version:
112
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
113
+ recorded_with: VCR 2.5.0
@@ -40,11 +40,11 @@ http_interactions:
40
40
  body:
41
41
  encoding: ASCII-8BIT
42
42
  string: !binary |-
43
- H4sIAAAAAAAAAF2POw+CMBSFd35F01lIy1O7mbgwyIKLMQw3cE0aqZhSJ8J/
44
- 9za+Wb/cc+53poAxbtBBBw64YoxNRIg5bXB0YG4EeSxkEoosFPlBxkpkKltH
45
- aZETUkLw1TNxAwtmpPNpJjB7yl+tp0+tHXosO0Jy9QUVGPRv6mO93e3L6t3Y
46
- D+0F/bGzd3yx1iI4PVx34PCpJsgjDWXh1RJBQtFmXfyrmaHTZ90ugn+bEiVl
47
- JON4sQmt0eNIMT/sNP0A3wGd0Vc+N35vE8wPONfFpk0BAAA=
43
+ H4sIAAAAAAAAAF2PPQ+CMBRFd39F0xlISxGlmwmLgy6wGOPwAs+kkYopdSL8
44
+ d18jfq4n755377hgjFv00IIHrhljIxFi3lgcPNgbQZ4KqWKRx1LWcqlVrqVK
45
+ VLqOxVILwaNn4gYO7EDn40RgCpTP1uNb6/oOty0hGX3AHiyGN9Wh2pS77f5l
46
+ 7PrmguHYuzvOrHEI3vTXEjw+q1EvkcVyVctUK0GFkmK9+q1m+9acTfMX/NmU
47
+ aZEnRaH+NqGzZhgoFoYdxy8QHNBac+XTKew9LaYHscZqsU0BAAA=
48
48
  http_version:
49
- recorded_at: Mon, 06 May 2013 17:05:58 GMT
50
- recorded_with: VCR 2.4.0
49
+ recorded_at: Tue, 11 Jun 2013 20:36:13 GMT
50
+ recorded_with: VCR 2.5.0
@@ -30,14 +30,14 @@ http_interactions:
30
30
  - Jetty(7.6.3.v20120416)
31
31
  body:
32
32
  encoding: US-ASCII
33
- string: ! "{\n \"metadata\": {\n \"timestamp\": \"2013-05-06T12:05:58.572-05:00\",\n
34
- \ \"params\": {}\n },\n \"data\": [\n \"1avev1icqqfub13zny9648sl4m\",\n
35
- \ \"13yhgbxy9r6qz1emjnfdaguwsw\"\n ]\n}"
33
+ string: ! "{\n \"metadata\": {\n \"timestamp\": \"2013-06-11T15:36:12.961-05:00\",\n
34
+ \ \"params\": {}\n },\n \"data\": [\n \"0kar1p08yxaj018frlrvyinmgk\",\n
35
+ \ \"00urf5qlpxdfh0p1nfwwxout68\"\n ]\n}"
36
36
  http_version:
37
- recorded_at: Mon, 06 May 2013 17:05:58 GMT
37
+ recorded_at: Tue, 11 Jun 2013 20:36:12 GMT
38
38
  - request:
39
39
  method: get
40
- uri: http://admin:admin@localhost:7280/api/authToken/1avev1icqqfub13zny9648sl4m-13yhgbxy9r6qz1emjnfdaguwsw
40
+ uri: http://admin:admin@localhost:7280/api/authToken/0kar1p08yxaj018frlrvyinmgk-00urf5qlpxdfh0p1nfwwxout68
41
41
  body:
42
42
  encoding: US-ASCII
43
43
  string: ''
@@ -75,9 +75,9 @@ http_interactions:
75
75
  body:
76
76
  encoding: ASCII-8BIT
77
77
  string: !binary |-
78
- H4sIAAAAAAAAAF3NMQrDMAyF4T2nMJqTori4tD5HLyCwBkMUgq10Mb57ZNqp
79
- 64f+pzY5B8JKiZQgOueaiZlm4aokhyF4XO8LhgUf79VHDDE8b+HljSIizN/i
80
- oEJS7bx1gz4U/lc/tOVkoOXkX3ZWLjsJjz+UJO8w6qlfjSe1LZoAAAA=
78
+ H4sIAAAAAAAAAF3NMQrDMAyF4T2nMJqTYiUkpT5HLyCwBkMUgq10Mb57ZNqp
79
+ 64f+pzo4B8JKkZQgOOeqiZkm4aIkpyHMHpfJbxPiG9ewbAHnx+tptAbvYfwW
80
+ J2WSYue1GbSu8L/6oT1FA80X/7KrcD5IuP+hKOmAXg/tBgjg2zKaAAAA
81
81
  http_version:
82
- recorded_at: Mon, 06 May 2013 17:05:58 GMT
83
- recorded_with: VCR 2.4.0
82
+ recorded_at: Tue, 11 Jun 2013 20:36:12 GMT
83
+ recorded_with: VCR 2.5.0
@@ -53,7 +53,6 @@ describe Code42::Client, :vcr do
53
53
  org = client.create_org(org_attributes)
54
54
  org.name.should eq 'IBM'
55
55
  end
56
-
57
56
  end
58
57
 
59
58
  describe "#create_user" do
@@ -79,6 +78,8 @@ describe Code42::Client, :vcr do
79
78
  end
80
79
 
81
80
  describe "#user" do
81
+ let(:user_id) { 2 }
82
+
82
83
  context "when ID is not passed" do
83
84
  it "returns my user" do
84
85
  user = client.user
@@ -88,13 +89,33 @@ describe Code42::Client, :vcr do
88
89
 
89
90
  context "when ID is passed in" do
90
91
  it "returns a specific user" do
91
- user = client.user(2)
92
- user.id.should == 2
92
+ user = client.user(user_id)
93
+ user.id.should == user_id
93
94
  end
94
95
 
95
96
  it "passes params to code42 server" do
96
- client.should_receive(:object_from_response).with(Code42::User, :get, "user/2", :incAll => true)
97
- user = client.user(2, :incAll => true)
97
+ client.should_receive(:object_from_response).with(Code42::User, :get, "user/#{user_id}", :incAll => true)
98
+ user = client.user(user_id, :incAll => true)
99
+ end
100
+ end
101
+
102
+ context "when blocked" do
103
+ it "returns the blocked status" do
104
+ client.block_user(user_id)
105
+ user = client.user(user_id)
106
+ user.blocked.should be_true
107
+ end
108
+ end
109
+
110
+ context "when unblocked" do
111
+ before(:each) do
112
+ client.block_user(user_id)
113
+ end
114
+
115
+ it "returns the blocked status" do
116
+ client.unblock_user(user_id)
117
+ user = client.user(user_id)
118
+ user.blocked.should be_false
98
119
  end
99
120
  end
100
121
  end
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code42
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,72 +9,72 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-16 00:00:00.000000000 Z
12
+ date: 2013-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 2.11.0
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 2.11.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: webmock
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 1.11.0
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 1.11.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: vcr
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ! '>='
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 2.4.0
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ! '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 2.4.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: faraday
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ! '>='
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 0.8.7
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ! '>='
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: 0.8.7
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: activesupport
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -96,17 +96,17 @@ dependencies:
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
- - - ! '>='
99
+ - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: 0.9.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ! '>='
107
+ - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: 0.9.0
110
110
  description: Provides a Ruby interface to the Code42 API
111
111
  email:
112
112
  - dev-ruby@code42.com
@@ -129,6 +129,11 @@ files:
129
129
  - examples/parser_test.rb
130
130
  - examples/users.rb
131
131
  - lib/code42.rb
132
+ - lib/code42/api/computer.rb
133
+ - lib/code42/api/org.rb
134
+ - lib/code42/api/role.rb
135
+ - lib/code42/api/token.rb
136
+ - lib/code42/api/user.rb
132
137
  - lib/code42/attribute.rb
133
138
  - lib/code42/attribute_serializer.rb
134
139
  - lib/code42/client.rb
@@ -157,30 +162,19 @@ files:
157
162
  - spec/cassettes/Code42_Client/_ping/returns_a_ping.yml
158
163
  - spec/cassettes/Code42_Client/_user/when_ID_is_not_passed/returns_my_user.yml
159
164
  - spec/cassettes/Code42_Client/_user/when_ID_is_passed_in/returns_a_specific_user.yml
165
+ - spec/cassettes/Code42_Client/_user/when_blocked/returns_the_blocked_status.yml
166
+ - spec/cassettes/Code42_Client/_user/when_unblocked/returns_the_blocked_status.yml
160
167
  - spec/cassettes/Code42_Client/_user_roles/returns_an_enumerable.yml
161
168
  - spec/cassettes/Code42_Client/_validate_token/returns_a_valid_response.yml
162
- - spec/cassettes/Crashplan_Client/_create_org/returns_created_org.yml
163
- - spec/cassettes/Crashplan_Client/_create_user/returns_created_user.yml
164
- - spec/cassettes/Crashplan_Client/_create_user/when_sending_an_invalid_email/raises_an_exception.yml
165
- - spec/cassettes/Crashplan_Client/_find_org_by_name/returns_the_org_with_the_specified_name.yml
166
- - spec/cassettes/Crashplan_Client/_get_token/returns_valid_tokens.yml
167
- - spec/cassettes/Crashplan_Client/_get_token/when_providing_invalid_credentials/should_raise_an_exception.yml
168
- - spec/cassettes/Crashplan_Client/_org/when_ID_is_not_passed/returns_my_org.yml
169
- - spec/cassettes/Crashplan_Client/_org/when_ID_is_passed_in/returns_a_specific_org.yml
170
- - spec/cassettes/Crashplan_Client/_ping/returns_a_ping.yml
171
- - spec/cassettes/Crashplan_Client/_user/when_ID_is_not_passed/returns_my_user.yml
172
- - spec/cassettes/Crashplan_Client/_user/when_ID_is_passed_in/returns_a_specific_user.yml
173
- - spec/cassettes/Crashplan_Client/_user_roles/returns_an_enumerable.yml
174
- - spec/cassettes/Crashplan_Client/_validate_token/returns_a_valid_response.yml
175
- - spec/crashplan/client_spec.rb
176
- - spec/crashplan/connection_spec.rb
177
- - spec/crashplan/org_spec.rb
178
- - spec/crashplan/ping_spec.rb
179
- - spec/crashplan/resource_spec.rb
180
- - spec/crashplan/role_spec.rb
181
- - spec/crashplan/settings_spec.rb
182
- - spec/crashplan/token_spec.rb
183
- - spec/crashplan/user_spec.rb
169
+ - spec/code42/client_spec.rb
170
+ - spec/code42/connection_spec.rb
171
+ - spec/code42/org_spec.rb
172
+ - spec/code42/ping_spec.rb
173
+ - spec/code42/resource_spec.rb
174
+ - spec/code42/role_spec.rb
175
+ - spec/code42/settings_spec.rb
176
+ - spec/code42/token_spec.rb
177
+ - spec/code42/user_spec.rb
184
178
  - spec/fixtures/auth/bad_password.json
185
179
  - spec/fixtures/authToken.json
186
180
  - spec/fixtures/org.1.json
@@ -229,30 +223,19 @@ test_files:
229
223
  - spec/cassettes/Code42_Client/_ping/returns_a_ping.yml
230
224
  - spec/cassettes/Code42_Client/_user/when_ID_is_not_passed/returns_my_user.yml
231
225
  - spec/cassettes/Code42_Client/_user/when_ID_is_passed_in/returns_a_specific_user.yml
226
+ - spec/cassettes/Code42_Client/_user/when_blocked/returns_the_blocked_status.yml
227
+ - spec/cassettes/Code42_Client/_user/when_unblocked/returns_the_blocked_status.yml
232
228
  - spec/cassettes/Code42_Client/_user_roles/returns_an_enumerable.yml
233
229
  - spec/cassettes/Code42_Client/_validate_token/returns_a_valid_response.yml
234
- - spec/cassettes/Crashplan_Client/_create_org/returns_created_org.yml
235
- - spec/cassettes/Crashplan_Client/_create_user/returns_created_user.yml
236
- - spec/cassettes/Crashplan_Client/_create_user/when_sending_an_invalid_email/raises_an_exception.yml
237
- - spec/cassettes/Crashplan_Client/_find_org_by_name/returns_the_org_with_the_specified_name.yml
238
- - spec/cassettes/Crashplan_Client/_get_token/returns_valid_tokens.yml
239
- - spec/cassettes/Crashplan_Client/_get_token/when_providing_invalid_credentials/should_raise_an_exception.yml
240
- - spec/cassettes/Crashplan_Client/_org/when_ID_is_not_passed/returns_my_org.yml
241
- - spec/cassettes/Crashplan_Client/_org/when_ID_is_passed_in/returns_a_specific_org.yml
242
- - spec/cassettes/Crashplan_Client/_ping/returns_a_ping.yml
243
- - spec/cassettes/Crashplan_Client/_user/when_ID_is_not_passed/returns_my_user.yml
244
- - spec/cassettes/Crashplan_Client/_user/when_ID_is_passed_in/returns_a_specific_user.yml
245
- - spec/cassettes/Crashplan_Client/_user_roles/returns_an_enumerable.yml
246
- - spec/cassettes/Crashplan_Client/_validate_token/returns_a_valid_response.yml
247
- - spec/crashplan/client_spec.rb
248
- - spec/crashplan/connection_spec.rb
249
- - spec/crashplan/org_spec.rb
250
- - spec/crashplan/ping_spec.rb
251
- - spec/crashplan/resource_spec.rb
252
- - spec/crashplan/role_spec.rb
253
- - spec/crashplan/settings_spec.rb
254
- - spec/crashplan/token_spec.rb
255
- - spec/crashplan/user_spec.rb
230
+ - spec/code42/client_spec.rb
231
+ - spec/code42/connection_spec.rb
232
+ - spec/code42/org_spec.rb
233
+ - spec/code42/ping_spec.rb
234
+ - spec/code42/resource_spec.rb
235
+ - spec/code42/role_spec.rb
236
+ - spec/code42/settings_spec.rb
237
+ - spec/code42/token_spec.rb
238
+ - spec/code42/user_spec.rb
256
239
  - spec/fixtures/auth/bad_password.json
257
240
  - spec/fixtures/authToken.json
258
241
  - spec/fixtures/org.1.json