plurall 0.1.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.
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
data/lib/plurall.rb ADDED
@@ -0,0 +1,273 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "plurall/configuration"
4
+ require_relative "plurall/errors"
5
+ require_relative "plurall/api"
6
+ require_relative "plurall/schools"
7
+ require_relative "plurall/teachers"
8
+ require_relative "plurall/students"
9
+ require_relative "plurall/student_classes"
10
+ require_relative "plurall/classes"
11
+ require_relative "plurall/administrators"
12
+ require_relative "plurall/attendants"
13
+ require_relative "plurall/coordinators"
14
+ require_relative "plurall/directors"
15
+ require_relative "plurall/managers"
16
+ require_relative "plurall/version"
17
+
18
+ ##
19
+ # A full implementation the Plurall API in Ruby.
20
+ #
21
+ # Examples
22
+ #
23
+ # Plurall.schools.each do |school|
24
+ # puts school.legal_name
25
+ # end
26
+ #
27
+ module Plurall
28
+ ##
29
+ # Public: Retrieve a list of schools.
30
+ #
31
+ # first - The number of schools to retrieve as an Integer.
32
+ # after - The next cursor to retrieve schools for as a String.
33
+ # before - The end cursor to retrieve schools for as a String.
34
+ # page - The numbered page to retrieve schools for as an Integer.
35
+ # search - The search value to retrieve schools for as a String.
36
+ #
37
+ # Examples
38
+ #
39
+ # Plurall.schools.each do |school|
40
+ # puts school.legal_name
41
+ # end
42
+ #
43
+ # Returns Plurall::Schools.
44
+ #
45
+ def self.schools first: 30, after: "", before: "", page: 0, search: ""
46
+ Plurall::Schools.new Plurall::Api.schools first: first, after: after, before: before, page: page, search: search
47
+ end
48
+
49
+ ##
50
+ # Public: Retrieve a list of teachers for a school.
51
+ #
52
+ # school_id - The school ID to retrieve teachers for as a String or Integer.
53
+ # first - The number of teachers to retrieve as an Integer.
54
+ # after - The next cursor to retrieve teachers for as a String.
55
+ # before - The end cursor to retrieve teachers for as a String.
56
+ # page - The numbered page to retrieve teachers for as an Integer.
57
+ # search - The search value to retrieve teachers for as a String.
58
+ #
59
+ # Examples
60
+ #
61
+ # Plurall.teachers(school_id: 123456).each do |teacher|
62
+ # puts teacher.name
63
+ # end
64
+ #
65
+ # Returns Plurall::Teachers.
66
+ #
67
+ def self.teachers school_id:, first: 30, after: "", before: "", page: 0, search: ""
68
+ Plurall::Teachers.new Plurall::Api.teachers school_id: school_id, first: first, after: after, before: before,
69
+ page: page, search: search
70
+ end
71
+
72
+ ##
73
+ # Public: Retrieve a list of students for a school.
74
+ #
75
+ # school_id - The school ID to retrieve students for as a String or Integer.
76
+ # first - The number of students to retrieve as an Integer.
77
+ # after - The next cursor to retrieve students for as a String.
78
+ # before - The end cursor to retrieve students for as a String.
79
+ # page - The numbered page to retrieve students for as an Integer.
80
+ # search - The search value to retrieve students for as a String.
81
+ #
82
+ # Examples
83
+ #
84
+ # Plurall.students(school_id: 123456).each do |student|
85
+ # puts student.name
86
+ # end
87
+ #
88
+ # Returns Plurall::Students.
89
+ #
90
+ def self.students school_id:, first: 30, after: "", before: "", page: 0, search: ""
91
+ Plurall::Students.new Plurall::Api.students school_id: school_id, first: first, after: after, before: before,
92
+ page: page, search: search
93
+ end
94
+
95
+ ##
96
+ # Public: Retrieve a list of classes for a student.
97
+ #
98
+ # school_id - The school ID to retrieve classes for as a String or Integer.
99
+ # uuid - The student UUID to retrieve classes for as a String.
100
+ # first - The number of classes to retrieve as an Integer.
101
+ # after - The next cursor to retrieve classes for as a String.
102
+ # before - The end cursor to retrieve classes for as a String.
103
+ # page - The numbered page to retrieve classes for as an Integer.
104
+ # search - The search value to retrieve classes for as a String.
105
+ #
106
+ # Examples
107
+ #
108
+ # Plurall.student_classes(school_id: 123456, uuid: "00000000-0000-0000-0000-000000000000").each do |school_class|
109
+ # puts school_class.name
110
+ # end
111
+ #
112
+ # Returns Plurall::StudentClasses.
113
+ #
114
+ def self.student_classes school_id:, uuid:, first: 30, after: "", before: "", page: 0, search: ""
115
+ Plurall::StudentClasses.new Plurall::Api.student_classes school_id: school_id, uuid: uuid, first: first,
116
+ after: after, before: before, page: page, search: search
117
+ end
118
+
119
+ ##
120
+ # Public: Retrieve a list of classes for a school.
121
+ #
122
+ # school_id - The school ID to retrieve classes for as a String or Integer.
123
+ # first - The number of classes to retrieve as an Integer.
124
+ # after - The next cursor to retrieve classes for as a String.
125
+ # before - The end cursor to retrieve classes for as a String.
126
+ # page - The numbered page to retrieve classes for as an Integer.
127
+ # search - The search value to retrieve classes for as a String.
128
+ #
129
+ # Examples
130
+ #
131
+ # Plurall.classes(school_id: 123456).each do |student_class|
132
+ # puts student_class.name
133
+ # end
134
+ #
135
+ # Returns Plurall::Classes.
136
+ #
137
+ def self.classes school_id:, first: 30, after: "", before: "", page: 0, search: ""
138
+ Plurall::Classes.new Plurall::Api.classes school_id: school_id, first: first, after: after, before: before,
139
+ page: page, search: search
140
+ end
141
+
142
+ ##
143
+ # Public: Retrieve a list of administrators for a school.
144
+ #
145
+ # school_id - The school ID to retrieve administrators for as a String or Integer.
146
+ # first - The number of administrators to retrieve as an Integer.
147
+ # after - The next cursor to retrieve administrators for as a String.
148
+ # before - The end cursor to retrieve administrators for as a String.
149
+ # page - The numbered page to retrieve administrators for as an Integer.
150
+ # search - The search value to retrieve administrators for as a String.
151
+ #
152
+ # Examples
153
+ #
154
+ # Plurall.administrators(school_id: 123456).each do |administrator|
155
+ # puts administrator.name
156
+ # end
157
+ #
158
+ # Returns Plurall::Administrators.
159
+ #
160
+ def self.administrators school_id:, first: 30, after: "", before: "", page: 0, search: ""
161
+ Plurall::Administrators.new Plurall::Api.administrators school_id: school_id, first: first, after: after,
162
+ before: before, page: page, search: search
163
+ end
164
+
165
+ ##
166
+ # Public: Retrieve a list of attendants for a school.
167
+ #
168
+ # school_id - The school ID to retrieve attendants for as a String or Integer.
169
+ # first - The number of attendants to retrieve as an Integer.
170
+ # after - The next cursor to retrieve attendants for as a String.
171
+ # before - The end cursor to retrieve attendants for as a String.
172
+ # page - The numbered page to retrieve attendants for as an Integer.
173
+ # search - The search value to retrieve attendants for as a String.
174
+ #
175
+ # Examples
176
+ #
177
+ # Plurall.attendants(school_id: 123456).each do |attendant|
178
+ # puts attendant.name
179
+ # end
180
+ #
181
+ # Returns Plurall::Attendants.
182
+ #
183
+ def self.attendants school_id:, first: 30, after: "", before: "", page: 0, search: ""
184
+ Plurall::Attendants.new Plurall::Api.attendants school_id: school_id, first: first, after: after, before: before,
185
+ page: page, search: search
186
+ end
187
+
188
+ ##
189
+ # Public: Retrieve a list of coordinators for a school.
190
+ #
191
+ # school_id - The school ID to retrieve coordinators for as a String or Integer.
192
+ # first - The number of coordinators to retrieve as an Integer.
193
+ # after - The next cursor to retrieve coordinators for as a String.
194
+ # before - The end cursor to retrieve coordinators for as a String.
195
+ # page - The numbered page to retrieve coordinators for as an Integer.
196
+ # search - The search value to retrieve coordinators for as a String.
197
+ #
198
+ # Examples
199
+ #
200
+ # Plurall.coordinators(school_id: 123456).each do |coordinator|
201
+ # puts coordinator.name
202
+ # end
203
+ #
204
+ # Returns Plurall::Coordinators.
205
+ #
206
+ def self.coordinators school_id:, first: 30, after: "", before: "", page: 0, search: ""
207
+ Plurall::Coordinators.new Plurall::Api.coordinators school_id: school_id, first: first, after: after,
208
+ before: before, page: page, search: search
209
+ end
210
+
211
+ ##
212
+ # Public: Retrieve a list of directors for a school.
213
+ #
214
+ # school_id - The school ID to retrieve directors for as a String or Integer.
215
+ # first - The number of directors to retrieve as an Integer.
216
+ # after - The next cursor to retrieve directors for as a String.
217
+ # before - The end cursor to retrieve directors for as a String.
218
+ # page - The numbered page to retrieve directors for as an Integer.
219
+ # search - The search value to retrieve directors for as a String.
220
+ #
221
+ # Examples
222
+ #
223
+ # Plurall.directors(school_id: 123456).each do |director|
224
+ # puts director.name
225
+ # end
226
+ #
227
+ # Returns Plurall::Directors.
228
+ #
229
+ def self.directors school_id:, first: 30, after: "", before: "", page: 0, search: ""
230
+ Plurall::Directors.new Plurall::Api.directors school_id: school_id, first: first, after: after, before: before,
231
+ page: page, search: search
232
+ end
233
+
234
+ ##
235
+ # Public: Retrieve a list of managers for a school.
236
+ #
237
+ # school_id - The school ID to retrieve managers for as a String or Integer.
238
+ # first - The number of managers to retrieve as an Integer.
239
+ # after - The next cursor to retrieve managers for as a String.
240
+ # before - The end cursor to retrieve managers for as a String.
241
+ # page - The numbered page to retrieve managers for as an Integer.
242
+ # search - The search value to retrieve managers for as a String.
243
+ #
244
+ # Examples
245
+ #
246
+ # Plurall.managers(school_id: 123456).each do |manager|
247
+ # puts manager.name
248
+ # end
249
+ #
250
+ # Returns Plurall::Managers.
251
+ #
252
+ def self.managers school_id:, first: 30, after: "", before: "", page: 0
253
+ Plurall::Managers.new Plurall::Api.managers school_id: school_id, first: first, after: after, before: before,
254
+ page: page
255
+ end
256
+
257
+ ##
258
+ # Public: Retrieve a person record.
259
+ #
260
+ # uuid - The person UUID to retrieve as a String.
261
+ #
262
+ # Examples
263
+ #
264
+ # person = Plurall.person uuid: "00000000-0000-0000-0000-000000000000"
265
+ # puts person.name
266
+ #
267
+ # Returns a GraphQL data object.
268
+ #
269
+ def self.person uuid:
270
+ response = Plurall::Api.person uuid: uuid
271
+ response.data.person
272
+ end
273
+ end
data/plurall.gemspec ADDED
@@ -0,0 +1,45 @@
1
+ require_relative "lib/plurall/version.rb"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "plurall"
5
+ spec.version = Plurall::VERSION
6
+ spec.authors = ["Ben Eggett"]
7
+ spec.email = ["beneggett@gmail.com"]
8
+
9
+ spec.summary = "Plurall API ruby wrapper"
10
+ spec.description = "Provides an SDK for interacting wth the Plurall API in Ruby"
11
+ spec.homepage = "https://example.com/plurall"
12
+ spec.license = "MIT"
13
+
14
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
15
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
16
+ if spec.respond_to? :metadata
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+ else
19
+ raise "RubyGems 2.0 or newer is required to protect against " \
20
+ "public gem pushes."
21
+ end
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir File.expand_path("..", __FILE__) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "graphql", "~> 2.0.0" # pin to fix github/graphql-client#310
33
+ spec.add_dependency "graphql-client", "~> 0.18.0"
34
+ spec.add_dependency "faraday", "~> 1.8"
35
+ spec.add_development_dependency "bundler"
36
+ spec.add_development_dependency "coveralls"
37
+ spec.add_development_dependency "dotenv"
38
+ spec.add_development_dependency "minitest"
39
+ spec.add_development_dependency "minitest-focus"
40
+ spec.add_development_dependency "pry"
41
+ spec.add_development_dependency "rake"
42
+ spec.add_development_dependency "simplecov"
43
+ spec.add_development_dependency "vcr"
44
+ spec.add_development_dependency "webmock"
45
+ end