agilix 0.4.0 → 0.6.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.
- checksums.yaml +4 -4
- data/README.md +178 -32
- data/lib/agilix.rb +3 -1
- data/lib/agilix/buzz/api.rb +29 -3
- data/lib/agilix/buzz/commands/authentication.rb +1 -1
- data/lib/agilix/buzz/commands/resource.rb +124 -0
- data/lib/agilix/buzz/commands/right.rb +234 -0
- data/lib/agilix/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81a67f3ba0539b370407f94da49a5fbdea63c2ac45c5fffb3a69c4cb9208ca0e
|
4
|
+
data.tar.gz: 4d64c6cccca91106f9cbaa00bca53a1f84aefef256da03d2c14fc2f0fb3c2040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aca52f340f374f9c5a44fb8cefcc578079262046dc3c7ae9e770640a3cbec1ffd20c881bbe42d7a1c9a52f90779f3843239ccff27254e06ad699d73e6f3fc88e
|
7
|
+
data.tar.gz: 10ab8c6c4b7bc330d27191f9c425bdac78af13ff52da05d4a91bc21382cb9f4ada27b537933fc3a4b8643898aff884d38296181e0e03cfc3b0902dbd2a895eed
|
data/README.md
CHANGED
@@ -63,43 +63,53 @@ Below are instructions for basic invocation of the api methods. For additional i
|
|
63
63
|
```
|
64
64
|
api.create_domains [{name: "BuzzTest1", userspace: 'buzz-test-fc-1', parentid: '57025'}]
|
65
65
|
```
|
66
|
+
|
66
67
|
#### [DeleteDomain](https://api.agilixbuzz.com/docs/#!/Command/DeleteDomain)
|
67
68
|
```
|
68
69
|
api.delete_domain domainid: '57027'
|
69
70
|
```
|
71
|
+
|
70
72
|
#### [GetDomain2](https://api.agilixbuzz.com/docs/#!/Command/GetDomain2)
|
71
73
|
This is aliased to `get_domain`
|
72
74
|
```
|
73
75
|
api.get_domain domainid: '57025'
|
74
76
|
```
|
77
|
+
|
75
78
|
#### [GetDomainContent](https://api.agilixbuzz.com/docs/#!/Command/GetDomainContent)
|
76
79
|
```
|
77
80
|
api.get_domain_content domainid: '57025'
|
78
81
|
```
|
82
|
+
|
79
83
|
#### [GetDomainEnrollmentMetrics](https://api.agilixbuzz.com/docs/#!/Command/GetDomainEnrollmentMetrics)
|
80
84
|
```
|
81
85
|
api.get_domain_enrollment_metrics domainid: '57025'
|
82
86
|
```
|
87
|
+
|
83
88
|
#### [GetDomainParentList](https://api.agilixbuzz.com/docs/#!/Command/GetDomainParentList)
|
84
89
|
```
|
85
90
|
api.get_domain_parent_list domainid: '57025'
|
86
91
|
```
|
92
|
+
|
87
93
|
#### [GetDomainSettings](https://api.agilixbuzz.com/docs/#!/Command/GetDomainSettings)
|
88
94
|
```
|
89
95
|
api.get_domain_settings domainid: '57025', path: "AgilixBuzzSettings.xml"
|
90
96
|
```
|
97
|
+
|
91
98
|
#### [GetDomainStats](https://api.agilixbuzz.com/docs/#!/Command/GetDomainStats)
|
92
99
|
```
|
93
100
|
api.get_domain_stats domainid: '57025', options: "users|courses"
|
94
101
|
```
|
102
|
+
|
95
103
|
#### [ListDomains](https://api.agilixbuzz.com/docs/#!/Command/ListDomains)
|
96
104
|
```
|
97
105
|
api.list_domains domainid: '57025'
|
98
106
|
```
|
107
|
+
|
99
108
|
#### [RestoreDomain](https://api.agilixbuzz.com/docs/#!/Command/RestoreDomain)
|
100
109
|
```
|
101
110
|
api.restore_domain domainid: '57027'
|
102
111
|
```
|
112
|
+
|
103
113
|
#### [UpdateDomains](https://api.agilixbuzz.com/docs/#!/Command/UpdateDomains)
|
104
114
|
```
|
105
115
|
api.update_domains [{ domainid: "57027", name: "BuzzTestUpdated1", userspace: 'buzz-test-fc-1', parentid: '57025'}]
|
@@ -113,14 +123,17 @@ api.update_domains [{ domainid: "57027", name: "BuzzTestUpdated1", userspace: 'b
|
|
113
123
|
```
|
114
124
|
api.get_report_info reportid: 127
|
115
125
|
```
|
126
|
+
|
116
127
|
#### [GetReportList](https://api.agilixbuzz.com/docs/#!/Command/GetReportList)
|
117
128
|
```
|
118
129
|
api.get_report_list domainid: 1
|
119
130
|
```
|
131
|
+
|
120
132
|
#### [GetRunnableReportList](https://api.agilixbuzz.com/docs/#!/Command/GetRunnableReportList)
|
121
133
|
```
|
122
134
|
api.get_runnable_report_list domainid: 57025
|
123
135
|
```
|
136
|
+
|
124
137
|
#### [RunReport](https://api.agilixbuzz.com/docs/#!/Command/RunReport)
|
125
138
|
```
|
126
139
|
api.run_report reportid: 127, entityid: 57025, format: 'json'
|
@@ -284,6 +297,7 @@ proxy_api.unproxy userid: 57181
|
|
284
297
|
```
|
285
298
|
api.reset_lockout userid: 57181
|
286
299
|
```
|
300
|
+
|
287
301
|
#### [ResetPassword](https://api.agilixbuzz.com/docs/#!/Command/ResetPassword)
|
288
302
|
```
|
289
303
|
api.reset_password username:'auto-tests/BuzzUserUp1'
|
@@ -498,26 +512,172 @@ This is one of the more confusing APIs, it allows you to send emails to people i
|
|
498
512
|
api.send_mail subject: "Test email", body: "Did you get this?", enrollmentid: 60997, enrollment_ids: ["all"]
|
499
513
|
```
|
500
514
|
|
515
|
+
## Resources
|
516
|
+
|
517
|
+
|
518
|
+
#### [CopyResources](https://api.agilixbuzz.com/docs/#!/Command/CopyResources)
|
519
|
+
|
520
|
+
```
|
521
|
+
api.copy_resources [ {sourceentityid: 57025, destinationentityid: 57031, sourcepath: "banner.css" }]
|
522
|
+
```
|
523
|
+
|
524
|
+
#### [DeleteResources](https://api.agilixbuzz.com/docs/#!/Command/DeleteResources)
|
525
|
+
|
526
|
+
```
|
527
|
+
api.delete_resources [{entityid: 57031, path: 'banner.css'}]
|
528
|
+
```
|
529
|
+
|
530
|
+
#### [GetEntityResourceId](https://api.agilixbuzz.com/docs/#!/Command/GetEntityResourceId)
|
531
|
+
|
532
|
+
```
|
533
|
+
api.get_entity_resource_id entityid: 57025
|
534
|
+
```
|
535
|
+
|
536
|
+
#### [GetResource](https://api.agilixbuzz.com/docs/#!/Command/GetResource)
|
537
|
+
|
538
|
+
```
|
539
|
+
api.get_resource entityid: 57031, path: "banner.css"
|
540
|
+
```
|
541
|
+
|
542
|
+
#### [GetResourceInfo2](https://api.agilixbuzz.com/docs/#!/Command/GetResourceInfo2)
|
543
|
+
|
544
|
+
ISSUE: This is a get request with a POST verb. The documentation only suggests getting a single resoure, so I'm not sure why it would be a bulk post syntax. it does seem to respond to multiple resources though,so we'll adapt
|
545
|
+
|
546
|
+
```
|
547
|
+
api.get_resource_info [{entityid: 57031, path: "banner.css"}]
|
548
|
+
```
|
549
|
+
|
550
|
+
#### [GetResourceList2](https://api.agilixbuzz.com/docs/#!/Command/GetResourceList2)
|
551
|
+
|
552
|
+
```
|
553
|
+
api.get_resource_list entityid: 57025
|
554
|
+
```
|
555
|
+
|
556
|
+
#### [ListRestorableResources](https://api.agilixbuzz.com/docs/#!/Command/ListRestorableResources)
|
557
|
+
|
558
|
+
```
|
559
|
+
api.list_restorable_resources entityid: 57025
|
560
|
+
```
|
561
|
+
|
562
|
+
#### [PutResource](https://api.agilixbuzz.com/docs/#!/Command/PutResource)
|
563
|
+
|
564
|
+
```
|
565
|
+
file_name = "my-file.pdf"
|
566
|
+
file = File.open file_name
|
567
|
+
api.put_resource file, {entityid: 57025, path: file_name}
|
568
|
+
```
|
569
|
+
|
570
|
+
#### [PutResourceFolders](https://api.agilixbuzz.com/docs/#!/Command/PutResourceFolders)
|
571
|
+
|
572
|
+
```
|
573
|
+
api.put_resource_folders [{entityid: 57031, path: 'test/folder-1'}]
|
574
|
+
```
|
575
|
+
|
576
|
+
#### [RestoreResources](https://api.agilixbuzz.com/docs/#!/Command/RestoreResources)
|
577
|
+
|
578
|
+
```
|
579
|
+
api.restore_resources [{entityid: 57031, path: 'banner.css'}]
|
580
|
+
```
|
581
|
+
|
582
|
+
|
501
583
|
## Rights
|
502
584
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
585
|
+
#### [CreateRole](https://api.agilixbuzz.com/docs/#!/Command/CreateRole)
|
586
|
+
ISSUE: Why is this create singular, not multiple?
|
587
|
+
```
|
588
|
+
api.create_role domainid: 57025, name: "Test Role", privileges: api.right_flags[:create_domain]
|
589
|
+
```
|
590
|
+
|
591
|
+
#### [DeleteRole](https://api.agilixbuzz.com/docs/#!/Command/DeleteRole)
|
592
|
+
```
|
593
|
+
api.delete_role roleid: 61316
|
594
|
+
```
|
595
|
+
|
596
|
+
#### [DeleteSubscriptions](https://api.agilixbuzz.com/docs/#!/Command/DeleteSubscriptions)
|
597
|
+
ISSUE: Why is this create singular, not multiple?
|
598
|
+
```
|
599
|
+
api.delete_subscriptions subscriberid: 57181, entityid: 57025
|
600
|
+
```
|
601
|
+
|
602
|
+
#### [GetActorRights](https://api.agilixbuzz.com/docs/#!/Command/GetActorRights)
|
603
|
+
ISSUE: Why is this create singular, not multiple?
|
604
|
+
```
|
605
|
+
api.create_role domainid: 57025, name: "Test Role", privileges: api.right_flags[:create_domain]
|
606
|
+
```
|
607
|
+
|
608
|
+
#### [GetEffectiveRights](https://api.agilixbuzz.com/docs/#!/Command/GetEffectiveRights)
|
609
|
+
```
|
610
|
+
api.get_effective_rights entityid: 57025
|
611
|
+
```
|
612
|
+
|
613
|
+
#### [GetEffectiveSubscriptionList](https://api.agilixbuzz.com/docs/#!/Command/GetEffectiveSubscriptionList)
|
614
|
+
```
|
615
|
+
api.get_effective_subscription_list
|
616
|
+
```
|
617
|
+
|
618
|
+
#### [GetEntityRights](https://api.agilixbuzz.com/docs/#!/Command/GetEntityRights)
|
619
|
+
```
|
620
|
+
api.get_entity_rights entityid: 57025
|
621
|
+
```
|
622
|
+
|
623
|
+
#### [GetEntitySubscriptionList](https://api.agilixbuzz.com/docs/#!/Command/GetEntitySubscriptionList)
|
624
|
+
```
|
625
|
+
api.get_entity_subscription_list entityid: 57025
|
626
|
+
```
|
627
|
+
|
628
|
+
#### [GetPersonas](https://api.agilixbuzz.com/docs/#!/Command/GetPersonas)
|
629
|
+
```
|
630
|
+
api.get_personas userid: 57026
|
631
|
+
```
|
632
|
+
|
633
|
+
#### [GetRights](https://api.agilixbuzz.com/docs/#!/Command/GetRights)
|
634
|
+
```
|
635
|
+
api.get_rights actorid: 57026, entityid: 57025
|
636
|
+
```
|
637
|
+
|
638
|
+
#### [GetRightsList](https://api.agilixbuzz.com/docs/#!/Command/GetRightsList)
|
639
|
+
```
|
640
|
+
api.get_rights_list domainid: 57025
|
641
|
+
```
|
642
|
+
|
643
|
+
#### [GetRole](https://api.agilixbuzz.com/docs/#!/Command/GetRole)
|
644
|
+
```
|
645
|
+
api.get_role roleid: 61316
|
646
|
+
```
|
647
|
+
|
648
|
+
#### [GetSubscriptionList](https://api.agilixbuzz.com/docs/#!/Command/GetSubscriptionList)
|
649
|
+
```
|
650
|
+
# Get for a domain
|
651
|
+
api.get_subscription_list subscriberid: 57025
|
652
|
+
# Get for a user
|
653
|
+
api.get_subscription_list subscriberid: 57026
|
654
|
+
```
|
655
|
+
|
656
|
+
#### [ListRoles](https://api.agilixbuzz.com/docs/#!/Command/ListRoles)
|
657
|
+
```
|
658
|
+
api.list_roles domainid: 57025
|
659
|
+
```
|
660
|
+
|
661
|
+
#### [RestoreRole](https://api.agilixbuzz.com/docs/#!/Command/RestoreRole)
|
662
|
+
```
|
663
|
+
api.restore_role roleid: 61316
|
664
|
+
```
|
665
|
+
|
666
|
+
#### [UpdateRights](https://api.agilixbuzz.com/docs/#!/Command/UpdateRights)
|
667
|
+
```
|
668
|
+
api.update_rights [ {actorid: 57026, entityid: 57025, roleid: 61316}]
|
669
|
+
```
|
670
|
+
|
671
|
+
#### [UpdateRole](https://api.agilixbuzz.com/docs/#!/Command/UpdateRole)
|
672
|
+
```
|
673
|
+
api.update_role roleid: 61316, name: "Test Role Updates", privileges: api.right_flags[:update_domain]
|
674
|
+
```
|
675
|
+
|
676
|
+
#### [UpdateSubscriptions](https://api.agilixbuzz.com/docs/#!/Command/UpdateSubscriptions)
|
677
|
+
ISSUE: Why is this root node singular?
|
678
|
+
```
|
679
|
+
api.update_subscriptions subscriberid: 57181, entityid: 60982, startdate: "2019-03-15", enddate: "2019-03-15"
|
680
|
+
```
|
521
681
|
|
522
682
|
---
|
523
683
|
|
@@ -575,22 +735,11 @@ api.send_mail subject: "Test email", body: "Did you get this?", enrollmentid: 60
|
|
575
735
|
|
576
736
|
## Resources
|
577
737
|
|
578
|
-
- [ ] [CopyResources](https://api.agilixbuzz.com/docs/#!/Command/CopyResources)
|
579
738
|
- [ ] [DeleteDocuments](https://api.agilixbuzz.com/docs/#!/Command/DeleteDocuments)
|
580
|
-
- [ ] [DeleteResources](https://api.agilixbuzz.com/docs/#!/Command/DeleteResources)
|
581
739
|
- [ ] [GetDocument](https://api.agilixbuzz.com/docs/#!/Command/GetDocument)
|
582
740
|
- [ ] [GetDocumentInfo](https://api.agilixbuzz.com/docs/#!/Command/GetDocumentInfo)
|
583
|
-
- [ ] [GetEntityResourceId](https://api.agilixbuzz.com/docs/#!/Command/GetEntityResourceId)
|
584
|
-
- [ ] [GetResource](https://api.agilixbuzz.com/docs/#!/Command/GetResource)
|
585
|
-
- [ ] [GetResourceInfo2](https://api.agilixbuzz.com/docs/#!/Command/GetResourceInfo2)
|
586
|
-
- [ ] [GetResourceList2](https://api.agilixbuzz.com/docs/#!/Command/GetResourceList2)
|
587
741
|
- [ ] [ListRestorableDocuments](https://api.agilixbuzz.com/docs/#!/Command/ListRestorableDocuments)
|
588
|
-
- [ ] [ListRestorableResources](https://api.agilixbuzz.com/docs/#!/Command/ListRestorableResources)
|
589
|
-
- [ ] [PutResource](https://api.agilixbuzz.com/docs/#!/Command/PutResource)
|
590
|
-
- [ ] [PutResourceFolders](https://api.agilixbuzz.com/docs/#!/Command/PutResourceFolders)
|
591
742
|
- [ ] [RestoreDocuments](https://api.agilixbuzz.com/docs/#!/Command/RestoreDocuments)
|
592
|
-
- [ ] [RestoreResources](https://api.agilixbuzz.com/docs/#!/Command/RestoreResources)
|
593
|
-
|
594
743
|
---
|
595
744
|
|
596
745
|
# Not Prioritized
|
@@ -804,6 +953,3 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
804
953
|
## Code of Conduct
|
805
954
|
|
806
955
|
Everyone interacting in the Agilix::Buzz project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/agilix/blob/master/CODE_OF_CONDUCT.md).
|
807
|
-
|
808
|
-
|
809
|
-
|
data/lib/agilix.rb
CHANGED
@@ -9,6 +9,8 @@ require "agilix/buzz/commands/domain"
|
|
9
9
|
require "agilix/buzz/commands/enrollment"
|
10
10
|
require "agilix/buzz/commands/general"
|
11
11
|
require "agilix/buzz/commands/report"
|
12
|
+
require "agilix/buzz/commands/resource"
|
13
|
+
require "agilix/buzz/commands/right"
|
12
14
|
require "agilix/buzz/commands/user"
|
13
15
|
|
14
16
|
require "agilix/buzz/api"
|
@@ -23,6 +25,6 @@ module Agilix
|
|
23
25
|
super
|
24
26
|
end
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
end
|
28
30
|
end
|
data/lib/agilix/buzz/api.rb
CHANGED
@@ -11,6 +11,8 @@ module Agilix
|
|
11
11
|
include Agilix::Buzz::Commands::Enrollment
|
12
12
|
include Agilix::Buzz::Commands::General
|
13
13
|
include Agilix::Buzz::Commands::Report
|
14
|
+
include Agilix::Buzz::Commands::Resource
|
15
|
+
include Agilix::Buzz::Commands::Right
|
14
16
|
include Agilix::Buzz::Commands::User
|
15
17
|
|
16
18
|
attr_accessor :username, :password, :domain, :token, :token_expiration
|
@@ -51,14 +53,38 @@ module Agilix
|
|
51
53
|
response = self.class.post(URL_BASE, body: modify_body(query), timeout: 60, headers: headers)
|
52
54
|
end
|
53
55
|
|
54
|
-
#
|
56
|
+
# Not sure if I want to use this yet
|
57
|
+
# api.response_parser response: response, path_to_parse: ['response', 'users', 'user'], collection_name: 'users'
|
58
|
+
def response_parser(path_to_parse: nil, collection_name: nil, response: )
|
59
|
+
if path_to_parse
|
60
|
+
result = response.dig(*path_to_parse)
|
61
|
+
ostruct = JSON::parse({collection_name => result}.to_json, object_class: OpenStruct)
|
62
|
+
ostruct.result_count = result.size
|
63
|
+
ostruct.collection_name = collection_name
|
64
|
+
else
|
65
|
+
ostruct = JSON::parse(response.body, object_class: OpenStruct)
|
66
|
+
end
|
67
|
+
ostruct.code = response['code']
|
68
|
+
ostruct.response = response
|
69
|
+
ostruct.request = request
|
70
|
+
ostruct
|
71
|
+
end
|
72
|
+
|
73
|
+
# For when the api is super unconventional & you need to modify both query params & body params in a custom fashion, and upload a file even!
|
55
74
|
def query_post(query = {})
|
56
75
|
url = URL_BASE
|
57
76
|
query_params = query.delete(:query_params)
|
58
77
|
if query_params
|
59
78
|
url += "?&_token=#{token}" + query_params.map {|k,v| "&#{k}=#{v}" }.join("")
|
60
79
|
end
|
61
|
-
|
80
|
+
file = query.delete(:file)
|
81
|
+
if file
|
82
|
+
new_headers = headers
|
83
|
+
new_headers["Content-Type"] = "multipart/form-data"
|
84
|
+
response = self.class.post(url, multipart: true, body: {file: file}, timeout: 60, headers: new_headers)
|
85
|
+
else
|
86
|
+
response = self.class.post(url, body: query.to_json, timeout: 60, headers: headers)
|
87
|
+
end
|
62
88
|
end
|
63
89
|
|
64
90
|
def bulk_post(query = {})
|
@@ -118,7 +144,7 @@ module Agilix
|
|
118
144
|
end
|
119
145
|
|
120
146
|
def headers
|
121
|
-
{
|
147
|
+
@headers = {
|
122
148
|
"Accept" => "application/json",
|
123
149
|
"Content-Type" => "application/json",
|
124
150
|
}
|
@@ -23,7 +23,7 @@ module Agilix
|
|
23
23
|
def extend_session
|
24
24
|
response = authenticated_post cmd: "extendsession", bypass_authentication_check: true
|
25
25
|
@token_expiration = set_token_expiration(response.dig("response", "session", "authenticationexpirationminutes"))
|
26
|
-
authenticate! if response
|
26
|
+
authenticate! if response.dig("response", "code") == "NoAuthentication"
|
27
27
|
response
|
28
28
|
end
|
29
29
|
|
@@ -0,0 +1,124 @@
|
|
1
|
+
module Agilix
|
2
|
+
module Buzz
|
3
|
+
module Commands
|
4
|
+
module Resource
|
5
|
+
|
6
|
+
# api.copy_resources [ {sourceentityid: 57025, destinationentityid: 57031, sourcepath: "banner.css" }]
|
7
|
+
def copy_resources(items = [])
|
8
|
+
options = items.map do |item|
|
9
|
+
argument_cleaner(required_params: %i( sourceentityid destinationentityid ), optional_params: %i( sourcepath destinationpath ), options: item )
|
10
|
+
end
|
11
|
+
authenticated_bulk_post cmd: "copyresources", root_node: "resource", body: options
|
12
|
+
end
|
13
|
+
|
14
|
+
# api.delete_resources [{entityid: 57031, path: 'banner.css'}]
|
15
|
+
def delete_resources(items = [])
|
16
|
+
options = items.map do |item|
|
17
|
+
argument_cleaner(required_params: %i( entityid path ), optional_params: %i( class ), options: item )
|
18
|
+
end
|
19
|
+
authenticated_bulk_post cmd: "deleteresources", root_node: "resource", body: options
|
20
|
+
end
|
21
|
+
|
22
|
+
# api.get_entity_resource_id entityid: 57025
|
23
|
+
def get_entity_resource_id(options = {})
|
24
|
+
options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: options )
|
25
|
+
authenticated_get cmd: "getentityresourceid", **options
|
26
|
+
end
|
27
|
+
|
28
|
+
# api.get_resource entityid: 57031, path: "banner.css"
|
29
|
+
def get_resource(options = {})
|
30
|
+
options = argument_cleaner(required_params: %i( entityid path ), optional_params: %i( version packagetype attachment class ), options: options )
|
31
|
+
authenticated_get cmd: "getresource", **options
|
32
|
+
end
|
33
|
+
|
34
|
+
# ISSUE: This is a get request with a POST verb. The documentation only suggests getting a single resoure, so I'm not sure why it would be a bulk post syntax. it does seem to respond to multiple resources though,so we'll adapt
|
35
|
+
# api.get_resource_info [{entityid: 57031, path: "banner.css"}]
|
36
|
+
def get_resource_info2(items = [])
|
37
|
+
options = items.map do |item|
|
38
|
+
argument_cleaner(required_params: %i( entityid path ), optional_params: %i( class ), options: item )
|
39
|
+
end
|
40
|
+
authenticated_bulk_post cmd: "getresourceinfo2", root_node: "resource", body: options
|
41
|
+
end
|
42
|
+
alias_method :get_resource_info, :get_resource_info2
|
43
|
+
|
44
|
+
# api.get_resource_list2 entityid: 57025
|
45
|
+
def get_resource_list2(options = {})
|
46
|
+
options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( path recurse query allversions entries class ), options: options )
|
47
|
+
authenticated_get cmd: "getresourcelist2", **options
|
48
|
+
end
|
49
|
+
alias_method :get_resource_list, :get_resource_list2
|
50
|
+
|
51
|
+
# api.list_restorable_resources entityid: 57025
|
52
|
+
def list_restorable_resources(options = {})
|
53
|
+
options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: options )
|
54
|
+
authenticated_get cmd: "listrestorableresources", **options
|
55
|
+
end
|
56
|
+
|
57
|
+
# file_name = "my-file.pdf"
|
58
|
+
# file = File.open file_name
|
59
|
+
# api.put_resource file, {entityid: 57025, path: file_name}
|
60
|
+
def put_resource(file, options = {})
|
61
|
+
options = argument_cleaner(required_params: %i( entityid path ), optional_params: %i( status class drophistory contenttype ), options: options )
|
62
|
+
# authenticated_query_post cmd: "putresource", **options
|
63
|
+
authenticated_query_post query_params: {cmd: "putresource", **options }, file: file
|
64
|
+
end
|
65
|
+
|
66
|
+
# api.put_resource_folders [{entityid: 57031, path: 'test/folder-1'}]
|
67
|
+
def put_resource_folders(items = [])
|
68
|
+
options = items.map do |item|
|
69
|
+
argument_cleaner(required_params: %i( entityid path ), optional_params: %i( ), options: item )
|
70
|
+
end
|
71
|
+
authenticated_bulk_post cmd: "putresourcefolders", root_node: "folder", body: options
|
72
|
+
end
|
73
|
+
|
74
|
+
# api.restore_resources [{entityid: 57031, path: 'banner.css'}]
|
75
|
+
def restore_resources(items = [])
|
76
|
+
options = items.map do |item|
|
77
|
+
argument_cleaner(required_params: %i( entityid path ), optional_params: %i( class ), options: item )
|
78
|
+
end
|
79
|
+
authenticated_bulk_post cmd: "restoreresources", root_node: "resource", body: options
|
80
|
+
end
|
81
|
+
|
82
|
+
# api.delete_documents
|
83
|
+
def delete_documents(items = [])
|
84
|
+
options = items.map do |item|
|
85
|
+
argument_cleaner(required_params: %i( enrollmentid itemid path ), optional_params: %i( ), options: item )
|
86
|
+
end
|
87
|
+
authenticated_bulk_post cmd: "deletedocuments", root_node: "document", body: options
|
88
|
+
end
|
89
|
+
|
90
|
+
# api.get_document enrollmentid: 60997
|
91
|
+
def get_document(options = {})
|
92
|
+
options = argument_cleaner(required_params: %i( enrollmentid itemid path ), optional_params: %i( version ), options: options )
|
93
|
+
authenticated_get cmd: "getdocument", **options
|
94
|
+
end
|
95
|
+
|
96
|
+
# ISSUE: Why is get command a bulk POST request
|
97
|
+
# api.get_document_info
|
98
|
+
def get_document_info(items = [])
|
99
|
+
options = items.map do |item|
|
100
|
+
argument_cleaner(required_params: %i( enrollmentid itemid path ), optional_params: %i( ), options: item )
|
101
|
+
end
|
102
|
+
authenticated_bulk_post cmd: "getdocumentinfo", root_node: "document", body: options
|
103
|
+
authenticated_get cmd: "", **options
|
104
|
+
end
|
105
|
+
|
106
|
+
# api.list_restorable_documents enrollmentid: 64001
|
107
|
+
def list_restorable_documents(options = {})
|
108
|
+
options = argument_cleaner(required_params: %i( enrollmentid itemid ), optional_params: %i( ), options: options )
|
109
|
+
authenticated_get cmd: "listrestorabledocuments", **options
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
# api.restore_documents
|
114
|
+
def restore_documents(items = [])
|
115
|
+
options = items.map do |item|
|
116
|
+
argument_cleaner(required_params: %i( enrollmentid itemid path), optional_params: %i( version ), options: item )
|
117
|
+
end
|
118
|
+
authenticated_bulk_post cmd: "restoredocuments", root_node: "document", body: options
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
module Agilix
|
2
|
+
module Buzz
|
3
|
+
module Commands
|
4
|
+
module Right
|
5
|
+
|
6
|
+
# ISSUE: Why is this create singular, not multiple?
|
7
|
+
# api.create_role domainid: 57025, name: "Test Role", privileges: api.right_flags[:create_domain]
|
8
|
+
def create_role(options = {})
|
9
|
+
options = argument_cleaner(required_params: %i( domainid name privileges ), optional_params: %i( reference entitytype ), options: options )
|
10
|
+
raise ArgumentError.new("Not a valid entitytype. Should be D,C, or empty") unless [nil, "", "D", "C"].include?(options[:entitytype])
|
11
|
+
authenticated_post cmd: "createrole", **options
|
12
|
+
end
|
13
|
+
|
14
|
+
# api.delete_role roleid: 61316
|
15
|
+
def delete_role(options = {})
|
16
|
+
options = argument_cleaner(required_params: %i( roleid ), optional_params: %i( ), options: options )
|
17
|
+
authenticated_get cmd: "deleterole", **options
|
18
|
+
end
|
19
|
+
|
20
|
+
# api.delete_subscriptions subscriberid: 57181, entityid: 57025
|
21
|
+
def delete_subscriptions(items = [])
|
22
|
+
options = items.map do |item|
|
23
|
+
argument_cleaner(required_params: %i( subscriberid entityid ), optional_params: %i( flags ), options: item )
|
24
|
+
end
|
25
|
+
authenticated_bulk_post cmd: "deletesubscriptions", root_node: 'subscription', body: options
|
26
|
+
end
|
27
|
+
|
28
|
+
# api.get_actor_rights actorid: 5000, entitytypes: "U|S|D"
|
29
|
+
def get_actor_rights(options = {})
|
30
|
+
options = argument_cleaner(required_params: %i( actorid ), optional_params: %i( entitytypes ), options: options )
|
31
|
+
authenticated_get cmd: "getactorrights", **options
|
32
|
+
end
|
33
|
+
|
34
|
+
# api.get_effective_rights entityid: 57025
|
35
|
+
def get_effective_rights(options = {})
|
36
|
+
options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: options )
|
37
|
+
authenticated_get cmd: "geteffectiverights", **options
|
38
|
+
end
|
39
|
+
|
40
|
+
# api.get_effective_subscription_list
|
41
|
+
def get_effective_subscription_list(options = {})
|
42
|
+
options = argument_cleaner(required_params: %i( ), optional_params: %i( select ), options: options )
|
43
|
+
authenticated_get cmd: "geteffectivesubscriptionlist", **options
|
44
|
+
end
|
45
|
+
|
46
|
+
# api.get_entity_rights entityid: 57025
|
47
|
+
def get_entity_rights(options = {})
|
48
|
+
options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: options )
|
49
|
+
authenticated_get cmd: "getentityrights", **options
|
50
|
+
end
|
51
|
+
|
52
|
+
# api.get_entity_subscription_list entityid: 57025
|
53
|
+
def get_entity_subscription_list(options = {})
|
54
|
+
options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( subscriberid), options: options )
|
55
|
+
authenticated_get cmd: "getentitysubscriptionlist", **options
|
56
|
+
end
|
57
|
+
|
58
|
+
# api.get_personas userid: 57026
|
59
|
+
def get_personas(options = {})
|
60
|
+
options = argument_cleaner(required_params: %i( ), optional_params: %i( userid domainid ), options: options )
|
61
|
+
authenticated_get cmd: "getpersonas", **options
|
62
|
+
end
|
63
|
+
|
64
|
+
# api.get_rights actorid: 57026, entityid: 57025
|
65
|
+
def get_rights(options = {})
|
66
|
+
options = argument_cleaner(required_params: %i( actorid entityid ), optional_params: %i( ), options: options )
|
67
|
+
authenticated_get cmd: "getrights", **options
|
68
|
+
end
|
69
|
+
|
70
|
+
# api.get_rights_list domainid: 57025
|
71
|
+
def get_rights_list(options = {})
|
72
|
+
options = argument_cleaner(required_params: %i( ), optional_params: %i( domainid restrictdomain ), options: options )
|
73
|
+
authenticated_get cmd: "getrightslist", **options
|
74
|
+
end
|
75
|
+
|
76
|
+
# api.get_role roleid: 61316
|
77
|
+
def get_role(options = {})
|
78
|
+
options = argument_cleaner(required_params: %i( roleid ), optional_params: %i( ), options: options )
|
79
|
+
authenticated_get cmd: "getrole", **options
|
80
|
+
end
|
81
|
+
|
82
|
+
# Get for a domain
|
83
|
+
# api.get_subscription_list subscriberid: 57025
|
84
|
+
# Get for a user
|
85
|
+
# api.get_subscription_list subscriberid: 57026
|
86
|
+
def get_subscription_list(options = {})
|
87
|
+
options = argument_cleaner(required_params: %i( subscriberid ), optional_params: %i( entityid ), options: options )
|
88
|
+
authenticated_get cmd: "getsubscriptionlist", **options
|
89
|
+
end
|
90
|
+
|
91
|
+
# api.list_roles domainid: 57025
|
92
|
+
def list_roles(options = {})
|
93
|
+
options = argument_cleaner(required_params: %i( domainid ), optional_params: %i( ), options: options )
|
94
|
+
authenticated_get cmd: "listroles", **options
|
95
|
+
end
|
96
|
+
|
97
|
+
# api.restore_role roleid: 61316
|
98
|
+
def restore_role(options = {})
|
99
|
+
options = argument_cleaner(required_params: %i( roleid ), optional_params: %i( ), options: options )
|
100
|
+
authenticated_get cmd: "restorerole", **options
|
101
|
+
end
|
102
|
+
|
103
|
+
# api.update_rights [ {actorid: 57026, entityid: 57025, roleid: 61316}]
|
104
|
+
def update_rights(items = [])
|
105
|
+
options = items.map do |item|
|
106
|
+
argument_cleaner(required_params: %i( actorid entityid ), optional_params: %i( roleid flags schema ), options: item )
|
107
|
+
end
|
108
|
+
authenticated_bulk_post cmd: "updaterights", root_node: 'rights', body: options
|
109
|
+
end
|
110
|
+
|
111
|
+
# api.update_role roleid: 61316, name: "Test Role Updates", privileges: api.right_flags[:update_domain]
|
112
|
+
def update_role(options = {})
|
113
|
+
options = argument_cleaner(required_params: %i( roleid ), optional_params: %i( name privileges reference entitytype ), options: options )
|
114
|
+
raise ArgumentError.new("Not a valid entitytype. Should be D,C, or empty") unless [nil, "", "D", "C"].include?(options[:entitytype])
|
115
|
+
|
116
|
+
authenticated_post cmd: "updaterole", **options
|
117
|
+
end
|
118
|
+
|
119
|
+
# ISSUE: Why is this root node singular?
|
120
|
+
# api.update_subscriptions subscriberid: 57181, entityid: 60982, startdate: "2019-03-15", enddate: "2019-03-15"
|
121
|
+
def update_subscriptions(items = [])
|
122
|
+
options = items.map do |item|
|
123
|
+
argument_cleaner(required_params: %i( subscriberid entityid startdate enddate ), optional_params: %i( subscriptionflags ), options: item )
|
124
|
+
end
|
125
|
+
authenticated_bulk_post cmd: "updatesubscriptions", root_node: 'subscription', body: options
|
126
|
+
end
|
127
|
+
|
128
|
+
def right_flags
|
129
|
+
{
|
130
|
+
admin: -1,
|
131
|
+
none: 0,
|
132
|
+
participate: 1,
|
133
|
+
create_domain: 16,
|
134
|
+
read_domain: 32,
|
135
|
+
update_domain: 64,
|
136
|
+
delete_domain: 128,
|
137
|
+
create_user: 256,
|
138
|
+
read_user: 512,
|
139
|
+
update_user: 1024,
|
140
|
+
delete_user: 2048,
|
141
|
+
create_course: 65536,
|
142
|
+
read_course: 131072,
|
143
|
+
update_course: 262144,
|
144
|
+
delete_course: 524288,
|
145
|
+
create_section: 1048576,
|
146
|
+
read_section: 2097152,
|
147
|
+
update_section: 4194304,
|
148
|
+
delete_section: 8388608,
|
149
|
+
grade_assignment: 16777216,
|
150
|
+
grade_forum: 33554432,
|
151
|
+
grade_exam: 67108864,
|
152
|
+
setup_gradebook: 134217728,
|
153
|
+
control_domain: 268435456,
|
154
|
+
control_course: 536870912,
|
155
|
+
control_section: 1073741824,
|
156
|
+
read_gradebook: 2147483648,
|
157
|
+
report_domain: 4294967296,
|
158
|
+
report_course: 8589934592,
|
159
|
+
report_section: 17179869184,
|
160
|
+
post_domain_announcements: 34359738368,
|
161
|
+
proxy: 68719476736,
|
162
|
+
report_user: 274877906944,
|
163
|
+
submit_final_grade: 549755813888,
|
164
|
+
control_enrollment: 1099511627776,
|
165
|
+
read_enrollment: 2199023255552,
|
166
|
+
read_course_full: 4398046511104,
|
167
|
+
control_user: 8796093022208,
|
168
|
+
read_objective: 17592186044416,
|
169
|
+
update_objective: 35184372088832
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
def right_flags_hex
|
174
|
+
{
|
175
|
+
admin: "-0x01",
|
176
|
+
none: "0x00",
|
177
|
+
participate: "0x01",
|
178
|
+
create_domain: "0x10",
|
179
|
+
read_domain: "0x20",
|
180
|
+
update_domain: "0x40",
|
181
|
+
delete_domain: "0x80",
|
182
|
+
create_user: "0x100",
|
183
|
+
read_user: "0x200",
|
184
|
+
update_user: "0x400",
|
185
|
+
delete_user: "0x800",
|
186
|
+
create_course: "0x10000",
|
187
|
+
read_course: "0x20000",
|
188
|
+
update_course: "0x40000",
|
189
|
+
delete_course: "0x80000",
|
190
|
+
create_section: "0x100000",
|
191
|
+
read_section: "0x200000",
|
192
|
+
update_section: "0x400000",
|
193
|
+
delete_section: "0x800000",
|
194
|
+
grade_assignment: "0x1000000",
|
195
|
+
grade_forum: "0x2000000",
|
196
|
+
grade_exam: "0x4000000",
|
197
|
+
setup_gradebook: "0x8000000",
|
198
|
+
control_domain: "0x10000000",
|
199
|
+
control_course: "0x20000000",
|
200
|
+
control_section: "0x40000000",
|
201
|
+
read_gradebook: "0x80000000",
|
202
|
+
report_domain: "0x100000000",
|
203
|
+
report_course: "0x200000000",
|
204
|
+
report_section: "0x400000000",
|
205
|
+
post_domain_announcements: "0x800000000",
|
206
|
+
proxy: "0x1000000000",
|
207
|
+
report_user: "0x4000000000",
|
208
|
+
submit_final_grade: "0x8000000000",
|
209
|
+
control_enrollment: "0x10000000000",
|
210
|
+
read_enrollment: "0x20000000000",
|
211
|
+
read_course_full: "0x40000000000",
|
212
|
+
control_user: "0x80000000000",
|
213
|
+
read_objective: "0x100000000000",
|
214
|
+
update_objective: "0x200000000000"
|
215
|
+
}
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
def right_flags_lookup_value(val)
|
220
|
+
val = val.to_s
|
221
|
+
if val.include?("x")
|
222
|
+
raise ArgumentError.new("Not a valid right flag") unless right_flags_hex.values.include?(val)
|
223
|
+
right_flags_hex.find {|k,v| v == val}.first
|
224
|
+
else
|
225
|
+
val = val.to_i
|
226
|
+
raise ArgumentError.new("Not a valid right flag") unless right_flags.values.include?(val)
|
227
|
+
right_flags.find {|k,v| v == val}.first
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
data/lib/agilix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -191,6 +191,8 @@ files:
|
|
191
191
|
- lib/agilix/buzz/commands/enrollment.rb
|
192
192
|
- lib/agilix/buzz/commands/general.rb
|
193
193
|
- lib/agilix/buzz/commands/report.rb
|
194
|
+
- lib/agilix/buzz/commands/resource.rb
|
195
|
+
- lib/agilix/buzz/commands/right.rb
|
194
196
|
- lib/agilix/buzz/commands/user.rb
|
195
197
|
- lib/agilix/version.rb
|
196
198
|
- stats.html
|