bearcat 0.9.14 → 0.9.15
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 +7 -0
- data/lib/bearcat/client.rb +2 -0
- data/lib/bearcat/client/calendar_events.rb +26 -0
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/calendar_events_spec.rb +75 -0
- data/spec/fixtures/calendar_event.json +33 -0
- data/spec/fixtures/calendar_events.json +64 -0
- metadata +22 -27
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: bb7b01c358bf88f7022d0d757bc836833e42b647
|
|
4
|
+
data.tar.gz: 2692cb4f5e9edd485b40df6b10e9fecf7dd0781d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f14f32fb6750344a9858d42565155a00ec8699241d941d316fb58be597bd4292d3e530ec59ed8227b9d2b48cf06e2b5fc6e16cd71a18a82af9596c6fc9dc660d
|
|
7
|
+
data.tar.gz: 3a0e046b1e5b384798a2e9e44623feed69d9cb44dc30ed3dde77ed6ecd08550c9275f052b71c48616f0aba3bdb641b36749b2af260302ab4e4ac3a3dd97e6d94
|
data/lib/bearcat/client.rb
CHANGED
|
@@ -18,6 +18,7 @@ module Bearcat
|
|
|
18
18
|
require 'bearcat/client/conversations'
|
|
19
19
|
require 'bearcat/client/modules'
|
|
20
20
|
require 'bearcat/client/canvas_files'
|
|
21
|
+
require 'bearcat/client/calendar_events'
|
|
21
22
|
|
|
22
23
|
include Assignments
|
|
23
24
|
include Accounts
|
|
@@ -35,6 +36,7 @@ module Bearcat
|
|
|
35
36
|
include Conversations
|
|
36
37
|
include Modules
|
|
37
38
|
include CanvasFiles
|
|
39
|
+
include CalendarEvents
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
# Override Footrest request for ApiArray support
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Bearcat
|
|
2
|
+
class Client < Footrest::Client
|
|
3
|
+
module CalendarEvents
|
|
4
|
+
|
|
5
|
+
def calendar_events(params = {})
|
|
6
|
+
get("/api/v1/calendar_events", params)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def calendar_event(event, params = {})
|
|
10
|
+
get("/api/v1/calendar_events/#{event}", params)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create_calendar_event(params = {})
|
|
14
|
+
post("/api/v1/calendar_events", params)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def update_calendar_event(event, params = {})
|
|
18
|
+
put("/api/v1/calendar_events/#{event}", params)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def delete_calendar_event(event, params = {})
|
|
22
|
+
delete("/api/v1/calendar_events/#{event}", params)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/bearcat/version.rb
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
describe Bearcat::Client::Conferences do
|
|
4
|
+
before do
|
|
5
|
+
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
context 'GET' do
|
|
9
|
+
it "lists calendar_events" do
|
|
10
|
+
stub_get(@client, "/api/v1/calendar_events").to_return(json_response("calendar_events.json"))
|
|
11
|
+
calendar_events = @client.calendar_events
|
|
12
|
+
calendar_events.count.should == 2
|
|
13
|
+
first_event = calendar_events.first
|
|
14
|
+
last_event = calendar_events.last
|
|
15
|
+
first_event['title'].should == "Paintball Fight!"
|
|
16
|
+
last_event['title'].should == "Bear Wrestling"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "gets a calendar_event" do
|
|
20
|
+
stub_get(@client, "/api/v1/calendar_events/234").to_return(json_response("calendar_event.json"))
|
|
21
|
+
event = @client.calendar_event(234).first
|
|
22
|
+
event['title'].should == "Paintball Fight!"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context 'POST' do
|
|
27
|
+
it "creates a calendar_event" do
|
|
28
|
+
body = {
|
|
29
|
+
id: "234",
|
|
30
|
+
title: "Paintball Fight!",
|
|
31
|
+
start_at: "2012-07-19T15:00:00-06:00",
|
|
32
|
+
end_at: "2012-07-19T16:00:00-06:00",
|
|
33
|
+
description: "<b>It's that time again!</b>",
|
|
34
|
+
location_name: "Greendale Community College",
|
|
35
|
+
location_address: "Greendale, Colorado",
|
|
36
|
+
context_code: "course_123",
|
|
37
|
+
all_day_date: "2012-07-19",
|
|
38
|
+
all_day: "false",
|
|
39
|
+
reserved: "false"
|
|
40
|
+
}
|
|
41
|
+
stub_post(@client, "/api/v1/calendar_events").with(body: body).to_return(json_response("calendar_event.json"))
|
|
42
|
+
event = @client.create_calendar_event(body).first
|
|
43
|
+
event['title'].should == "Paintball Fight!"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
context 'PUT' do
|
|
48
|
+
it "updates a calendar_event" do
|
|
49
|
+
body = {
|
|
50
|
+
id: "234",
|
|
51
|
+
title: "Paintball Fight!",
|
|
52
|
+
start_at: "2012-07-19T15:00:00-06:00",
|
|
53
|
+
end_at: "2012-07-19T16:00:00-06:00",
|
|
54
|
+
description: "<b>It's that time again!</b>",
|
|
55
|
+
location_name: "Greendale Community College",
|
|
56
|
+
location_address: "Greendale, Colorado",
|
|
57
|
+
context_code: "course_123",
|
|
58
|
+
all_day_date: "2012-07-19",
|
|
59
|
+
all_day: "false",
|
|
60
|
+
reserved: "false"
|
|
61
|
+
}
|
|
62
|
+
stub_put(@client, "/api/v1/calendar_events/234").with(body: body).to_return(json_response("calendar_event.json"))
|
|
63
|
+
event = @client.update_calendar_event(234, body).first
|
|
64
|
+
event['title'].should == "Paintball Fight!"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context 'DELETE' do
|
|
69
|
+
it "updates a calendar_event" do
|
|
70
|
+
stub_delete(@client, "/api/v1/calendar_events/234").to_return({})
|
|
71
|
+
event = @client.delete_calendar_event(234)
|
|
72
|
+
event.should == ""
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "234",
|
|
4
|
+
"title": "Paintball Fight!",
|
|
5
|
+
"start_at": "2012-07-19T15:00:00-06:00",
|
|
6
|
+
"end_at": "2012-07-19T16:00:00-06:00",
|
|
7
|
+
"description": "<b>It's that time again!</b>",
|
|
8
|
+
"location_name": "Greendale Community College",
|
|
9
|
+
"location_address": "Greendale, Colorado",
|
|
10
|
+
"context_code": "course_123",
|
|
11
|
+
"effective_context_code": "",
|
|
12
|
+
"workflow_state": "active",
|
|
13
|
+
"hidden": "false",
|
|
14
|
+
"parent_event_id": "",
|
|
15
|
+
"child_events_count": "0",
|
|
16
|
+
"child_events": "",
|
|
17
|
+
"url": "https://example.com/api/v1/calendar_events/234",
|
|
18
|
+
"html_url": "https://example.com/calendar?event_id=234&include_contexts=course_123",
|
|
19
|
+
"all_day_date": "2012-07-19",
|
|
20
|
+
"all_day": "false",
|
|
21
|
+
"created_at": "2012-07-12T10:55:20-06:00",
|
|
22
|
+
"updated_at": "2012-07-12T10:55:20-06:00",
|
|
23
|
+
"appointment_group_id": "",
|
|
24
|
+
"appointment_group_url": "",
|
|
25
|
+
"own_reservation": "false",
|
|
26
|
+
"reserve_url": "",
|
|
27
|
+
"reserved": "false",
|
|
28
|
+
"participants_per_appointment": "",
|
|
29
|
+
"available_slots": "",
|
|
30
|
+
"user": "",
|
|
31
|
+
"group": ""
|
|
32
|
+
}
|
|
33
|
+
]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "234",
|
|
4
|
+
"title": "Paintball Fight!",
|
|
5
|
+
"start_at": "2012-07-19T15:00:00-06:00",
|
|
6
|
+
"end_at": "2012-07-19T16:00:00-06:00",
|
|
7
|
+
"description": "<b>It's that time again!</b>",
|
|
8
|
+
"location_name": "Greendale Community College",
|
|
9
|
+
"location_address": "Greendale, Colorado",
|
|
10
|
+
"context_code": "course_123",
|
|
11
|
+
"effective_context_code": "",
|
|
12
|
+
"workflow_state": "active",
|
|
13
|
+
"hidden": "false",
|
|
14
|
+
"parent_event_id": "",
|
|
15
|
+
"child_events_count": "0",
|
|
16
|
+
"child_events": "",
|
|
17
|
+
"url": "https://example.com/api/v1/calendar_events/234",
|
|
18
|
+
"html_url": "https://example.com/calendar?event_id=234&include_contexts=course_123",
|
|
19
|
+
"all_day_date": "2012-07-19",
|
|
20
|
+
"all_day": "false",
|
|
21
|
+
"created_at": "2012-07-12T10:55:20-06:00",
|
|
22
|
+
"updated_at": "2012-07-12T10:55:20-06:00",
|
|
23
|
+
"appointment_group_id": "",
|
|
24
|
+
"appointment_group_url": "",
|
|
25
|
+
"own_reservation": "false",
|
|
26
|
+
"reserve_url": "",
|
|
27
|
+
"reserved": "false",
|
|
28
|
+
"participants_per_appointment": "",
|
|
29
|
+
"available_slots": "",
|
|
30
|
+
"user": "",
|
|
31
|
+
"group": ""
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "312",
|
|
35
|
+
"title": "Bear Wrestling",
|
|
36
|
+
"start_at": "2013-07-19T15:00:00-06:00",
|
|
37
|
+
"end_at": "2013-07-19T16:00:00-06:00",
|
|
38
|
+
"description": "<b>Bear!</b>",
|
|
39
|
+
"location_name": "Uinta Forest",
|
|
40
|
+
"location_address": "Utah",
|
|
41
|
+
"context_code": "course_234",
|
|
42
|
+
"effective_context_code": "",
|
|
43
|
+
"workflow_state": "active",
|
|
44
|
+
"hidden": "false",
|
|
45
|
+
"parent_event_id": "",
|
|
46
|
+
"child_events_count": 0,
|
|
47
|
+
"child_events": "",
|
|
48
|
+
"url": "https://example.com/api/v1/calendar_events/234",
|
|
49
|
+
"html_url": "https://example.com/calendar?event_id=234&include_contexts=course_123",
|
|
50
|
+
"all_day_date": "2012-07-19",
|
|
51
|
+
"all_day": "false",
|
|
52
|
+
"created_at": "2012-07-12T10:55:20-06:00",
|
|
53
|
+
"updated_at": "2012-07-12T10:55:20-06:00",
|
|
54
|
+
"appointment_group_id": "",
|
|
55
|
+
"appointment_group_url": "",
|
|
56
|
+
"own_reservation": "false",
|
|
57
|
+
"reserve_url": "",
|
|
58
|
+
"reserved": "false",
|
|
59
|
+
"participants_per_appointment": "",
|
|
60
|
+
"available_slots": "",
|
|
61
|
+
"user": "",
|
|
62
|
+
"group": ""
|
|
63
|
+
}
|
|
64
|
+
]
|
metadata
CHANGED
|
@@ -1,52 +1,46 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bearcat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.9.15
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Nathan Mills, Jake Sorce
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rake
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
|
-
- -
|
|
17
|
+
- - '>='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: '0'
|
|
22
20
|
type: :development
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
|
-
- -
|
|
24
|
+
- - '>='
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
26
|
version: '0'
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: bundler
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- -
|
|
31
|
+
- - '>='
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: 1.0.0
|
|
38
34
|
type: :development
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- -
|
|
38
|
+
- - '>='
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: 1.0.0
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: rspec
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
45
|
- - ~>
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
@@ -54,7 +48,6 @@ dependencies:
|
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
52
|
- - ~>
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
@@ -62,33 +55,29 @@ dependencies:
|
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: webmock
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
|
-
- -
|
|
59
|
+
- - '>='
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
61
|
version: '0'
|
|
70
62
|
type: :development
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
|
-
- -
|
|
66
|
+
- - '>='
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
77
68
|
version: '0'
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
|
79
70
|
name: footrest
|
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
72
|
requirements:
|
|
83
|
-
- -
|
|
73
|
+
- - '>='
|
|
84
74
|
- !ruby/object:Gem::Version
|
|
85
75
|
version: 0.2.2
|
|
86
76
|
type: :runtime
|
|
87
77
|
prerelease: false
|
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
79
|
requirements:
|
|
91
|
-
- -
|
|
80
|
+
- - '>='
|
|
92
81
|
- !ruby/object:Gem::Version
|
|
93
82
|
version: 0.2.2
|
|
94
83
|
description: Ruby interface for interacting with the canvas API
|
|
@@ -104,6 +93,7 @@ files:
|
|
|
104
93
|
- lib/bearcat/client/account_reports.rb
|
|
105
94
|
- lib/bearcat/client/accounts.rb
|
|
106
95
|
- lib/bearcat/client/assignments.rb
|
|
96
|
+
- lib/bearcat/client/calendar_events.rb
|
|
107
97
|
- lib/bearcat/client/canvas_files.rb
|
|
108
98
|
- lib/bearcat/client/conferences.rb
|
|
109
99
|
- lib/bearcat/client/conversations.rb
|
|
@@ -123,6 +113,7 @@ files:
|
|
|
123
113
|
- lib/bearcat.rb
|
|
124
114
|
- spec/bearcat/client/accounts_spec.rb
|
|
125
115
|
- spec/bearcat/client/assignments_spec.rb
|
|
116
|
+
- spec/bearcat/client/calendar_events_spec.rb
|
|
126
117
|
- spec/bearcat/client/canvas_files_spec.rb
|
|
127
118
|
- spec/bearcat/client/conferences_spec.rb
|
|
128
119
|
- spec/bearcat/client/conversations_spec.rb
|
|
@@ -146,6 +137,8 @@ files:
|
|
|
146
137
|
- spec/fixtures/assignment_section_override.json
|
|
147
138
|
- spec/fixtures/assignments.json
|
|
148
139
|
- spec/fixtures/bearcat.jpg
|
|
140
|
+
- spec/fixtures/calendar_event.json
|
|
141
|
+
- spec/fixtures/calendar_events.json
|
|
149
142
|
- spec/fixtures/canvas_files/declare_file.json
|
|
150
143
|
- spec/fixtures/canvas_files/upload_success.json
|
|
151
144
|
- spec/fixtures/conclude_enrollment.json
|
|
@@ -196,31 +189,31 @@ files:
|
|
|
196
189
|
- spec/helper.rb
|
|
197
190
|
homepage:
|
|
198
191
|
licenses: []
|
|
192
|
+
metadata: {}
|
|
199
193
|
post_install_message:
|
|
200
194
|
rdoc_options: []
|
|
201
195
|
require_paths:
|
|
202
196
|
- lib
|
|
203
197
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
|
-
none: false
|
|
205
198
|
requirements:
|
|
206
|
-
- -
|
|
199
|
+
- - '>='
|
|
207
200
|
- !ruby/object:Gem::Version
|
|
208
201
|
version: '0'
|
|
209
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
|
-
none: false
|
|
211
203
|
requirements:
|
|
212
|
-
- -
|
|
204
|
+
- - '>='
|
|
213
205
|
- !ruby/object:Gem::Version
|
|
214
206
|
version: '0'
|
|
215
207
|
requirements: []
|
|
216
208
|
rubyforge_project:
|
|
217
|
-
rubygems_version:
|
|
209
|
+
rubygems_version: 2.0.14
|
|
218
210
|
signing_key:
|
|
219
|
-
specification_version:
|
|
211
|
+
specification_version: 4
|
|
220
212
|
summary: Canvas API
|
|
221
213
|
test_files:
|
|
222
214
|
- spec/bearcat/client/accounts_spec.rb
|
|
223
215
|
- spec/bearcat/client/assignments_spec.rb
|
|
216
|
+
- spec/bearcat/client/calendar_events_spec.rb
|
|
224
217
|
- spec/bearcat/client/canvas_files_spec.rb
|
|
225
218
|
- spec/bearcat/client/conferences_spec.rb
|
|
226
219
|
- spec/bearcat/client/conversations_spec.rb
|
|
@@ -244,6 +237,8 @@ test_files:
|
|
|
244
237
|
- spec/fixtures/assignment_section_override.json
|
|
245
238
|
- spec/fixtures/assignments.json
|
|
246
239
|
- spec/fixtures/bearcat.jpg
|
|
240
|
+
- spec/fixtures/calendar_event.json
|
|
241
|
+
- spec/fixtures/calendar_events.json
|
|
247
242
|
- spec/fixtures/canvas_files/declare_file.json
|
|
248
243
|
- spec/fixtures/canvas_files/upload_success.json
|
|
249
244
|
- spec/fixtures/conclude_enrollment.json
|