plurall 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.env.sample +14 -0
  3. data/.gitignore +12 -0
  4. data/CHANGELOG.md +3 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +65 -0
  9. data/Rakefile +12 -0
  10. data/bin/console +15 -0
  11. data/bin/setup +8 -0
  12. data/lib/plurall/administrators.rb +185 -0
  13. data/lib/plurall/api/administrators_query.rb +49 -0
  14. data/lib/plurall/api/attendants_query.rb +49 -0
  15. data/lib/plurall/api/classes_query.rb +60 -0
  16. data/lib/plurall/api/client.rb +5 -0
  17. data/lib/plurall/api/coordinators_query.rb +53 -0
  18. data/lib/plurall/api/directors_query.rb +49 -0
  19. data/lib/plurall/api/http.rb +9 -0
  20. data/lib/plurall/api/managers_query.rb +53 -0
  21. data/lib/plurall/api/person_query.rb +30 -0
  22. data/lib/plurall/api/schema.rb +5 -0
  23. data/lib/plurall/api/schools_query.rb +67 -0
  24. data/lib/plurall/api/student_classes_query.rb +71 -0
  25. data/lib/plurall/api/students_query.rb +83 -0
  26. data/lib/plurall/api/teachers_query.rb +75 -0
  27. data/lib/plurall/api.rb +139 -0
  28. data/lib/plurall/attendants.rb +185 -0
  29. data/lib/plurall/classes.rb +185 -0
  30. data/lib/plurall/configuration.rb +41 -0
  31. data/lib/plurall/coordinators.rb +185 -0
  32. data/lib/plurall/directors.rb +185 -0
  33. data/lib/plurall/errors.rb +11 -0
  34. data/lib/plurall/managers.rb +185 -0
  35. data/lib/plurall/schools.rb +169 -0
  36. data/lib/plurall/student_classes.rb +197 -0
  37. data/lib/plurall/students.rb +185 -0
  38. data/lib/plurall/teachers.rb +185 -0
  39. data/lib/plurall/version.rb +6 -0
  40. data/lib/plurall.rb +273 -0
  41. data/plurall.gemspec +45 -0
  42. data/schema/friendly.json +14653 -0
  43. data/schema/graphql.json +11907 -0
  44. data/sig/plurall.rbs +4 -0
  45. metadata +269 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 497dec19660b1d3168a29844ff5fff79a9a3fe5e326019664829499a6131c396
