Module: Bearcat::Client::OutcomeGroups
- Extended by:
- ClientModule
- Defined in:
- lib/bearcat/client/outcome_groups.rb
Constant Summary
ClientModule::ARG_REGEX
Instance Attribute Summary
Attributes included from ClientModule
#_registered_endpoints
Instance Method Summary
collapse
-
#create_outcome_in_group(outcome_group_id, params = {}) ⇒ Object
-
#create_subgroup(outcome_group_id, params = {}) ⇒ Object
-
#delete_outcome_group(outcome_group_id, params = {}) ⇒ Object
-
#import_outcome_group(outcome_group_id, params = {}) ⇒ Object
-
#link_outcome(outcome_group_id, outcome_id, params = {}) ⇒ Object
-
#list_linked_outcomes(outcome_group_id, params = {}) ⇒ Object
-
#list_subgroups(outcome_group_id, params = {}) ⇒ Object
-
#outcomes_context_slug(params) ⇒ Object
-
#show_outcome_group(outcome_group_id, params = {}) ⇒ Object
-
#unlink_outcome(outcome_group_id, outcome_id, params = {}) ⇒ Object
-
#update_outcome_group(outcome_group_id, params = {}) ⇒ Object
context_types, endpoint, prefix
Instance Method Details
#create_outcome_in_group(outcome_group_id, params = {}) ⇒ Object
22
23
24
|
# File 'lib/bearcat/client/outcome_groups.rb', line 22
def create_outcome_in_group(outcome_group_id, params={})
post("#{outcomes_context_slug(params)}#{outcome_group_id}/outcomes", params)
end
|
#create_subgroup(outcome_group_id, params = {}) ⇒ Object
38
39
40
|
# File 'lib/bearcat/client/outcome_groups.rb', line 38
def create_subgroup(outcome_group_id, params={})
post("#{outcomes_context_slug(params)}#{outcome_group_id}/subgroups", params)
end
|
#delete_outcome_group(outcome_group_id, params = {}) ⇒ Object
14
15
16
|
# File 'lib/bearcat/client/outcome_groups.rb', line 14
def delete_outcome_group(outcome_group_id, params={})
delete("#{outcomes_context_slug(params)}#{outcome_group_id}")
end
|
#import_outcome_group(outcome_group_id, params = {}) ⇒ Object
42
43
44
|
# File 'lib/bearcat/client/outcome_groups.rb', line 42
def import_outcome_group(outcome_group_id, params={})
post("#{outcomes_context_slug(params)}#{outcome_group_id}/import", params)
end
|
#link_outcome(outcome_group_id, outcome_id, params = {}) ⇒ Object
26
27
28
|
# File 'lib/bearcat/client/outcome_groups.rb', line 26
def link_outcome(outcome_group_id, outcome_id, params={})
put("#{outcomes_context_slug(params)}#{outcome_group_id}/outcomes/#{outcome_id}")
end
|
#list_linked_outcomes(outcome_group_id, params = {}) ⇒ Object
18
19
20
|
# File 'lib/bearcat/client/outcome_groups.rb', line 18
def list_linked_outcomes(outcome_group_id, params={})
get("#{outcomes_context_slug(params)}#{outcome_group_id}/outcomes")
end
|
#list_subgroups(outcome_group_id, params = {}) ⇒ Object
34
35
36
|
# File 'lib/bearcat/client/outcome_groups.rb', line 34
def list_subgroups(outcome_group_id, params={})
get("#{outcomes_context_slug(params)}#{outcome_group_id}/subgroups")
end
|
#outcomes_context_slug(params) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/bearcat/client/outcome_groups.rb', line 46
def outcomes_context_slug(params)
context_hash = params.select { |k, _| k == "account" || k == "course" }
if context_hash.keys.count > 1
raise ArgumentError, "cannot have account and course in params"
elsif context_hash.empty?
return "#{global_slug}"
else
context_hash_key = context_hash.keys.first
case context_hash_key
when 'account'
"#{account_slug(context_hash[context_hash_key])}"
when 'course'
"#{course_slug(context_hash[context_hash_key])}"
end
end
end
|
#show_outcome_group(outcome_group_id, params = {}) ⇒ Object
6
7
8
|
# File 'lib/bearcat/client/outcome_groups.rb', line 6
def show_outcome_group(outcome_group_id, params={})
get("#{outcomes_context_slug(params)}#{outcome_group_id}")
end
|
#unlink_outcome(outcome_group_id, outcome_id, params = {}) ⇒ Object
30
31
32
|
# File 'lib/bearcat/client/outcome_groups.rb', line 30
def unlink_outcome(outcome_group_id, outcome_id, params={})
delete("#{outcomes_context_slug(params)}#{outcome_group_id}/outcomes/#{outcome_id}")
end
|
#update_outcome_group(outcome_group_id, params = {}) ⇒ Object
10
11
12
|
# File 'lib/bearcat/client/outcome_groups.rb', line 10
def update_outcome_group(outcome_group_id, params={})
put("#{outcomes_context_slug(params)}#{outcome_group_id}", params)
end
|