slack-api 1.1.2 → 1.1.3

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +2 -0
  3. data/.rspec +1 -1
  4. data/.travis.yml +5 -0
  5. data/Guardfile +13 -0
  6. data/README.md +4 -0
  7. data/Rakefile +11 -0
  8. data/lib/slack/request.rb +1 -1
  9. data/lib/slack/version.rb +1 -1
  10. data/slack.gemspec +7 -2
  11. data/spec/api_spec.rb +23 -0
  12. data/spec/auth_spec.rb +22 -0
  13. data/spec/channels_spec.rb +247 -0
  14. data/spec/spec_helper.rb +81 -2
  15. data/spec/vcr/Slack_Client/api/test/with_extra_arguments.yml +56 -0
  16. data/spec/vcr/Slack_Client/api/test/with_valid_token.yml +56 -0
  17. data/spec/vcr/Slack_Client/auth/test/with_invalid_token.yml +48 -0
  18. data/spec/vcr/Slack_Client/auth/test/with_valid_token.yml +58 -0
  19. data/spec/vcr/Slack_Client/channels/archive/with_name.yml +58 -0
  20. data/spec/vcr/Slack_Client/channels/create/with_taken_name.yml +58 -0
  21. data/spec/vcr/Slack_Client/channels/create/with_test_channel_name.yml +58 -0
  22. data/spec/vcr/Slack_Client/channels/history/with_name.yml +71 -0
  23. data/spec/vcr/Slack_Client/channels/info/with_name.yml +59 -0
  24. data/spec/vcr/Slack_Client/channels/invite/with_valid_arguments.yml +59 -0
  25. data/spec/vcr/Slack_Client/channels/invite/without_argument_channel_.yml +58 -0
  26. data/spec/vcr/Slack_Client/channels/join/with_name.yml +58 -0
  27. data/spec/vcr/Slack_Client/channels/kick/with_arguments.yml +58 -0
  28. data/spec/vcr/Slack_Client/channels/leave/with_channel.yml +58 -0
  29. data/spec/vcr/Slack_Client/channels/list/with_valid_token.yml +63 -0
  30. data/spec/vcr/Slack_Client/channels/mark/with_argument.yml +58 -0
  31. data/spec/vcr/Slack_Client/channels/rename/with_name.yml +58 -0
  32. data/spec/vcr/Slack_Client/channels/setPurpose/with_arguments.yml +58 -0
  33. data/spec/vcr/Slack_Client/channels/setTopic/with_arguments.yml +58 -0
  34. data/spec/vcr/Slack_Client/channels/unarchive/with_channel.yml +58 -0
  35. metadata +129 -10
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/api.test
6
+ body:
7
+ encoding: UTF-8
8
+ string: foo=bar&hello=world&token=<TOKEN>
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - private, no-cache, no-store, must-revalidate
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Tue, 05 May 2015 23:44:45 GMT
31
+ Expires:
32
+ - Mon, 26 Jul 1997 05:00:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ Vary:
40
+ - Accept-Encoding
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Oauth-Scopes:
44
+ - identify,read,post,client,admin
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Content-Length:
48
+ - '108'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"ok":true,"args":{"foo":"bar","hello":"world","token":"<TOKEN>"}}'
54
+ http_version:
55
+ recorded_at: Tue, 05 May 2015 23:44:45 GMT
56
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/api.test
6
+ body:
7
+ encoding: UTF-8
8
+ string: token=<TOKEN>
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - private, no-cache, no-store, must-revalidate
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Tue, 05 May 2015 23:44:44 GMT
31
+ Expires:
32
+ - Mon, 26 Jul 1997 05:00:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ Vary:
40
+ - Accept-Encoding
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Oauth-Scopes:
44
+ - identify,read,post,client,admin
45
+ X-Xss-Protection:
46
+ - '0'
47
+ Content-Length:
48
+ - '92'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"ok":true,"args":{"token":"<TOKEN>"}}'
54
+ http_version:
55
+ recorded_at: Tue, 05 May 2015 23:44:44 GMT
56
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/auth.test
6
+ body:
7
+ encoding: UTF-8
8
+ string: token=dummy_token
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Date:
28
+ - Tue, 05 May 2015 23:44:47 GMT
29
+ Server:
30
+ - Apache
31
+ Strict-Transport-Security:
32
+ - max-age=31536000; includeSubDomains; preload
33
+ Vary:
34
+ - Accept-Encoding
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ X-Xss-Protection:
38
+ - '0'
39
+ Content-Length:
40
+ - '55'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"ok":false,"error":"invalid_auth"}'
46
+ http_version:
47
+ recorded_at: Tue, 05 May 2015 23:44:47 GMT
48
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/auth.test
6
+ body:
7
+ encoding: UTF-8
8
+ string: token=<TOKEN>
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - private, no-cache, no-store, must-revalidate
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Tue, 05 May 2015 23:44:46 GMT
31
+ Expires:
32
+ - Mon, 26 Jul 1997 05:00:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ Vary:
40
+ - Accept-Encoding
41
+ X-Accepted-Oauth-Scopes:
42
+ - identify
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Oauth-Scopes:
46
+ - identify,read,post,client,admin
47
+ X-Xss-Protection:
48
+ - '0'
49
+ Content-Length:
50
+ - '123'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"ok":true,"url":"https:\/\/aki017.slack.com\/","team":"Nyan","user":"testuser","team_id":"T0399SL8W","user_id":"U03LM2UM7"}'
56
+ http_version:
57
+ recorded_at: Tue, 05 May 2015 23:44:46 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/channels.archive
6
+ body:
7
+ encoding: UTF-8
8
+ string: channel=C04MY3KCY&token=<TOKEN>
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - private, no-cache, no-store, must-revalidate
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Wed, 06 May 2015 00:24:02 GMT
31
+ Expires:
32
+ - Mon, 26 Jul 1997 05:00:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ Vary:
40
+ - Accept-Encoding
41
+ X-Accepted-Oauth-Scopes:
42
+ - post
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Oauth-Scopes:
46
+ - identify,read,post,client,admin
47
+ X-Xss-Protection:
48
+ - '0'
49
+ Content-Length:
50
+ - '31'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"ok":true}'
56
+ http_version:
57
+ recorded_at: Wed, 06 May 2015 00:24:02 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/channels.create
6
+ body:
7
+ encoding: UTF-8
8
+ string: name=general&token=<TOKEN>
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - private, no-cache, no-store, must-revalidate
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Tue, 05 May 2015 23:44:38 GMT
31
+ Expires:
32
+ - Mon, 26 Jul 1997 05:00:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ Vary:
40
+ - Accept-Encoding
41
+ X-Accepted-Oauth-Scopes:
42
+ - read
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Oauth-Scopes:
46
+ - identify,read,post,client,admin
47
+ X-Xss-Protection:
48
+ - '0'
49
+ Content-Length:
50
+ - '53'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"ok":false,"error":"name_taken"}'
56
+ http_version:
57
+ recorded_at: Tue, 05 May 2015 23:44:38 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/channels.create
6
+ body:
7
+ encoding: UTF-8
8
+ string: name=gem_testroom&token=<TOKEN>
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - private, no-cache, no-store, must-revalidate
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Wed, 06 May 2015 00:27:02 GMT
31
+ Expires:
32
+ - Mon, 26 Jul 1997 05:00:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ Vary:
40
+ - Accept-Encoding
41
+ X-Accepted-Oauth-Scopes:
42
+ - read
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Oauth-Scopes:
46
+ - identify,read,post,client,admin
47
+ X-Xss-Protection:
48
+ - '0'
49
+ Content-Length:
50
+ - '232'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"ok":true,"channel":{"id":"C04NL1FKT","name":"gem_testroom","is_channel":true,"created":1430872022,"creator":"U03LM2UM7","is_archived":false,"is_general":false,"is_member":true,"last_read":"0000000000.000000","latest":null,"unread_count":0,"unread_count_display":0,"members":["U03LM2UM7"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0}}}'
56
+ http_version:
57
+ recorded_at: Wed, 06 May 2015 00:27:02 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,71 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://slack.com/api/channels.history
6
+ body:
7
+ encoding: UTF-8
8
+ string: channel=C04MY3KCY&token=<TOKEN>
9
+ headers:
10
+ Accept:
11
+ - application/json; charset=utf-8
12
+ User-Agent:
13
+ - Slack Ruby Gem 1.1.1
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - private, no-cache, no-store, must-revalidate
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Date:
30
+ - Wed, 06 May 2015 00:25:24 GMT
31
+ Expires:
32
+ - Mon, 26 Jul 1997 05:00:00 GMT
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - Apache
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ Vary:
40
+ - Accept-Encoding
41
+ X-Accepted-Oauth-Scopes:
42
+ - read
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Oauth-Scopes:
46
+ - identify,read,post,client,admin
47
+ X-Xss-Protection:
48
+ - '0'
49
+ Content-Length:
50
+ - '419'
51
+ Connection:
52
+ - keep-alive
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"ok":true,"messages":[{"user":"U0399SL90","type":"message","subtype":"channel_leave","text":"<@U0399SL90|aki017>
56
+ has left the channel","ts":"1430871896.000012"},{"user":"U0399SL90","type":"message","subtype":"channel_unarchive","text":"<@U0399SL90|aki017>
57
+ un-archived the channel","ts":"1430871887.000011"},{"user":"U0399SL90","type":"message","subtype":"channel_join","text":"<@U0399SL90|aki017>
58
+ has joined the channel","ts":"1430871887.000010"},{"user":"U03LM2UM7","members":["U0399SL90","U03LM2UM7"],"type":"message","subtype":"channel_archive","text":"<@U03LM2UM7|testuser>
59
+ archived the channel (w\/ 2 members)","ts":"1430871842.000009"},{"user":"U03LM2UM7","purpose":"TestPurpose","type":"message","subtype":"channel_purpose","text":"<@U03LM2UM7|testuser>
60
+ set the channel purpose: TestPurpose","ts":"1430871824.000008"},{"user":"U03LM2UM7","topic":"TestTopic","type":"message","subtype":"channel_topic","text":"<@U03LM2UM7|testuser>
61
+ set the channel topic: TestTopic","ts":"1430871807.000007"},{"user":"U0399SL90","inviter":"U03LM2UM7","type":"message","subtype":"channel_join","text":"<@U0399SL90|aki017>
62
+ has joined the channel","ts":"1430871766.000006"},{"user":"U0399SL90","type":"message","subtype":"channel_leave","text":"<@U0399SL90|aki017>
63
+ has left the channel","ts":"1430871759.000005"},{"user":"U0399SL90","type":"message","subtype":"channel_join","text":"<@U0399SL90|aki017>
64
+ has joined the channel","ts":"1430871607.000004"},{"user":"U03LM2UM7","type":"message","subtype":"channel_unarchive","text":"<@U03LM2UM7|testuser>
65
+ un-archived the channel","ts":"1430871607.000003"},{"user":"U03LM2UM7","type":"message","subtype":"channel_join","text":"<@U03LM2UM7|testuser>
66
+ has joined the channel","ts":"1430871607.000002"},{"user":"U0399SL90","members":["U0399SL90"],"type":"message","subtype":"channel_archive","text":"<@U0399SL90|aki017>
67
+ archived the channel (w\/ 1 member)","ts":"1430871394.000003"},{"user":"U0399SL90","type":"message","subtype":"channel_join","text":"<@U0399SL90|aki017>
68
+ has joined the channel","ts":"1430871123.000002"}],"has_more":false}'
69
+ http_version:
70
+ recorded_at: Wed, 06 May 2015 00:25:24 GMT
71
+ recorded_with: VCR 2.9.3