school21_api_sdk 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c977aa4a81ec303760a605cfa0bc0cb4508cf1cc8fe930419681cbdad2f76365
4
- data.tar.gz: 540db30ea6fb420599b0d54b8f6236fcc7ccda97bb6fc29a2a65d2b8ae9b78d9
3
+ metadata.gz: e94bb6054dc91242b21c99220f3c30931f0b6b24418ef8f0ba140052f2220fb3
4
+ data.tar.gz: f4fc58b78bfe7a25291cab9f34de83f5361ecd8afc929a500b7bb4958bbb54a2
5
5
  SHA512:
6
- metadata.gz: d9ce8af9eaae1316e4e77f62448efb983d14a8c36bb281021fd9ef4dfa1c1ed92a3362be512410fdf62bb9f33095c76990bb944e054888e82c4218613bd055a4
7
- data.tar.gz: 874a6d4bc32e73deb6324bd57831650cea4f070c2c25d4cdf7dc7f699baff4df123a67e3f22e05081e5580155f4bb24dde9caa17cf5d1ec62e35ddc9fc053180
6
+ metadata.gz: 379828e0c0f1bc42e3d66751ee73db4163fbaf35232d7200aa7fe552f36c08bf2f31dc702aeeac37cd72d0ea02dff01c0c89937f55284115ca10264d88ce9611
7
+ data.tar.gz: 707c86e1a6fb0bc5b4c92e3f71ed720b3219ddf5c569a5fc4614f7f2c78a96a45356900f6f6df942dad41f89c06ed31cac2e28a6e4caf77f7715bf8ca02657c8
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module School21
4
+ class CampusesApi < BaseApi
5
+ def campuses
6
+ path = '/campuses'
7
+ new_request = new_request_builder(HttpMethod::GET, path, :api_v1)
8
+ .auth(CoreLibrary::Single.new(SINGLE_AUTH_PARTICIPANT))
9
+
10
+ new_api_call_builder
11
+ .request(new_request)
12
+ .response(new_response_handler)
13
+ .execute
14
+ end
15
+
16
+ def campuses_participants(campus_id, options: {})
17
+ path = "/campuses/#{campus_id}/participants"
18
+ default_options = { limit: 50, offset: 0 }.merge(options)
19
+
20
+ new_request = new_request_builder(HttpMethod::GET, path, :api_v1)
21
+ .auth(CoreLibrary::Single.new(SINGLE_AUTH_PARTICIPANT))
22
+
23
+ default_options.each do |key, value|
24
+ new_request.query_param(new_parameter(value, key:))
25
+ end
26
+
27
+ new_api_call_builder
28
+ .request(new_request)
29
+ .response(new_response_handler)
30
+ .execute
31
+ end
32
+
33
+ def campuses_coalitions(campus_id, options: {})
34
+ path = "/campuses/#{campus_id}/coalitions"
35
+ default_options = { limit: 50, offset: 0 }.merge(options)
36
+
37
+ new_request = new_request_builder(HttpMethod::GET, path, :api_v1)
38
+ .auth(CoreLibrary::Single.new(SINGLE_AUTH_PARTICIPANT))
39
+
40
+ default_options.each do |key, value|
41
+ new_request.query_param(new_parameter(value, key:))
42
+ end
43
+
44
+ new_api_call_builder
45
+ .request(new_request)
46
+ .response(new_response_handler)
47
+ .execute
48
+ end
49
+
50
+ def campuses_clusters(campus_id, options: {})
51
+ path = "/campuses/#{campus_id}/clusters"
52
+ default_options = { limit: 50, offset: 0 }.merge(options)
53
+
54
+ new_request = new_request_builder(HttpMethod::GET, path, :api_v1)
55
+ .auth(CoreLibrary::Single.new(SINGLE_AUTH_PARTICIPANT))
56
+
57
+ default_options.each do |key, value|
58
+ new_request.query_param(new_parameter(value, key:))
59
+ end
60
+
61
+ new_api_call_builder
62
+ .request(new_request)
63
+ .response(new_response_handler)
64
+ .execute
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module School21
4
+ class ClustersApi < BaseApi
5
+ def clusters_map(cluster_id, options: {})
6
+ path = "/clusters/#{cluster_id}/map"
7
+ default_options = { limit: 50, offset: 0, occupied: true }.merge(options)
8
+
9
+ new_request = new_request_builder(HttpMethod::GET, path, :api_v1)
10
+ .auth(CoreLibrary::Single.new(SINGLE_AUTH_PARTICIPANT))
11
+
12
+ default_options.each do |key, value|
13
+ new_request.query_param(new_parameter(value, key:))
14
+ end
15
+
16
+ new_api_call_builder
17
+ .request(new_request)
18
+ .response(new_response_handler)
19
+ .execute
20
+ end
21
+ end
22
+ end
@@ -15,17 +15,13 @@ module School21
15
15
 
