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,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 CoursesUpdated < 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
@@ -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 DistrictadminsCreated < 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' => :'DistrictAdminObject'
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
@@ -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 DistrictadminsDeleted < 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' => :'DistrictAdminObject'
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