bearcat 0.9.7 → 0.9.8

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Njk3NWEyZjNjOWU0MjdkZmMwYjBkNWIxNzkwNDg2MDFmNjk5MDgxZg==
4
+ YjE0NTAxNjg4YWFiYWQyYzkwY2Q3NWI2OTE1NmMxZDI4MzgzYjJmZQ==
5
5
  data.tar.gz: !binary |-
6
- NDBiN2YwNDc3Njc0NDBiODhlNjcyZTk4YTQ1NzEzYWQyNjgxZTY1OQ==
6
+ MTNjOTE5NzI0MzFmOWFkNDhhMTUxMmRhNjdiMjk2ZjJhYmFiMDM1Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODExY2NlNGU0Yjk2MmE5Y2FiZTVmYWMyMzdkYjA4NzIxNTYxZTgxMTg1Zjhj
10
- MGUxNDgxNTgxYmE3NjQwOWFkMzQ3OTU0MDRlNDQwMDQyZDM4NGQyMjg4MGRh
11
- YmVkZDU3MmNmNzc1N2YyZjk1NTU3OTAwMDljYjk4OWYwMDAyM2M=
9
+ OTIyYzM5NzNlMmI1ZDlmNmIzMDM4MjBkYzdlYTc3NjY3MzA4ZmRlM2Q1YmQ4
10
+ OTdkM2M3MWJhYjgyOTZhYWIwNTI2ZjRlNmY2NjdiMjMyYzc1MTdjNTUxNjY1
11
+ MTljNWY2NWU0YjY3OTEyNmI4ODQ5M2MyNGM4MTBhZWY5ZDY4MGM=
12
12
  data.tar.gz: !binary |-
13
- MmZkNDdhZGU3MzMxNzZmYmFlNWY5MGYxZTBkMGE5YjlkZTk5Nzg4ZmQwNTk1
14
- YzM4YTE0ZmZlMzgwNzEzNzg0MjMzNGZhMWQ4YWY5ODExYjA4YWViNTAxYTFi
15
- OGZhMjA1MTA1NjA3OWI1YTJmMjRhMTU0OWJiYTEyMjRhOGIwMDk=
13
+ MzYyZTJkZDBiZGZjYzc4ODI0YTYxYjc4ZDc5ZjI0MGNiMmE5OGVmYmNmMGUw
14
+ Mzg4ZDY5ODFhODExYTllZjIyZDNjODg0NzhkMDkyMmNhMDg5ZjJhMTdlNGRm
15
+ MjA2MjYxOTFmMTFjOThjYThmNmY4NDQ2MmYyMjcxYjM1OWQ1M2Y=
@@ -13,6 +13,7 @@ require 'bearcat/client/users'
13
13
  require 'bearcat/client/reports'
14
14
  require 'bearcat/client/accounts'
15
15
  require 'bearcat/client/submissions'
16
+ require 'bearcat/client/conversations'
16
17
 
17
18
  module Bearcat
18
19
  class Client < Footrest::Client
@@ -30,6 +31,7 @@ module Bearcat
30
31
  include Users
31
32
  include Reports
32
33
  include Submissions
34
+ include Conversations
33
35
 
34
36
 
35
37
  # Override Footrest request for ApiArray support
