clever-ruby 1.2.5 → 2.0.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 (171) hide show
  1. checksums.yaml +4 -4
  2. data/1.8, +0 -0
  3. data/= +0 -0
  4. data/CHANGELOG.md +3 -3
  5. data/Gemfile +0 -1
  6. data/Gemfile.lock +8 -9
  7. data/README.md +89 -70
  8. data/clever-ruby.gemspec +3 -4
  9. data/doc_coverage.txt +2 -0
  10. data/docs/{StudentContact.md → Contact.md} +2 -2
  11. data/docs/{GradeLevelsResponse.md → ContactObject.md} +2 -2
  12. data/docs/{StudentContactObject.md → ContactResponse.md} +2 -2
  13. data/docs/{StudentcontactsCreated.md → ContactsCreated.md} +2 -2
  14. data/docs/{StudentcontactsDeleted.md → ContactsDeleted.md} +2 -2
  15. data/docs/ContactsResponse.md +8 -0
  16. data/docs/{StudentcontactsUpdated.md → ContactsUpdated.md} +2 -2
  17. data/docs/Course.md +10 -0
  18. data/docs/{StudentContactResponse.md → CourseObject.md} +2 -2
  19. data/docs/CourseResponse.md +8 -0
  20. data/docs/CoursesCreated.md +11 -0
  21. data/docs/CoursesDeleted.md +11 -0
  22. data/docs/{StudentContactsForStudentResponse.md → CoursesResponse.md} +2 -2
  23. data/docs/CoursesUpdated.md +11 -0
  24. data/docs/DataApi.md +862 -182
  25. data/docs/District.md +8 -0
  26. data/docs/{DistrictStatusResponse.md → DistrictAdminObject.md} +2 -2
  27. data/docs/DistrictAdminsResponse.md +1 -1
  28. data/docs/DistrictadminsCreated.md +11 -0
  29. data/docs/DistrictadminsDeleted.md +11 -0
  30. data/docs/DistrictadminsUpdated.md +11 -0
  31. data/docs/EventsApi.md +6 -302
  32. data/docs/Section.md +2 -4
  33. data/docs/Term.md +1 -0
  34. data/docs/TermObject.md +8 -0
  35. data/docs/TermResponse.md +8 -0
  36. data/docs/TermsCreated.md +11 -0
  37. data/docs/TermsDeleted.md +11 -0
  38. data/docs/TermsResponse.md +8 -0
  39. data/docs/TermsUpdated.md +11 -0
  40. data/lib/clever-ruby.rb +26 -14
  41. data/lib/clever-ruby/api/data_api.rb +828 -132
  42. data/lib/clever-ruby/api/events_api.rb +8 -312
  43. data/lib/clever-ruby/api_client.rb +40 -27
  44. data/lib/clever-ruby/api_error.rb +2 -2
  45. data/lib/clever-ruby/configuration.rb +3 -3
  46. data/lib/clever-ruby/models/bad_request.rb +2 -2
  47. data/lib/clever-ruby/models/{student_contact.rb → contact.rb} +69 -10
  48. data/lib/clever-ruby/models/{student_contact_object.rb → contact_object.rb} +4 -4
  49. data/lib/clever-ruby/models/{student_contact_response.rb → contact_response.rb} +4 -4
  50. data/lib/clever-ruby/models/contacts_created.rb +221 -0
  51. data/lib/clever-ruby/models/contacts_deleted.rb +221 -0
  52. data/lib/clever-ruby/models/{student_contacts_response.rb → contacts_response.rb} +4 -4
  53. data/lib/clever-ruby/models/contacts_updated.rb +221 -0
  54. data/lib/clever-ruby/models/course.rb +206 -0
  55. data/lib/clever-ruby/models/course_object.rb +188 -0
  56. data/lib/clever-ruby/models/{district_status_response.rb → course_response.rb} +4 -4
  57. data/lib/clever-ruby/models/courses_created.rb +221 -0
  58. data/lib/clever-ruby/models/courses_deleted.rb +221 -0
  59. data/lib/clever-ruby/models/{district_status_responses.rb → courses_response.rb} +4 -4
  60. data/lib/clever-ruby/models/courses_updated.rb +221 -0
  61. data/lib/clever-ruby/models/credentials.rb +2 -2
  62. data/lib/clever-ruby/models/district.rb +111 -6
  63. data/lib/clever-ruby/models/district_admin.rb +2 -2
  64. data/lib/clever-ruby/models/district_admin_object.rb +188 -0
  65. data/lib/clever-ruby/models/district_admin_response.rb +2 -2
  66. data/lib/clever-ruby/models/district_admins_response.rb +3 -3
  67. data/lib/clever-ruby/models/district_object.rb +2 -2
  68. data/lib/clever-ruby/models/district_response.rb +2 -2
  69. data/lib/clever-ruby/models/districtadmins_created.rb +221 -0
  70. data/lib/clever-ruby/models/districtadmins_deleted.rb +221 -0
  71. data/lib/clever-ruby/models/districtadmins_updated.rb +221 -0
  72. data/lib/clever-ruby/models/districts_created.rb +22 -7
  73. data/lib/clever-ruby/models/districts_deleted.rb +22 -8
  74. data/lib/clever-ruby/models/districts_response.rb +2 -2
  75. data/lib/clever-ruby/models/districts_updated.rb +21 -7
  76. data/lib/clever-ruby/models/event.rb +2 -2
  77. data/lib/clever-ruby/models/event_response.rb +2 -2
  78. data/lib/clever-ruby/models/events_response.rb +2 -2
  79. data/lib/clever-ruby/models/internal_error.rb +2 -2
  80. data/lib/clever-ruby/models/location.rb +2 -2
  81. data/lib/clever-ruby/models/name.rb +2 -2
  82. data/lib/clever-ruby/models/not_found.rb +2 -2
  83. data/lib/clever-ruby/models/principal.rb +2 -2
  84. data/lib/clever-ruby/models/school.rb +2 -2
  85. data/lib/clever-ruby/models/school_admin.rb +2 -2
  86. data/lib/clever-ruby/models/school_admin_object.rb +2 -2
  87. data/lib/clever-ruby/models/school_admin_response.rb +2 -2
  88. data/lib/clever-ruby/models/school_admins_response.rb +2 -2
  89. data/lib/clever-ruby/models/school_object.rb +2 -2
  90. data/lib/clever-ruby/models/school_response.rb +2 -2
  91. data/lib/clever-ruby/models/schooladmins_created.rb +21 -7
  92. data/lib/clever-ruby/models/schooladmins_deleted.rb +21 -7
  93. data/lib/clever-ruby/models/schooladmins_updated.rb +21 -7
  94. data/lib/clever-ruby/models/schools_created.rb +21 -7
  95. data/lib/clever-ruby/models/schools_deleted.rb +21 -7
  96. data/lib/clever-ruby/models/schools_response.rb +2 -2
  97. data/lib/clever-ruby/models/schools_updated.rb +21 -7
  98. data/lib/clever-ruby/models/section.rb +15 -33
  99. data/lib/clever-ruby/models/section_object.rb +2 -2
  100. data/lib/clever-ruby/models/section_response.rb +2 -2
  101. data/lib/clever-ruby/models/sections_created.rb +21 -7
  102. data/lib/clever-ruby/models/sections_deleted.rb +21 -7
  103. data/lib/clever-ruby/models/sections_response.rb +2 -2
  104. data/lib/clever-ruby/models/sections_updated.rb +21 -7
  105. data/lib/clever-ruby/models/student.rb +4 -4
  106. data/lib/clever-ruby/models/student_object.rb +2 -2
  107. data/lib/clever-ruby/models/student_response.rb +2 -2
  108. data/lib/clever-ruby/models/students_created.rb +20 -7
  109. data/lib/clever-ruby/models/students_deleted.rb +22 -7
  110. data/lib/clever-ruby/models/students_response.rb +2 -2
  111. data/lib/clever-ruby/models/students_updated.rb +21 -7
  112. data/lib/clever-ruby/models/teacher.rb +2 -2
  113. data/lib/clever-ruby/models/teacher_object.rb +2 -2
  114. data/lib/clever-ruby/models/teacher_response.rb +2 -2
  115. data/lib/clever-ruby/models/teachers_created.rb +21 -7
  116. data/lib/clever-ruby/models/teachers_deleted.rb +21 -7
  117. data/lib/clever-ruby/models/teachers_response.rb +2 -2
  118. data/lib/clever-ruby/models/teachers_updated.rb +21 -7
  119. data/lib/clever-ruby/models/term.rb +12 -3
  120. data/lib/clever-ruby/models/term_object.rb +188 -0
  121. data/lib/clever-ruby/models/term_response.rb +188 -0
  122. data/lib/clever-ruby/models/{studentcontacts_updated.rb → terms_created.rb} +23 -9
  123. data/{override/models/studentcontacts_created.rb → lib/clever-ruby/models/terms_deleted.rb} +23 -9
  124. data/lib/clever-ruby/models/{grade_levels_response.rb → terms_response.rb} +4 -4
  125. data/lib/clever-ruby/models/{studentcontacts_created.rb → terms_updated.rb} +23 -9
  126. data/lib/clever-ruby/version.rb +3 -3
  127. data/override/README-extension.md +5 -5
  128. data/override/api_client.rb +40 -27
  129. data/override/models/contacts_created.rb +221 -0
  130. data/override/models/contacts_deleted.rb +221 -0
  131. data/override/models/contacts_updated.rb +221 -0
  132. data/override/models/courses_created.rb +221 -0
  133. data/override/models/courses_deleted.rb +221 -0
  134. data/override/models/courses_updated.rb +221 -0
  135. data/override/models/districtadmins_created.rb +221 -0
  136. data/override/models/districtadmins_deleted.rb +221 -0
  137. data/override/models/districtadmins_updated.rb +221 -0
  138. data/override/models/districts_created.rb +22 -7
  139. data/override/models/districts_deleted.rb +22 -8
  140. data/override/models/districts_updated.rb +21 -7
  141. data/override/models/schooladmins_created.rb +21 -7
  142. data/override/models/schooladmins_deleted.rb +21 -7
  143. data/override/models/schooladmins_updated.rb +21 -7
  144. data/override/models/schools_created.rb +21 -7
  145. data/override/models/schools_deleted.rb +21 -7
  146. data/override/models/schools_updated.rb +21 -7
  147. data/override/models/sections_created.rb +21 -7
  148. data/override/models/sections_deleted.rb +21 -7
  149. data/override/models/sections_updated.rb +21 -7
  150. data/override/models/students_created.rb +20 -7
  151. data/override/models/students_deleted.rb +22 -7
  152. data/override/models/students_updated.rb +21 -7
  153. data/override/models/teachers_created.rb +21 -7
  154. data/override/models/teachers_deleted.rb +21 -7
  155. data/override/models/teachers_updated.rb +21 -7
  156. data/{lib/clever-ruby/models/studentcontacts_deleted.rb → override/models/terms_created.rb} +23 -9
  157. data/override/models/terms_deleted.rb +221 -0
  158. data/override/models/terms_updated.rb +221 -0
  159. data/sample/sample.rb +2 -2
  160. data/spec/events_api_spec.rb +1 -1
  161. data/test.rb +1 -1
  162. metadata +111 -85
  163. data/clever-ruby-2.0.0.gem +0 -0
  164. data/docs/DistrictStatus.md +0 -15
  165. data/docs/DistrictStatusResponses.md +0 -8
  166. data/docs/StudentContactsResponse.md +0 -8
  167. data/lib/clever-ruby/models/district_status.rb +0 -284
  168. data/lib/clever-ruby/models/student_contacts_for_student_response.rb +0 -190
  169. data/override/models/studentcontacts_deleted.rb +0 -207
  170. data/override/models/studentcontacts_updated.rb +0 -207
  171. data/spec/data_api_spec.rb +0 -32
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #Clever API
3
+
4
+ #The Clever API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Clever
16
+
17
+ class Course
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :number
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'name' => :'name',
30
+ :'number' => :'number'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ :'id' => :'String',
38
+ :'name' => :'String',
39
+ :'number' => :'String'
40
+ }
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+ if attributes.has_key?(:'id')
52
+ self.id = attributes[:'id']
53
+ end
54
+
55
+ if attributes.has_key?(:'name')
56
+ self.name = attributes[:'name']
57
+ end
58
+
59
+ if attributes.has_key?(:'number')
60
+ self.number = attributes[:'number']
61
+ end
62
+
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properies with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ return invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ id == o.id &&
84
+ name == o.name &&
85
+ number == o.number
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Fixnum] Hash code
96
+ def hash
97
+ [id, name, number].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.swagger_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :BOOLEAN
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ temp_model = Clever.const_get(type).new
158
+ temp_model.build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ next if value.nil?
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map{ |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+
204
+ end
205
+
206
+ end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #Clever API
3
+
4
+ #The Clever API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Clever
16
+
17
+ class CourseObject
18
+ attr_accessor :object
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'object' => :'object'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'object' => :'Course'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'object')
44
+ self.object = attributes[:'object']
45
+ end
46
+
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properies with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ return invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ object == o.object
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [object].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = Clever.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
172
+ def _to_hash(value)
173
+ if value.is_a?(Array)
174
+ value.compact.map{ |v| _to_hash(v) }
175
+ elsif value.is_a?(Hash)
176
+ {}.tap do |hash|
177
+ value.each { |k, v| hash[k] = _to_hash(v) }
178
+ end
179
+ elsif value.respond_to? :to_hash
180
+ value.to_hash
181
+ else
182
+ value
183
+ end
184
+ end
185
+
186
+ end
187
+
188
+ end
@@ -3,10 +3,10 @@
3
3
 
