commonlit-clever-ruby 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +129 -0
  3. data/Gemfile +7 -0
  4. data/Gemfile.lock +73 -0
  5. data/LICENSE +190 -0
  6. data/Makefile +10 -0
  7. data/README.md +265 -0
  8. data/Rakefile +8 -0
  9. data/clever-ruby.gemspec +46 -0
  10. data/docs/AdminName.md +9 -0
  11. data/docs/BadRequest.md +8 -0
  12. data/docs/Contact.md +17 -0
  13. data/docs/ContactObject.md +8 -0
  14. data/docs/ContactResponse.md +8 -0
  15. data/docs/ContactsCreated.md +11 -0
  16. data/docs/ContactsDeleted.md +11 -0
  17. data/docs/ContactsResponse.md +9 -0
  18. data/docs/ContactsUpdated.md +12 -0
  19. data/docs/Course.md +11 -0
  20. data/docs/CourseObject.md +8 -0
  21. data/docs/CourseResponse.md +8 -0
  22. data/docs/CoursesCreated.md +11 -0
  23. data/docs/CoursesDeleted.md +11 -0
  24. data/docs/CoursesResponse.md +9 -0
  25. data/docs/CoursesUpdated.md +12 -0
  26. data/docs/Credentials.md +8 -0
  27. data/docs/DataApi.md +2852 -0
  28. data/docs/District.md +21 -0
  29. data/docs/DistrictAdmin.md +12 -0
  30. data/docs/DistrictAdminObject.md +8 -0
  31. data/docs/DistrictAdminResponse.md +8 -0
  32. data/docs/DistrictAdminsResponse.md +9 -0
  33. data/docs/DistrictObject.md +8 -0
  34. data/docs/DistrictResponse.md +8 -0
  35. data/docs/DistrictadminsCreated.md +11 -0
  36. data/docs/DistrictadminsDeleted.md +11 -0
  37. data/docs/DistrictadminsUpdated.md +12 -0
  38. data/docs/DistrictsCreated.md +11 -0
  39. data/docs/DistrictsDeleted.md +11 -0
  40. data/docs/DistrictsResponse.md +9 -0
  41. data/docs/DistrictsUpdated.md +12 -0
  42. data/docs/Event.md +10 -0
  43. data/docs/EventResponse.md +8 -0
  44. data/docs/EventsApi.md +121 -0
  45. data/docs/EventsResponse.md +9 -0
  46. data/docs/InternalError.md +8 -0
  47. data/docs/Link.md +9 -0
  48. data/docs/Location.md +13 -0
  49. data/docs/Name.md +10 -0
  50. data/docs/NotFound.md +8 -0
  51. data/docs/Principal.md +9 -0
  52. data/docs/School.md +23 -0
  53. data/docs/SchoolAdmin.md +17 -0
  54. data/docs/SchoolAdminObject.md +8 -0
  55. data/docs/SchoolAdminResponse.md +8 -0
  56. data/docs/SchoolAdminsResponse.md +9 -0
  57. data/docs/SchoolEnrollment.md +10 -0
  58. data/docs/SchoolObject.md +8 -0
  59. data/docs/SchoolResponse.md +8 -0
  60. data/docs/SchooladminsCreated.md +11 -0
  61. data/docs/SchooladminsDeleted.md +11 -0
  62. data/docs/SchooladminsUpdated.md +12 -0
  63. data/docs/SchoolsCreated.md +11 -0
  64. data/docs/SchoolsDeleted.md +11 -0
  65. data/docs/SchoolsResponse.md +9 -0
  66. data/docs/SchoolsUpdated.md +12 -0
  67. data/docs/Section.md +24 -0
  68. data/docs/SectionObject.md +8 -0
  69. data/docs/SectionResponse.md +8 -0
  70. data/docs/SectionsCreated.md +11 -0
  71. data/docs/SectionsDeleted.md +11 -0
  72. data/docs/SectionsResponse.md +9 -0
  73. data/docs/SectionsUpdated.md +12 -0
  74. data/docs/Student.md +33 -0
  75. data/docs/StudentObject.md +8 -0
  76. data/docs/StudentResponse.md +8 -0
  77. data/docs/StudentsCreated.md +11 -0
  78. data/docs/StudentsDeleted.md +11 -0
  79. data/docs/StudentsResponse.md +9 -0
  80. data/docs/StudentsUpdated.md +12 -0
  81. data/docs/Teacher.md +21 -0
  82. data/docs/TeacherObject.md +8 -0
  83. data/docs/TeacherResponse.md +8 -0
  84. data/docs/TeachersCreated.md +11 -0
  85. data/docs/TeachersDeleted.md +11 -0
  86. data/docs/TeachersResponse.md +9 -0
  87. data/docs/TeachersUpdated.md +12 -0
  88. data/docs/Term.md +12 -0
  89. data/docs/TermObject.md +8 -0
  90. data/docs/TermResponse.md +8 -0
  91. data/docs/TermsCreated.md +11 -0
  92. data/docs/TermsDeleted.md +11 -0
  93. data/docs/TermsResponse.md +9 -0
  94. data/docs/TermsUpdated.md +12 -0
  95. data/git_push.sh +55 -0
  96. data/lib/clever-ruby.rb +124 -0
  97. data/lib/clever-ruby/api/data_api.rb +2798 -0
  98. data/lib/clever-ruby/api/events_api.rb +132 -0
  99. data/lib/clever-ruby/api_client.rb +414 -0
  100. data/lib/clever-ruby/api_error.rb +38 -0
  101. data/lib/clever-ruby/configuration.rb +209 -0
  102. data/lib/clever-ruby/models/admin_name.rb +193 -0
  103. data/lib/clever-ruby/models/bad_request.rb +184 -0
  104. data/lib/clever-ruby/models/contact.rb +325 -0
  105. data/lib/clever-ruby/models/contact_object.rb +184 -0
  106. data/lib/clever-ruby/models/contact_response.rb +184 -0
  107. data/lib/clever-ruby/models/contacts_created.rb +221 -0
  108. data/lib/clever-ruby/models/contacts_deleted.rb +221 -0
  109. data/lib/clever-ruby/models/contacts_response.rb +197 -0
  110. data/lib/clever-ruby/models/contacts_updated.rb +221 -0
  111. data/lib/clever-ruby/models/course.rb +211 -0
  112. data/lib/clever-ruby/models/course_object.rb +184 -0
  113. data/lib/clever-ruby/models/course_response.rb +184 -0
  114. data/lib/clever-ruby/models/courses_created.rb +221 -0
  115. data/lib/clever-ruby/models/courses_deleted.rb +221 -0
  116. data/lib/clever-ruby/models/courses_response.rb +197 -0
  117. data/lib/clever-ruby/models/courses_updated.rb +221 -0
  118. data/lib/clever-ruby/models/credentials.rb +184 -0
  119. data/lib/clever-ruby/models/district.rb +337 -0
  120. data/lib/clever-ruby/models/district_admin.rb +220 -0
  121. data/lib/clever-ruby/models/district_admin_object.rb +184 -0
  122. data/lib/clever-ruby/models/district_admin_response.rb +184 -0
  123. data/lib/clever-ruby/models/district_admins_response.rb +197 -0
  124. data/lib/clever-ruby/models/district_object.rb +184 -0
  125. data/lib/clever-ruby/models/district_response.rb +184 -0
  126. data/lib/clever-ruby/models/districtadmins_created.rb +221 -0
  127. data/lib/clever-ruby/models/districtadmins_deleted.rb +221 -0
  128. data/lib/clever-ruby/models/districtadmins_updated.rb +221 -0
  129. data/lib/clever-ruby/models/districts_created.rb +221 -0
  130. data/lib/clever-ruby/models/districts_deleted.rb +221 -0
  131. data/lib/clever-ruby/models/districts_response.rb +197 -0
  132. data/lib/clever-ruby/models/districts_updated.rb +221 -0
  133. data/lib/clever-ruby/models/event.rb +207 -0
  134. data/lib/clever-ruby/models/event_response.rb +184 -0
  135. data/lib/clever-ruby/models/events_response.rb +197 -0
  136. data/lib/clever-ruby/models/internal_error.rb +184 -0
  137. data/lib/clever-ruby/models/link.rb +227 -0
  138. data/lib/clever-ruby/models/location.rb +229 -0
  139. data/lib/clever-ruby/models/name.rb +202 -0
  140. data/lib/clever-ruby/models/not_found.rb +184 -0
  141. data/lib/clever-ruby/models/principal.rb +193 -0
  142. data/lib/clever-ruby/models/school.rb +365 -0
  143. data/lib/clever-ruby/models/school_admin.rb +267 -0
  144. data/lib/clever-ruby/models/school_admin_object.rb +184 -0
  145. data/lib/clever-ruby/models/school_admin_response.rb +184 -0
  146. data/lib/clever-ruby/models/school_admins_response.rb +197 -0
  147. data/lib/clever-ruby/models/school_enrollment.rb +202 -0
  148. data/lib/clever-ruby/models/school_object.rb +184 -0
  149. data/lib/clever-ruby/models/school_response.rb +184 -0
  150. data/lib/clever-ruby/models/schooladmins_created.rb +221 -0
  151. data/lib/clever-ruby/models/schooladmins_deleted.rb +221 -0
  152. data/lib/clever-ruby/models/schooladmins_updated.rb +221 -0
  153. data/lib/clever-ruby/models/schools_created.rb +221 -0
  154. data/lib/clever-ruby/models/schools_deleted.rb +221 -0
  155. data/lib/clever-ruby/models/schools_response.rb +197 -0
  156. data/lib/clever-ruby/models/schools_updated.rb +221 -0
  157. data/lib/clever-ruby/models/section.rb +378 -0
  158. data/lib/clever-ruby/models/section_object.rb +184 -0
  159. data/lib/clever-ruby/models/section_response.rb +184 -0
  160. data/lib/clever-ruby/models/sections_created.rb +221 -0
  161. data/lib/clever-ruby/models/sections_deleted.rb +221 -0
  162. data/lib/clever-ruby/models/sections_response.rb +197 -0
  163. data/lib/clever-ruby/models/sections_updated.rb +221 -0
  164. data/lib/clever-ruby/models/student.rb +507 -0
  165. data/lib/clever-ruby/models/student_object.rb +184 -0
  166. data/lib/clever-ruby/models/student_response.rb +184 -0
  167. data/lib/clever-ruby/models/students_created.rb +221 -0
  168. data/lib/clever-ruby/models/students_deleted.rb +221 -0
  169. data/lib/clever-ruby/models/students_response.rb +197 -0
  170. data/lib/clever-ruby/models/students_updated.rb +221 -0
  171. data/lib/clever-ruby/models/teacher.rb +303 -0
  172. data/lib/clever-ruby/models/teacher_object.rb +184 -0
  173. data/lib/clever-ruby/models/teacher_response.rb +184 -0
  174. data/lib/clever-ruby/models/teachers_created.rb +221 -0
  175. data/lib/clever-ruby/models/teachers_deleted.rb +221 -0
  176. data/lib/clever-ruby/models/teachers_response.rb +197 -0
  177. data/lib/clever-ruby/models/teachers_updated.rb +221 -0
  178. data/lib/clever-ruby/models/term.rb +220 -0
  179. data/lib/clever-ruby/models/term_object.rb +184 -0
  180. data/lib/clever-ruby/models/term_response.rb +184 -0
  181. data/lib/clever-ruby/models/terms_created.rb +221 -0
  182. data/lib/clever-ruby/models/terms_deleted.rb +221 -0
  183. data/lib/clever-ruby/models/terms_response.rb +197 -0
  184. data/lib/clever-ruby/models/terms_updated.rb +221 -0
  185. data/lib/clever-ruby/version.rb +15 -0
  186. data/override/README-extension.md +31 -0
  187. data/override/api_client.rb +414 -0
  188. data/override/models/contacts_created.rb +221 -0
  189. data/override/models/contacts_deleted.rb +221 -0
  190. data/override/models/contacts_updated.rb +221 -0
  191. data/override/models/courses_created.rb +221 -0
  192. data/override/models/courses_deleted.rb +221 -0
  193. data/override/models/courses_updated.rb +221 -0
  194. data/override/models/districtadmins_created.rb +221 -0
  195. data/override/models/districtadmins_deleted.rb +221 -0
  196. data/override/models/districtadmins_updated.rb +221 -0
  197. data/override/models/districts_created.rb +221 -0
  198. data/override/models/districts_deleted.rb +221 -0
  199. data/override/models/districts_updated.rb +221 -0
  200. data/override/models/schooladmins_created.rb +221 -0
  201. data/override/models/schooladmins_deleted.rb +221 -0
  202. data/override/models/schooladmins_updated.rb +221 -0
  203. data/override/models/schools_created.rb +221 -0
  204. data/override/models/schools_deleted.rb +221 -0
  205. data/override/models/schools_updated.rb +221 -0
  206. data/override/models/sections_created.rb +221 -0
  207. data/override/models/sections_deleted.rb +221 -0
  208. data/override/models/sections_updated.rb +221 -0
  209. data/override/models/students_created.rb +221 -0
  210. data/override/models/students_deleted.rb +221 -0
  211. data/override/models/students_updated.rb +221 -0
  212. data/override/models/teachers_created.rb +221 -0
  213. data/override/models/teachers_deleted.rb +221 -0
  214. data/override/models/teachers_updated.rb +221 -0
  215. data/override/models/terms_created.rb +221 -0
  216. data/override/models/terms_deleted.rb +221 -0
  217. data/override/models/terms_updated.rb +221 -0
  218. data/override/override.sh +27 -0
  219. data/sample/sample.rb +16 -0
  220. data/spec/api/data_api_spec.rb +671 -0
  221. data/spec/api/events_api_spec.rb +61 -0
  222. data/spec/api_client_spec.rb +226 -0
  223. data/spec/configuration_spec.rb +42 -0
  224. data/spec/events.json +227 -0
  225. data/spec/models/bad_request_spec.rb +41 -0
  226. data/spec/models/contact_object_spec.rb +41 -0
  227. data/spec/models/contact_response_spec.rb +41 -0
  228. data/spec/models/contact_spec.rb +107 -0
  229. data/spec/models/contacts_created_spec.rb +59 -0
  230. data/spec/models/contacts_deleted_spec.rb +59 -0
  231. data/spec/models/contacts_response_spec.rb +41 -0
  232. data/spec/models/contacts_updated_spec.rb +65 -0
  233. data/spec/models/course_object_spec.rb +41 -0
  234. data/spec/models/course_response_spec.rb +41 -0
  235. data/spec/models/course_spec.rb +59 -0
  236. data/spec/models/courses_created_spec.rb +59 -0
  237. data/spec/models/courses_deleted_spec.rb +59 -0
  238. data/spec/models/courses_response_spec.rb +41 -0
  239. data/spec/models/courses_updated_spec.rb +65 -0
  240. data/spec/models/credentials_spec.rb +41 -0
  241. data/spec/models/district_admin_object_spec.rb +41 -0
  242. data/spec/models/district_admin_response_spec.rb +41 -0
  243. data/spec/models/district_admin_spec.rb +65 -0
  244. data/spec/models/district_admins_response_spec.rb +41 -0
  245. data/spec/models/district_object_spec.rb +41 -0
  246. data/spec/models/district_response_spec.rb +41 -0
  247. data/spec/models/district_spec.rb +123 -0
  248. data/spec/models/districtadmins_created_spec.rb +59 -0
  249. data/spec/models/districtadmins_deleted_spec.rb +59 -0
  250. data/spec/models/districtadmins_updated_spec.rb +65 -0
  251. data/spec/models/districts_created_spec.rb +59 -0
  252. data/spec/models/districts_deleted_spec.rb +59 -0
  253. data/spec/models/districts_response_spec.rb +41 -0
  254. data/spec/models/districts_updated_spec.rb +65 -0
  255. data/spec/models/event_response_spec.rb +41 -0
  256. data/spec/models/event_spec.rb +53 -0
  257. data/spec/models/events_response_spec.rb +41 -0
  258. data/spec/models/internal_error_spec.rb +41 -0
  259. data/spec/models/location_spec.rb +71 -0
  260. data/spec/models/name_spec.rb +53 -0
  261. data/spec/models/not_found_spec.rb +41 -0
  262. data/spec/models/principal_spec.rb +47 -0
  263. data/spec/models/school_admin_object_spec.rb +41 -0
  264. data/spec/models/school_admin_response_spec.rb +41 -0
  265. data/spec/models/school_admin_spec.rb +95 -0
  266. data/spec/models/school_admins_response_spec.rb +41 -0
  267. data/spec/models/school_enrollment_spec.rb +53 -0
  268. data/spec/models/school_object_spec.rb +41 -0
  269. data/spec/models/school_response_spec.rb +41 -0
  270. data/spec/models/school_spec.rb +139 -0
  271. data/spec/models/schooladmins_created_spec.rb +59 -0
  272. data/spec/models/schooladmins_deleted_spec.rb +59 -0
  273. data/spec/models/schooladmins_updated_spec.rb +65 -0
  274. data/spec/models/schools_created_spec.rb +59 -0
  275. data/spec/models/schools_deleted_spec.rb +59 -0
  276. data/spec/models/schools_response_spec.rb +41 -0
  277. data/spec/models/schools_updated_spec.rb +65 -0
  278. data/spec/models/section_object_spec.rb +41 -0
  279. data/spec/models/section_response_spec.rb +41 -0
  280. data/spec/models/section_spec.rb +145 -0
  281. data/spec/models/sections_created_spec.rb +59 -0
  282. data/spec/models/sections_deleted_spec.rb +59 -0
  283. data/spec/models/sections_response_spec.rb +41 -0
  284. data/spec/models/sections_updated_spec.rb +65 -0
  285. data/spec/models/student_object_spec.rb +41 -0
  286. data/spec/models/student_response_spec.rb +41 -0
  287. data/spec/models/student_spec.rb +215 -0
  288. data/spec/models/students_created_spec.rb +59 -0
  289. data/spec/models/students_deleted_spec.rb +59 -0
  290. data/spec/models/students_response_spec.rb +41 -0
  291. data/spec/models/students_updated_spec.rb +65 -0
  292. data/spec/models/teacher_object_spec.rb +41 -0
  293. data/spec/models/teacher_response_spec.rb +41 -0
  294. data/spec/models/teacher_spec.rb +119 -0
  295. data/spec/models/teachers_created_spec.rb +59 -0
  296. data/spec/models/teachers_deleted_spec.rb +59 -0
  297. data/spec/models/teachers_response_spec.rb +41 -0
  298. data/spec/models/teachers_updated_spec.rb +65 -0
  299. data/spec/models/term_object_spec.rb +41 -0
  300. data/spec/models/term_response_spec.rb +41 -0
  301. data/spec/models/term_spec.rb +65 -0
  302. data/spec/models/terms_created_spec.rb +59 -0
  303. data/spec/models/terms_deleted_spec.rb +59 -0
  304. data/spec/models/terms_response_spec.rb +41 -0
  305. data/spec/models/terms_updated_spec.rb +65 -0
  306. data/spec/spec_helper.rb +103 -0
  307. data/tags +1681 -0
  308. metadata +636 -0