16
16
  def participants_projects(login, options: {})
17
17
  path = "/participants/#{login}/projects"
18
- default_options = { limit: 1000, offset: 0 }.merge(options)
19
-
20
- parameters = default_options.map do |key, value|
21
- new_parameter(value, key:)
22
- end
18
+ default_options = { limit: 10, offset: 0 }.merge(options)
23
19
 
24
20
  new_request = new_request_builder(HttpMethod::GET, path, :api_v1)
25
21
  .auth(CoreLibrary::Single.new(SINGLE_AUTH_PARTICIPANT))
26
22
 
27
- parameters.each do |parameter|
28
- new_request.query_param(parameter)
23
+ default_options.each do |key, value|
24
+ new_request.query_param(new_parameter(value, key:))
29
25
  end
30
26
 
31
27
  new_api_call_builder
@@ -15,17 +15,13 @@ module School21
15
15
 
16
16
  def projects_participants(project_id, options: {})
17
17
  path = "/projects/#{project_id}/participants"
18
- default_options = { limit: 1000, offset: 0 }.merge(options)
19
-
20
- parameters = default_options.map do |key, value|
21
- new_parameter(value, key:)
22
- end
18
+ default_options = { limit: 10, offset: 0 }.merge(options)
23
19
 
24
20
  new_request = new_request_builder(HttpMethod::GET, path, :api_v1)
25
21
  .auth(CoreLibrary::Single.new(SINGLE_AUTH_PARTICIPANT))
26
22
 
27
- parameters.each do |parameter|
28
- new_request.query_param(parameter)
23
+ default_options.each do |key, value|
24
+ new_request.query_param(new_parameter(value, key:))
29
25
  end
30
26
 
31
27
  new_api_call_builder
@@ -28,20 +28,30 @@ module School21
28
28
  initialize_auth!
29
29
  end
30
30
 
31
- def auth_api = @auth_api ||= AuthApi.new(@config)
31
+ def auth_api
32
+ @auth_api ||= AuthApi.new(@config)
33
+ end
32
34
 
33
35
  def participants_api
34
36
  initialize_auth! if @access_token.expired?
35
-
36
37
  ParticipantsApi.new(@config)
37
38
  end
38
39
 
39
40
  def projects_api
40
41
  initialize_auth! if @access_token.expired?
41
-
42
42
  ProjectsApi.new(@config)
43
43
  end
44
44
 
45
+ def campuses_api
46
+ initialize_auth! if @access_token.expired?
47
+ CampusesApi.new(@config)
48
+ end
49
+
50
+ def clusters_api
51
+ initialize_auth! if @access_token.expired?
52
+ ClustersApi.new(@config)
53
+ end
54
+
45
55
  private
46
56
 
47
57
  def validate_credentials!
@@ -2,6 +2,6 @@
2
2
 
3
3
  module School21
4
4
  class ClientConfig < CoreLibrary::HttpClientConfiguration
5
- attr_writer :logging_configuration
5
+ attr_writer :logging_configuration, :timeout
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module School21
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
data/lib/school21.rb CHANGED
@@ -13,6 +13,8 @@ require_relative 'school21/api/base_api'
13
13
  require_relative 'school21/api/participants_api'
14
14
  require_relative 'school21/api/auth_api'
15
15
  require_relative 'school21/api/projects_api'
16
+ require_relative 'school21/api/campuses_api'
17
+ require_relative 'school21/api/clusters_api'
16
18
 
17
19
  require_relative 'school21/config/api_logging_config'
18
20
  require_relative 'school21/config/client_config'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: school21_api_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Yudin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-11 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -94,6 +94,8 @@ files:
94
94
  - lib/school21.rb
95
95
  - lib/school21/api/auth_api.rb
96
96
  - lib/school21/api/base_api.rb
97
+ - lib/school21/api/campuses_api.rb
98
+ - lib/school21/api/clusters_api.rb
97
99
  - lib/school21/api/participants_api.rb
98
100
  - lib/school21/api/projects_api.rb
99
101
  - lib/school21/auth/access_token.rb
@@ -128,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
130
  - !ruby/object:Gem::Version
129
131
  version: '0'
130
132
  requirements: []
131
- rubygems_version: 3.5.11
133
+ rubygems_version: 3.5.17
132
134
  signing_key:
133
135
  specification_version: 4
134
136
  summary: School21 API SDK