4
4
  #The Clever API
5
5
 
6
- OpenAPI spec version: 1.2.0
6
+ OpenAPI spec version: 2.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
 
15
15
  module Clever
16
16
 
17
- class DistrictStatusResponse
17
+ class CourseResponse
18
18
  attr_accessor :data
19
19
 
20
20
 
@@ -28,7 +28,7 @@ module Clever
28
28
  # Attribute type mapping.
29
29
  def self.swagger_types
30
30
  {
31
- :'data' => :'DistrictStatus'
31
+ :'data' => :'Course'
32
32
  }
33
33
  end
34
34
 
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Clever API
3
+
4
+ #The Clever API
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require File.expand_path('../event.rb', __FILE__)
15
+
16
+ module Clever
17
+
18
+ class CoursesCreated < Event
19
+ attr_accessor :created
20
+
21
+ attr_accessor :id
22
+
23
+ attr_accessor :type
24
+
25
+ attr_accessor :data
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'created' => :'created',
32
+ :'id' => :'id',
33
+ :'type' => :'type',
34
+ :'data' => :'data'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ :'created' => :'String',
42
+ :'id' => :'String',
43
+ :'type' => :'String',
44
+ :'data' => :'CourseObject'
45
+ }
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ return unless attributes.is_a?(Hash)
52
+
53
+ # convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
55
+
56
+ if attributes.has_key?(:'created')
57
+ self.created = attributes[:'created']
58
+ end
59
+
60
+ if attributes.has_key?(:'id')
61
+ self.id = attributes[:'id']
62
+ end
63
+
64
+ if attributes.has_key?(:'type')
65
+ self.type = attributes[:'type']
66
+ end
67
+
68
+ if attributes.has_key?(:'data')
69
+ self.data = attributes[:'data']
70
+ end
71
+
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properies with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if @type.nil?
79
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
80
+ end
81
+
82
+ return invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @type.nil?
89
+ return true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ created == o.created &&
98
+ id == o.id &&
99
+ type == o.type &&
100
+ data == o.data
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Fixnum] Hash code
111
+ def hash
112
+ [created, id, type, data].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.swagger_types.each_pair do |key, type|
121
+ if type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def _deserialize(type, value)
140
+ case type.to_sym
141
+ when :DateTime
142
+ DateTime.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :BOOLEAN
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else # model
172
+ temp_model = Clever.const_get(type).new
173
+ temp_model.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ next if value.nil?
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map{ |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end