@@ -0,0 +1,15 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ module Conversations
4
+
5
+ def create_conversation(params = {})
6
+ post("/api/v1/conversations", params)
7
+ end
8
+
9
+ def delete_conversation(conversation)
10
+ delete("/api/v1/conversations/#{conversation.to_s}")
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '0.9.7' unless defined?(Bearcat::VERSION)
2
+ VERSION = '0.9.8' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -0,0 +1,30 @@
1
+ require 'helper'
2
+
3
+ describe Bearcat::Client::Conversations do
4
+ before do
5
+ @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
6
+ end
7
+
8
+ context 'POST' do
9
+
10
+ it "creates a conversation" do
11
+ body = {recipients: %w(1), body: 'testing'}
12
+ stub_post(@client, "/api/v1/conversations").with(body: body).to_return(json_response("conversation.json"))
13
+ conversation = @client.create_conversation(body)
14
+ message = conversation.first['messages']
15
+ message.count.should == 1
16
+ message.first['body'].should == 'testing'
17
+ end
18
+ end
19
+
20
+ context 'DELETE' do
21
+
22
+ it "deletes a conversation" do
23
+ stub_delete(@client, "/api/v1/conversations/1").to_return(json_response("deleted_conversation.json"))
24
+ deleted_conversation = @client.delete_conversation("1")
25
+ deleted_conversation["id"].should == 1
26
+ deleted_conversation["message_count"].should == 0
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,64 @@
1
+ [
2
+ {
3
+ "id": 2,
4
+ "subject": null,
5
+ "workflow_state": "read",
6
+ "last_message": null,
7
+ "last_message_at": null,
8
+ "last_authored_message": "testing",
9
+ "last_authored_message_at": "2014-04-16T19:37:02Z",
10
+ "message_count": 1,
11
+ "subscribed": true,
12
+ "private": true,
13
+ "starred": false,
14
+ "properties": [
15
+ "last_author"
16
+ ],
17
+ "messages": [
18
+ {
19
+ "author_id": 1,
20
+ "body": "testing",
21
+ "created_at": "2014-04-16T19:37:02Z",
22
+ "generated": false,
23
+ "id": 3,
24
+ "forwarded_messages": [
25
+
26
+ ],
27
+ "attachments": [
28
+
29
+ ],
30
+ "media_comment": null,
31
+ "participating_user_ids": [
32
+ 1
33
+ ]
34
+ }
35
+ ],
36
+ "audience": [
37
+
38
+ ],
39
+ "audience_contexts": {
40
+ "courses": {
41
+
42
+ },
43
+ "groups": {
44
+
45
+ }
46
+ },
47
+ "avatar_url": "http://localhost:3000/images/thumbnails/1/mBD6J4naPCw2eAwfVEgZM1HzUSELnkednRPdw7MM",
48
+ "participants": [
49
+ {
50
+ "id": 1,
51
+ "name": "jake sorce",
52
+ "common_courses": {
53
+
54
+ },
55
+ "common_groups": {
56
+
57
+ },
58
+ "avatar_url": "http://localhost:3000/images/thumbnails/1/mBD6J4naPCw2eAwfVEgZM1HzUSELnkednRPdw7MM"
59
+ }
60
+ ],
61
+ "visible": false,
62
+ "context_code": null
63
+ }
64
+ ]
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": 1,
3
+ "subject": "conversations api example",
4
+ "workflow_state": "read",
5
+ "last_message": null,
6
+ "last_message_at": null,
7
+ "message_count": 0,
8
+ "subscribed": true,
9
+ "private": true,
10
+ "starred": false,
11
+ "properties": []
12
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bearcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills, Jake Sorce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -110,6 +110,7 @@ files:
110
110
  - lib/bearcat/client/accounts.rb
111
111
  - lib/bearcat/client/assignments.rb
112
112
  - lib/bearcat/client/conferences.rb
113
+ - lib/bearcat/client/conversations.rb
113
114
  - lib/bearcat/client/courses.rb
114
115
  - lib/bearcat/client/enrollments.rb
115
116
  - lib/bearcat/client/groups.rb
@@ -124,6 +125,7 @@ files:
124
125
  - spec/bearcat/client/accounts_spec.rb
125
126
  - spec/bearcat/client/assignments_spec.rb
126
127
  - spec/bearcat/client/conferences_spec.rb
128
+ - spec/bearcat/client/conversations_spec.rb
127
129
  - spec/bearcat/client/courses_spec.rb
128
130
  - spec/bearcat/client/enrollments_spec.rb
129
131
  - spec/bearcat/client/groups_spec.rb
@@ -143,6 +145,7 @@ files:
143
145
  - spec/fixtures/assignment_section_override.json
144
146
  - spec/fixtures/assignments.json
145
147
  - spec/fixtures/conclude_enrollment.json
148
+ - spec/fixtures/conversation.json
146
149
  - spec/fixtures/course.json
147
150
  - spec/fixtures/course_conferences.json
148
151
  - spec/fixtures/course_enrollments.json
@@ -157,6 +160,7 @@ files:
157
160
  - spec/fixtures/custom_food_data.json
158
161
  - spec/fixtures/delete_custom_data_scope.json
159
162
  - spec/fixtures/delete_section.json
163
+ - spec/fixtures/deleted_conversation.json
160
164
  - spec/fixtures/enroll_student.json
161
165
  - spec/fixtures/group_conferences.json
162
166
  - spec/fixtures/link_unlink_outcome.json
@@ -209,6 +213,7 @@ test_files:
209
213
  - spec/bearcat/client/accounts_spec.rb
210
214
  - spec/bearcat/client/assignments_spec.rb
211
215
  - spec/bearcat/client/conferences_spec.rb
216
+ - spec/bearcat/client/conversations_spec.rb
212
217
  - spec/bearcat/client/courses_spec.rb
213
218
  - spec/bearcat/client/enrollments_spec.rb
214
219
  - spec/bearcat/client/groups_spec.rb
@@ -228,6 +233,7 @@ test_files:
228
233
  - spec/fixtures/assignment_section_override.json
229
234
  - spec/fixtures/assignments.json
230
235
  - spec/fixtures/conclude_enrollment.json
236
+ - spec/fixtures/conversation.json
231
237
  - spec/fixtures/course.json
232
238
  - spec/fixtures/course_conferences.json
233
239
  - spec/fixtures/course_enrollments.json
@@ -242,6 +248,7 @@ test_files:
242
248
  - spec/fixtures/custom_food_data.json
243
249
  - spec/fixtures/delete_custom_data_scope.json
244
250
  - spec/fixtures/delete_section.json
251
+ - spec/fixtures/deleted_conversation.json
245
252
  - spec/fixtures/enroll_student.json
246
253
  - spec/fixtures/group_conferences.json
247
254
  - spec/fixtures/link_unlink_outcome.json