@@ -0,0 +1,61 @@
1
+ =begin
2
+ #Clever API
3
+
4
+ #The Clever API
5
+
6
+ OpenAPI spec version: 2.1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.8
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for Clever::EventsApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'EventsApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = Clever::EventsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of EventsApi' do
30
+ it 'should create an instance of EventsApi' do
31
+ expect(@instance).to be_instance_of(Clever::EventsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_event
36
+ # Returns the specific event
37
+ # @param id
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [EventResponse]
40
+ describe 'get_event test' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ # unit tests for get_events
47
+ # Returns a list of events
48
+ # @param [Hash] opts the optional parameters
49
+ # @option opts [Integer] :limit
50
+ # @option opts [String] :starting_after
51
+ # @option opts [String] :ending_before
52
+ # @option opts [String] :school
53
+ # @option opts [Array<String>] :record_type
54
+ # @return [EventsResponse]
55
+ describe 'get_events test' do
56
+ it 'should work' do
57
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
58
+ end
59
+ end
60
+
61
+ end
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #Clever API
3
+
4
+ #The Clever API
5
+
6
+ OpenAPI spec version: 2.1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.8
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe Clever::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ Clever.configure { |c| c.host = 'http://example.com' }
21
+ expect(Clever::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ Clever.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(Clever::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ Clever.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(Clever::Configuration.default.host).to eq('hobo.com')
32
+ end
33
+ end
34
+
35
+ context 'base_path' do
36
+ it "prepends a slash to base_path" do
37
+ Clever.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(Clever::Configuration.default.base_path).to eq('/v4/dog')
39
+ end
40
+
41
+ it "doesn't prepend a slash if one is already there" do
42
+ Clever.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(Clever::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ Clever.configure { |c| c.base_path = nil }
48
+ expect(Clever::Configuration.default.base_path).to eq('')
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ describe 'params_encoding in #build_request' do
55
+ let(:config) { Clever::Configuration.new }
56
+ let(:api_client) { Clever::ApiClient.new(config) }
57
+
58
+ it 'defaults to nil' do
59
+ expect(Clever::Configuration.default.params_encoding).to eq(nil)
60
+ expect(config.params_encoding).to eq(nil)
61
+
62
+ request = api_client.build_request(:get, '/test')
63
+ expect(request.options[:params_encoding]).to eq(nil)
64
+ end
65
+
66
+ it 'can be customized' do
67
+ config.params_encoding = :multi
68
+ request = api_client.build_request(:get, '/test')
69
+ expect(request.options[:params_encoding]).to eq(:multi)
70
+ end
71
+ end
72
+
73
+ describe 'timeout in #build_request' do
74
+ let(:config) { Clever::Configuration.new }
75
+ let(:api_client) { Clever::ApiClient.new(config) }
76
+
77
+ it 'defaults to 0' do
78
+ expect(Clever::Configuration.default.timeout).to eq(0)
79
+ expect(config.timeout).to eq(0)
80
+
81
+ request = api_client.build_request(:get, '/test')
82
+ expect(request.options[:timeout]).to eq(0)
83
+ end
84
+
85
+ it 'can be customized' do
86
+ config.timeout = 100
87
+ request = api_client.build_request(:get, '/test')
88
+ expect(request.options[:timeout]).to eq(100)
89
+ end
90
+ end
91
+
92
+ describe '#deserialize' do
93
+ it "handles Array<Integer>" do
94
+ api_client = Clever::ApiClient.new
95
+ headers = { 'Content-Type' => 'application/json' }
96
+ response = double('response', headers: headers, body: '[12, 34]')
97
+ data = api_client.deserialize(response, 'Array<Integer>')
98
+ expect(data).to be_instance_of(Array)
99
+ expect(data).to eq([12, 34])
100
+ end
101
+
102
+ it 'handles Array<Array<Integer>>' do
103
+ api_client = Clever::ApiClient.new
104
+ headers = { 'Content-Type' => 'application/json' }
105
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
+ expect(data).to be_instance_of(Array)
108
+ expect(data).to eq([[12, 34], [56]])
109
+ end
110
+
111
+ it 'handles Hash<String, String>' do
112
+ api_client = Clever::ApiClient.new
113
+ headers = { 'Content-Type' => 'application/json' }
114
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
115
+ data = api_client.deserialize(response, 'Hash<String, String>')
116
+ expect(data).to be_instance_of(Hash)
117
+ expect(data).to eq(:message => 'Hello')
118
+ end
119
+ end
120
+
121
+ describe "#object_to_hash" do
122
+ it 'ignores nils and includes empty arrays' do
123
+ # uncomment below to test object_to_hash for model
124
+ # api_client = Clever::ApiClient.new
125
+ # _model = Clever::ModelName.new
126
+ # update the model attribute below
127
+ # _model.id = 1
128
+ # update the expected value (hash) below
129
+ # expected = {id: 1, name: '', tags: []}
130
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
131
+ end
132
+ end
133
+
134
+ describe '#build_collection_param' do
135
+ let(:param) { ['aa', 'bb', 'cc'] }
136
+ let(:api_client) { Clever::ApiClient.new }
137
+
138
+ it 'works for csv' do
139
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
+ end
141
+
142
+ it 'works for ssv' do
143
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
+ end
145
+
146
+ it 'works for tsv' do
147
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
+ end
149
+
150
+ it 'works for pipes' do
151
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
+ end
153
+
154
+ it 'works for multi' do
155
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
+ end
157
+
158
+ it 'fails for invalid collection format' do
159
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
+ end
161
+ end
162
+
163
+ describe '#json_mime?' do
164
+ let(:api_client) { Clever::ApiClient.new }
165
+
166
+ it 'works' do
167
+ expect(api_client.json_mime?(nil)).to eq false
168
+ expect(api_client.json_mime?('')).to eq false
169
+
170
+ expect(api_client.json_mime?('application/json')).to eq true
171
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
+
174
+ expect(api_client.json_mime?('application/xml')).to eq false
175
+ expect(api_client.json_mime?('text/plain')).to eq false
176
+ expect(api_client.json_mime?('application/jsonp')).to eq false
177
+ end
178
+ end
179
+
180
+ describe '#select_header_accept' do
181
+ let(:api_client) { Clever::ApiClient.new }
182
+
183
+ it 'works' do
184
+ expect(api_client.select_header_accept(nil)).to be_nil
185
+ expect(api_client.select_header_accept([])).to be_nil
186
+
187
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
+
191
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
+ end
194
+ end
195
+
196
+ describe '#select_header_content_type' do
197
+ let(:api_client) { Clever::ApiClient.new }
198
+
199
+ it 'works' do
200
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
201
+ expect(api_client.select_header_content_type([])).to eq('application/json')
202
+
203
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
+ end
209
+ end
210
+
211
+ describe '#sanitize_filename' do
212
+ let(:api_client) { Clever::ApiClient.new }
213
+
214
+ it 'works' do
215
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
216
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
+ end
225
+ end
226
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #Clever API
3
+
4
+ #The Clever API
5
+
6
+ OpenAPI spec version: 2.1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.8
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe Clever::Configuration do
16
+ let(:config) { Clever::Configuration.default }
17
+
18
+ before(:each) do
19
+ # uncomment below to setup host and base_path
20
+ # require 'URI'
21
+ # uri = URI.parse("https://api.clever.com/v2.1")
22
+ # Clever.configure do |c|
23
+ # c.host = uri.host
24
+ # c.base_path = uri.path
25
+ # end
26
+ end
27
+
28
+ describe '#base_url' do
29
+ it 'should have the default value' do
30
+ # uncomment below to test default value of the base path
31
+ # expect(config.base_url).to eq("https://api.clever.com/v2.1")
32
+ end
33
+
34
+ it 'should remove trailing slashes' do
35
+ [nil, '', '/', '//'].each do |base_path|
36
+ config.base_path = base_path
37
+ # uncomment below to test trailing slashes
38
+ # expect(config.base_url).to eq("https://api.clever.com/v2.1")
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,227 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "data": {
5
+ "created": "2017-06-15T21:54:10.025Z",
6
+ "data": {
7
+ "object": {
8
+ "district": "56e07f73944b620100000175",
9
+ "ell_status": "N",
10
+ "id": "58c81dcea3627927150003ed"
11
+ },
12
+ "previous_attributes": {
13
+ "created": "2017-03-14T16:43:58.151Z",
14
+ "credentials": {
15
+ "district_username": "stevez33"
16
+ },
17
+ "dob": "2/11/2007",
18
+ "email": "z.steve@example.net",
19
+ "gender": "M",
20
+ "grade": "Kindergarten",
21
+ "hispanic_ethnicity": "Y",
22
+ "location": {
23
+ "zip": "10459"
24
+ },
25
+ "name": {
26
+ "first": "Steve",
27
+ "last": "Ziemann",
28
+ "middle": "G"
29
+ },
30
+ "race": "Black or African American",
31
+ "school": "58c81db226d0809114000007",
32
+ "schools": [
33
+ "58c81db226d0809114000007"
34
+ ],
35
+ "sis_id": "100095233",
36
+ "state_id": "231786324",
37
+ "student_number": "100095233"
38
+ }
39
+ },
40
+ "id": "594301ff7f264e3ca45e568b",
41
+ "type": "students.updated"
42
+ },
43
+ "uri": "/v1.2/events/594301ff7f264e3ca45e568b"
44
+ },
45
+ {
46
+ "data": {
47
+ "created": "2017-06-15T21:54:10.026Z",
48
+ "data": {
49
+ "object": {
50
+ "district": "56e07f73944b620100000175",
51
+ "ell_status": "Y",
52
+ "id": "58c81dcea3627927150003ee"
53
+ },
54
+ "previous_attributes": {
55
+ "created": "2017-03-14T16:43:58.152Z",
56
+ "credentials": {
57
+ "district_username": "douglasw58"
58
+ },
59
+ "dob": "6/18/1998",
60
+ "email": "w_douglas@example.net",
61
+ "gender": "M",
62
+ "grade": "9",
63
+ "hispanic_ethnicity": "N",
64
+ "location": {
65
+ "zip": "11004"
66
+ },
67
+ "name": {
68
+ "first": "Douglas",
69
+ "last": "Wisoky",
70
+ "middle": "S"
71
+ },
72
+ "race": "Caucasian",
73
+ "school": "58c81db226d0809114000006",
74
+ "schools": [
75
+ "58c81db226d0809114000006",
76
+ "58c81db226d0809114000007"
77
+ ],
78
+ "sis_id": "101565758",
79
+ "state_id": "498006597",
80
+ "student_number": "101565758"
81
+ }
82
+ },
83
+ "id": "594301ff7f264e3ca45e568c",
84
+ "type": "students.updated"
85
+ },
86
+ "uri": "/v1.2/events/594301ff7f264e3ca45e568c"
87
+ },
88
+ {
89
+ "data": {
90
+ "created": "2017-06-15T21:54:10.028Z",
91
+ "data": {
92
+ "object": {
93
+ "district": "56e07f73944b620100000175",
94
+ "ell_status": "Y",
95
+ "id": "58c81dcea3627927150003ef"
96
+ },
97
+ "previous_attributes": {
98
+ "created": "2017-03-14T16:43:58.153Z",
99
+ "credentials": {
100
+ "district_username": "joel42"
101
+ },
102
+ "dob": "7/4/1997",
103
+ "email": "l.joe@example.net",
104
+ "gender": "M",
105
+ "grade": "10",
106
+ "hispanic_ethnicity": "N",
107
+ "location": {
108
+ "zip": "10473"
109
+ },
110
+ "name": {
111
+ "first": "Joe",
112
+ "last": "Lakin",
113
+ "middle": "S"
114
+ },
115
+ "race": "Black or African American",
116
+ "school": "58c81db226d0809114000006",
117
+ "schools": [
118
+ "58c81db226d0809114000006"
119
+ ],
120
+ "sis_id": "106078142",
121
+ "state_id": "635493722",
122
+ "student_number": "106078142"
123
+ }
124
+ },
125
+ "id": "594301ff7f264e3ca45e568d",
126
+ "type": "students.updated"
127
+ },
128
+ "uri": "/v1.2/events/594301ff7f264e3ca45e568d"
129
+ },
130
+ {
131
+ "data": {
132
+ "created": "2017-07-13T16:28:38.377Z",
133
+ "data": {
134
+ "object": {
135
+ "created": "2017-07-11T16:05:51.740Z",
136
+ "credentials": {
137
+ "district_username": "marthag20marthag20marthag20marthag20marthag20martha"
138
+ },
139
+ "district": "58da8a43cc70ab00017a1a87",
140
+ "dob": "4/2/1998",
141
+ "email": "g_martha@example.org",
142
+ "gender": "F",
143
+ "grade": "9",
144
+ "hispanic_ethnicity": "N",
145
+ "id": "59496080827927905b00076d",
146
+ "last_modified": "2017-07-11T16:05:51.740Z",
147
+ "location": {
148
+ "zip": "11694"
149
+ },
150
+ "name": {
151
+ "first": "Martha",
152
+ "last": "Greenholt",
153
+ "middle": "T"
154
+ },
155
+ "race": "Asian",
156
+ "school": "58da8c58155b940248000006",
157
+ "schools": [
158
+ "58da8c58155b940248000006",
159
+ "58da8c58155b940248000007"
160
+ ],
161
+ "sis_id": "9131139200",
162
+ "state_id": "975729843",
163
+ "student_number": "913113920"
164
+ }
165
+ },
166
+ "id": "59679fb5893d055bc095ede7",
167
+ "type": "students.deleted"
168
+ },
169
+ "uri": "/v1.2/events/59679fb5893d055bc095ede7"
170
+ },
171
+ {
172
+ "data": {
173
+ "created": "2017-06-27T21:58:00.811Z",
174
+ "data": {
175
+ "object": {
176
+ "created": "2017-03-28T16:16:35.369Z",
177
+ "credentials": {
178
+ "district_username": "mial61"
179
+ },
180
+ "district": "58da8a43cc70ab00017a1a87",
181
+ "dob": "11/10/2002",
182
+ "email": "l_mia@example.org",
183
+ "gender": "F",
184
+ "grade": "5",
185
+ "hispanic_ethnicity": "N",
186
+ "id": "58da8c63d7dc0ca068000450",
187
+ "last_modified": "2017-03-28T16:16:35.369Z",
188
+ "location": {
189
+ "zip": "10002"
190
+ },
191
+ "name": {
192
+ "first": "Mia",
193
+ "last": "Lindgren",
194
+ "middle": "J"
195
+ },
196
+ "race": "Black or African American",
197
+ "school": "58da8c58155b940248000007",
198
+ "schools": [
199
+ "58da8c58155b940248000007"
200
+ ],
201
+ "sis_id": "189492161",
202
+ "state_id": "661166974",
203
+ "student_number": "189492161"
204
+ }
205
+ },
206
+ "id": "5952d4e3ed859521b85c6283",
207
+ "type": "students.created"
208
+ },
209
+ "uri": "/v1.2/events/5952d4e3ed859521b85c6283"
210
+ }
211
+ ],
212
+ "links": [
213
+ {
214
+ "rel": "self",
215
+ "uri": "/v1.2/events?limit=5"
216
+ },
217
+ {
218
+ "rel": "next",
219
+ "uri": "/v1.2/events?limit=5&starting_after=594301ff7f264e3ca45e568f"
220
+ }
221
+ ],
222
+ "paging": {
223
+ "count": 12000,
224
+ "current": 1,
225
+ "total": 2400
226
+ }
227
+ }