4
+ data.tar.gz: 43fca46456d0ba14d0106cc6bf52b750bb77c70fb500eab1316355db72d8fd1b
5
+ SHA512:
6
+ metadata.gz: ca2f1484a9b9564319743b8d33b9c2b3358bb6ea8ccc495311a8c63bdddc52f20f161856bd53662b44c6288c153e82ed96ae24655631e6f98bfb106b1176d998
7
+ data.tar.gz: a4fbe5c40616a45ebfc0e04c6ade800402f0cebd486b24021cd0903219b63b1d9632d3cebfd3226693ae5dd9ad40acb27797f9267fbefcc9d41654296b91b2a4
data/.env.sample ADDED
@@ -0,0 +1,14 @@
1
+ PLURALL_CLIENT_ID: "YOUR_PLURALL_CLIENT_ID"
2
+ PLURALL_CLIENT_SECRET: "YOUR_PLURALL_CLIENT_SECRET"
3
+ PLURALL_ID_APPLICATION: "YOUR_PLURALL_APPLICATION_ID"
4
+
5
+ # If you want to connect to a different environment, such as the plurall sandbox, you must provide URL values:
6
+
7
+ # PLURALL_CLIENT_ID: "YOUR_SANDBOX_CLIENT_ID"
8
+ # PLURALL_CLIENT_SECRET: "YOUR_SANDBOX_CLIENT_SECRET"
9
+ # PLURALL_OAUTH_AUTHORIZE_URL: "https://sso.s.plurall.net/oauth/authorize"
10
+ # PLURALL_OAUTH_TOKEN_URL: "https://sso.s.plurall.net/oauth/token"
11
+ # PLURALL_ME_URL: "https://sso.s.plurall.net/me"
12
+ # PLURALL_ID_APPLICATION: "YOUR_SANDBOX_APPLICATION_ID"
13
+ # PLURALL_ID_AUTH_URL: "https://ms-api.s.plurall.net/identity/data-exchange/auth"
14
+ # PLURALL_ID_GRAPHQL_URL: "https://ms-api.s.plurall.net/identity/data-exchange/v2/graphql"
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ .env
2
+ .ruby-gemset
3
+ .ruby-version
4
+ /_yardoc/
5
+ /.bundle/
6
+ /.yardoc
7
+ /coverage/
8
+ /doc/
9
+ /Gemfile.lock
10
+ /pkg/
11
+ /spec/reports/
12
+ /tmp/
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## [0.1.0] - 2023-11-09
2
+
3
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mike@blowmage.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Gem's dependencies in plurall.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ [![Gem Version](https://badge.fury.io/rb/plurall.svg)](https://badge.fury.io/rb/plurall)
2
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/beneggett/plurall/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/beneggett/plurall/tree/main)
3
+ [![Coverage Status](https://coveralls.io/repos/github/beneggett/plurall/badge.svg?branch=master)](https://coveralls.io/github/beneggett/plurall?branch=main)
4
+
5
+ # Plurall
6
+
7
+ Fully Implements the Plurall API in Ruby
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem "plurall"
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install plurall
24
+
25
+ Be sure to define your Plurall credentials by setting up environment variables in your application appropriately. Refer to the `.env.sample` file for details.
26
+
27
+ ```
28
+ PLURALL_CLIENT_ID: "YOUR_PLURALL_CLIENT_ID"
29
+ PLURALL_CLIENT_SECRET: "YOUR_PLURALL_CLIENT_SECRET"
30
+ PLURALL_ID_APPLICATION: "YOUR_PLURALL_APPLICATION_ID"
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ There are many primary APIs that are wrapped. Below you will see basic examples of how to use them. For more information about what optional query parameters are available, please consult the [Plurall API Docs](https://dev.plurall.com/docs)
36
+
37
+ ## Configuration
38
+
39
+ Place the following configuration in your apps initializer:
40
+
41
+ ```ruby
42
+ Plurall.configure do |config|
43
+ config.client_id = "YOUR_PLURALL_CLIENT_ID"
44
+ config.client_secret = "YOUR_PLURALL_CLIENT_SECRET"
45
+ config.id_application = "YOUR_PLURALL_APPLICATION_ID"
46
+ end
47
+ ```
48
+
49
+ ## Development
50
+
51
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
+
53
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
54
+
55
+ ## Contributing
56
+
57
+ Bug reports and pull requests are welcome on GitHub at https://github.com/beneggett/plurall. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
58
+
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
62
+
63
+ ## Code of Conduct
64
+
65
+ Everyone interacting in the Plurall` project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/beneggett/plurall/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new :test do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "plurall"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start __FILE__
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,185 @@
1
+ module Plurall
2
+ ##
3
+ # Public: A list of school administrators that supports pagination.
4
+ #
5
+ # Examples
6
+ #
7
+ # Plurall.administrators(school_id: 123456).each do |administrator|
8
+ # puts administrator.name
9
+ # end
10
+ #
11
+ class Administrators
12
+ include Enumerable
13
+
14
+ # Internal: Returns the GraphQL API response as a GraphQL::Client::Response.
15
+ attr_reader :response
16
+
17
+ ##
18
+ # Internal: Create a new object from a GraphQL API response.
19
+ #
20
+ # response - The GraphQL API response as a GraphQL::Client::Response.
21
+ #
22
+ def initialize response
23
+ @response = response
24
+ end
25
+
26
+ ##
27
+ # Public: Returns the number of administrators as an Integer.
28
+ def total_count
29
+ school_node.administrators.total_count
30
+ end
31
+
32
+ ##
33
+ # Public: Returns the list of administrators as a Hash.
34
+ def data
35
+ response.data.to_h
36
+ end
37
+
38
+ ##
39
+ # Public: Returns the school id for list of administrators as a String.
40
+ def school_id
41
+ school_node.id
42
+ end
43
+
44
+ ##
45
+ # Public: Iterates the list of administrators.
46
+ #
47
+ # Examples
48
+ #
49
+ # Plurall.administrators(school_id: 123456).each do |administrator|
50
+ # puts administrator.name
51
+ # end
52
+ #
53
+ # Yields an administrator object to the block.
54
+ #
55
+ # Returns an Enumerator when no block argument is given, or nothing when when a block argument is given.
56
+ #
57
+ def each &block
58
+ return enum_for :each unless block
59
+
60
+ school_node.administrators.edges.lazy.map(&:node).each(&block)
61
+ end
62
+
63
+ ##
64
+ # Public: Iterates all administrators.
65
+ #
66
+ # Several API calls may be made to retrieve all by repeatedly calling #next until #next? returns `false`.
67
+ #
68
+ # Examples
69
+ #
70
+ # Plurall.administrators(school_id: 123456).all do |administrator|
71
+ # puts administrator.name
72
+ # end
73
+ #
74
+ # Yields an administrator object to the block.
75
+ #
76
+ # Returns an Enumerator when no block argument is given, or nothing when when a block argument is given.
77
+ #
78
+ def all &block
79
+ return enum_for :all unless block
80
+
81
+ page = self
82
+ loop do
83
+ page.each(&block)
84
+ page = page.next
85
+ break if page.nil?
86
+ end
87
+ end
88
+
89
+ ##
90
+ # Public: Whether there are more administrators available.
91
+ #
92
+ # Examples
93
+ #
94
+ # administrators = Plurall.administrators school_id: 123456
95
+ # administrators.next?
96
+ #
97
+ # Returns true or false.
98
+ #
99
+ def next?
100
+ administrators_page_info.has_next_page
101
+ end
102
+
103
+ ##
104
+ # Internal: The next cursor used for pagination.
105
+ #
106
+ # Returns the next cursor as a String, or nil.
107
+ #
108
+ def next_cursor
109
+ return nil unless next?
110
+
111
+ administrators_page_info.end_cursor
112
+ end
113
+
114
+ ##
115
+ # Public: Retrieve the next page of administrators.
116
+ #
117
+ # Returns the next page as Plurall::Administrators, or nil.
118
+ #
119
+ def next
120
+ return nil unless next?
121
+
122
+ next_response = Plurall::Api.administrators school_id: school_id, after: next_cursor
123
+ self.class.new next_response
124
+ end
125
+
126
+ ##
127
+ # Public: Whether there are previous administrators available.
128
+ #
129
+ # Examples
130
+ #
131
+ # administrators = Plurall.administrators school_id: 123456
132
+ # administrators.prev?
133
+ #
134
+ # Returns true or false.
135
+ #
136
+ def prev?
137
+ administrators_page_info.has_previous_page
138
+ end
139
+
140
+ ##
141
+ # Internal: The previous cursor used for pagination.
142
+ #
143
+ # Returns the previous cursor as a String, or nil.
144
+ #
145
+ def prev_cursor
146
+ return nil unless prev?
147
+
148
+ administrators_page_info.start_cursor
149
+ end
150
+
151
+ ##
152
+ # Public: Retrieve the previous page of administrators.
153
+ #
154
+ # Examples
155
+ #
156
+ # administrators = Plurall.administrators school_id: 123456
157
+ # prev_administrators = administrators.prev
158
+ #
159
+ # Returns the previous page as Plurall::Administrators, or nil.
160
+ #
161
+ def prev
162
+ return nil unless prev?
163
+
164
+ prev_response = Plurall::Api.administrators school_id: school_id, before: prev_cursor
165
+ self.class.new prev_response
166
+ end
167
+
168
+ ##
169
+ # Internal: Returns a string representation of the list.
170
+ #
171
+ def inspect
172
+ "#<#{self.class.name}:0x#{(object_id * 2).to_s(16).rjust(16, "0")} administrators:#{total_count}>"
173
+ end
174
+
175
+ private
176
+
177
+ def school_node
178
+ response.data.schools.first.edges.first.node
179
+ end
180
+
181
+ def administrators_page_info
182
+ school_node.administrators.page_info
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,49 @@
1
+ module Plurall
2
+ module Api
3
+ AdministratorsQuery = Plurall::Api::Client.parse <<-GRAPHQL
4
+ query ($school_id: ID!, $first: IntRangeFrom1To30!, $after: String!, $before: String!, $page: Int!, $search: String!) {
5
+ schools(id: $school_id, first: 1) {
6
+ edges {
7
+ node {
8
+ id
9
+ legalName
10
+ cnpj
11
+ tradeName
12
+ administrators(first: $first, after: $after, before: $before, page: $page, search: $search) {
13
+ totalCount
14
+ pageInfo {
15
+ endCursor
16
+ hasNextPage
17
+ hasPreviousPage
18
+ startCursor
19
+ }
20
+ edges {
21
+ node {
22
+ uuid
23
+ email
24
+ name
25
+ roles {
26
+ id
27
+ name
28
+ schools {
29
+ id
30
+ legalName
31
+ cnpj
32
+ tradeName
33
+ }
34
+ }
35
+ externalReference {
36
+ applicationId
37
+ identifier
38
+ applicationName
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ GRAPHQL
48
+ end
49
+ end
@@ -0,0 +1,49 @@
1
+ module Plurall
2
+ module Api
3
+ AttendantsQuery = Plurall::Api::Client.parse <<-GRAPHQL
4
+ query ($school_id: ID!, $first: IntRangeFrom1To30!, $after: String!, $before: String!, $page: Int!, $search: String!) {
5
+ schools(id: $school_id, first: 1) {
6
+ edges {
7
+ node {
8
+ id
9
+ legalName
10
+ cnpj
11
+ tradeName
12
+ attendants(first: $first, after: $after, before: $before, page: $page, search: $search) {
13
+ totalCount
14
+ pageInfo {
15
+ endCursor
16
+ hasNextPage
17
+ hasPreviousPage
18
+ startCursor
19
+ }
20
+ edges {
21
+ node {
22
+ uuid
23
+ email
24
+ name
25
+ roles {
26
+ id
27
+ name
28
+ schools {
29
+ id
30
+ legalName
31
+ cnpj
32
+ tradeName
33
+ }
34
+ }
35
+ externalReference {
36
+ applicationId
37
+ identifier
38
+ applicationName
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ GRAPHQL
48
+ end
49
+ end
@@ -0,0 +1,60 @@
1
+ module Plurall
2
+ module Api
3
+ ClassesQuery = Plurall::Api::Client.parse <<-GRAPHQL
4
+ query ($school_id: ID!, $first: IntRangeFrom1To30!, $after: String!, $before: String!, $page: Int!, $search: String!) {
5
+ schools(id: $school_id, first: 1) {
6
+ edges {
7
+ node {
8
+ id
9
+ legalName
10
+ cnpj
11
+ tradeName
12
+ classes(first: $first, after: $after, before: $before, page: $page, search: $search) {
13
+ totalCount
14
+ pageInfo {
15
+ endCursor
16
+ hasNextPage
17
+ hasPreviousPage
18
+ startCursor
19
+ }
20
+ edges {
21
+ node {
22
+ id
23
+ name
24
+ period {
25
+ id
26
+ year
27
+ }
28
+ levelGrades {
29
+ gradeId
30
+ gradeName
31
+ levelId
32
+ levelName
33
+ }
34
+ materials {
35
+ id
36
+ title
37
+ description
38
+ brand {
39
+ id
40
+ name
41
+ }
42
+ status {
43
+ id
44
+ name
45
+ }
46
+ }
47
+ disciplines {
48
+ id
49
+ name
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ GRAPHQL
59
+ end
60
+ end
@@ -0,0 +1,5 @@
1
+ module Plurall
2
+ module Api
3
+ Client = ::GraphQL::Client.new schema: Schema, execute: HTTP
4
+ end
5
+ end
@@ -0,0 +1,53 @@
1
+ module Plurall
2
+ module Api
3
+ CoordinatorsQuery = Plurall::Api::Client.parse <<-GRAPHQL
4
+ query ($school_id: ID!, $first: IntRangeFrom1To30!, $after: String!, $before: String!, $page: Int!, $search: String!) {
5
+ schools(id: $school_id, first: 1) {
6
+ edges {
7
+ node {
8
+ id
9
+ legalName
10
+ cnpj
11
+ tradeName
12
+ coordinators(first: $first, after: $after, before: $before, page: $page, search: $search) {
13
+ totalCount
14
+ pageInfo {
15
+ endCursor
16
+ hasNextPage
17
+ hasPreviousPage
18
+ startCursor
19
+ }
20
+ edges {
21
+ node {
22
+ uuid
23
+ email
24
+ name
25
+ levels {
26
+ id
27
+ name
28
+ }
29
+ roles {
30
+ id
31
+ name
32
+ schools {
33
+ id
34
+ legalName
35
+ cnpj
36
+ tradeName
37
+ }
38
+ }
39
+ externalReference {
40
+ applicationId
41
+ identifier
42
+ applicationName
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ GRAPHQL
52
+ end
53
+ end