clever-ruby 0.14.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -1
- data/Makefile +10 -0
- data/README.md +175 -68
- data/Rakefile +6 -36
- data/circle.yml +1 -1
- data/clever-ruby.gemspec +43 -33
- data/docs/BadRequest.md +8 -0
- data/docs/DataApi.md +2144 -0
- data/docs/District.md +10 -0
- data/docs/DistrictAdmin.md +12 -0
- data/docs/DistrictAdminResponse.md +8 -0
- data/docs/DistrictAdminsResponse.md +8 -0
- data/docs/DistrictObject.md +8 -0
- data/docs/DistrictResponse.md +8 -0
- data/docs/DistrictStatus.md +15 -0
- data/docs/DistrictStatusResponse.md +8 -0
- data/docs/DistrictsCreated.md +10 -0
- data/docs/DistrictsDeleted.md +10 -0
- data/docs/DistrictsResponse.md +8 -0
- data/docs/DistrictsUpdated.md +10 -0
- data/docs/Event.md +9 -0
- data/docs/EventResponse.md +8 -0
- data/docs/EventsApi.md +424 -0
- data/docs/EventsResponse.md +8 -0
- data/docs/GradeLevelsResponse.md +8 -0
- data/docs/InternalError.md +8 -0
- data/docs/Location.md +13 -0
- data/docs/Name.md +10 -0
- data/docs/NotFound.md +8 -0
- data/docs/Principal.md +9 -0
- data/docs/School.md +22 -0
- data/docs/SchoolAdmin.md +14 -0
- data/docs/SchoolAdminObject.md +8 -0
- data/docs/SchoolAdminResponse.md +8 -0
- data/docs/SchoolAdminsResponse.md +8 -0
- data/docs/SchoolObject.md +8 -0
- data/docs/SchoolResponse.md +8 -0
- data/docs/SchooladminsCreated.md +10 -0
- data/docs/SchooladminsDeleted.md +10 -0
- data/docs/SchooladminsUpdated.md +10 -0
- data/docs/SchoolsCreated.md +10 -0
- data/docs/SchoolsDeleted.md +10 -0
- data/docs/SchoolsResponse.md +8 -0
- data/docs/SchoolsUpdated.md +10 -0
- data/docs/Section.md +25 -0
- data/docs/SectionObject.md +8 -0
- data/docs/SectionResponse.md +8 -0
- data/docs/SectionsCreated.md +10 -0
- data/docs/SectionsDeleted.md +10 -0
- data/docs/SectionsResponse.md +8 -0
- data/docs/SectionsUpdated.md +10 -0
- data/docs/Student.md +27 -0
- data/docs/StudentContact.md +16 -0
- data/docs/StudentContactObject.md +8 -0
- data/docs/StudentContactResponse.md +8 -0
- data/docs/StudentContactsResponse.md +8 -0
- data/docs/StudentObject.md +8 -0
- data/docs/StudentResponse.md +8 -0
- data/docs/StudentcontactsCreated.md +10 -0
- data/docs/StudentcontactsDeleted.md +10 -0
- data/docs/StudentcontactsUpdated.md +10 -0
- data/docs/StudentsCreated.md +10 -0
- data/docs/StudentsDeleted.md +10 -0
- data/docs/StudentsResponse.md +8 -0
- data/docs/StudentsUpdated.md +10 -0
- data/docs/Teacher.md +19 -0
- data/docs/TeacherObject.md +8 -0
- data/docs/TeacherResponse.md +8 -0
- data/docs/TeachersCreated.md +10 -0
- data/docs/TeachersDeleted.md +10 -0
- data/docs/TeachersResponse.md +8 -0
- data/docs/TeachersUpdated.md +10 -0
- data/docs/Term.md +10 -0
- data/git_push.sh +55 -0
- data/instructions.md +12 -0
- data/lib/clever-ruby.rb +89 -318
- data/lib/clever-ruby/api/data_api.rb +2090 -0
- data/lib/clever-ruby/api/events_api.rb +429 -0
- data/lib/clever-ruby/api_client.rb +401 -0
- data/lib/clever-ruby/api_error.rb +37 -0
- data/lib/clever-ruby/configuration.rb +187 -25
- data/lib/clever-ruby/models/bad_request.rb +187 -0
- data/lib/clever-ruby/models/district.rb +205 -0
- data/lib/clever-ruby/models/district_admin.rb +223 -0
- data/lib/clever-ruby/models/district_admin_response.rb +187 -0
- data/lib/clever-ruby/models/district_admins_response.rb +189 -0
- data/lib/clever-ruby/models/district_object.rb +187 -0
- data/lib/clever-ruby/models/district_response.rb +187 -0
- data/lib/clever-ruby/models/district_status.rb +250 -0
- data/lib/clever-ruby/models/district_status_response.rb +187 -0
- data/lib/clever-ruby/models/districts_created.rb +206 -0
- data/lib/clever-ruby/models/districts_deleted.rb +207 -0
- data/lib/clever-ruby/models/districts_response.rb +189 -0
- data/lib/clever-ruby/models/districts_updated.rb +207 -0
- data/lib/clever-ruby/models/event.rb +201 -0
- data/lib/clever-ruby/models/event_response.rb +187 -0
- data/lib/clever-ruby/models/events_response.rb +189 -0
- data/lib/clever-ruby/models/grade_levels_response.rb +189 -0
- data/lib/clever-ruby/models/internal_error.rb +187 -0
- data/lib/clever-ruby/models/location.rb +232 -0
- data/lib/clever-ruby/models/name.rb +205 -0
- data/lib/clever-ruby/models/not_found.rb +187 -0
- data/lib/clever-ruby/models/principal.rb +196 -0
- data/lib/clever-ruby/models/school.rb +313 -0
- data/lib/clever-ruby/models/school_admin.rb +243 -0
- data/lib/clever-ruby/models/school_admin_object.rb +187 -0
- data/lib/clever-ruby/models/school_admin_response.rb +187 -0
- data/lib/clever-ruby/models/school_admins_response.rb +189 -0
- data/lib/clever-ruby/models/school_object.rb +187 -0
- data/lib/clever-ruby/models/school_response.rb +187 -0
- data/lib/clever-ruby/models/schooladmins_created.rb +207 -0
- data/lib/clever-ruby/models/schooladmins_deleted.rb +207 -0
- data/lib/clever-ruby/models/schooladmins_updated.rb +207 -0
- data/lib/clever-ruby/models/schools_created.rb +207 -0
- data/lib/clever-ruby/models/schools_deleted.rb +207 -0
- data/lib/clever-ruby/models/schools_response.rb +189 -0
- data/lib/clever-ruby/models/schools_updated.rb +207 -0
- data/lib/clever-ruby/models/section.rb +344 -0
- data/lib/clever-ruby/models/section_object.rb +187 -0
- data/lib/clever-ruby/models/section_response.rb +187 -0
- data/lib/clever-ruby/models/sections_created.rb +207 -0
- data/lib/clever-ruby/models/sections_deleted.rb +207 -0
- data/lib/clever-ruby/models/sections_response.rb +189 -0
- data/lib/clever-ruby/models/sections_updated.rb +207 -0
- data/lib/clever-ruby/models/student.rb +360 -0
- data/lib/clever-ruby/models/student_contact.rb +259 -0
- data/lib/clever-ruby/models/student_contact_object.rb +187 -0
- data/lib/clever-ruby/models/student_contact_response.rb +187 -0
- data/lib/clever-ruby/models/student_contacts_response.rb +189 -0
- data/lib/clever-ruby/models/student_object.rb +187 -0
- data/lib/clever-ruby/models/student_response.rb +187 -0
- data/lib/clever-ruby/models/studentcontacts_created.rb +207 -0
- data/lib/clever-ruby/models/studentcontacts_deleted.rb +207 -0
- data/lib/clever-ruby/models/studentcontacts_updated.rb +207 -0
- data/lib/clever-ruby/models/students_created.rb +196 -0
- data/lib/clever-ruby/models/students_deleted.rb +206 -0
- data/lib/clever-ruby/models/students_response.rb +189 -0
- data/lib/clever-ruby/models/students_updated.rb +207 -0
- data/lib/clever-ruby/models/teacher.rb +288 -0
- data/lib/clever-ruby/models/teacher_object.rb +187 -0
- data/lib/clever-ruby/models/teacher_response.rb +187 -0
- data/lib/clever-ruby/models/teachers_created.rb +207 -0
- data/lib/clever-ruby/models/teachers_deleted.rb +207 -0
- data/lib/clever-ruby/models/teachers_response.rb +189 -0
- data/lib/clever-ruby/models/teachers_updated.rb +207 -0
- data/lib/clever-ruby/models/term.rb +205 -0
- data/lib/clever-ruby/version.rb +12 -4
- data/override/api_client.rb +401 -0
- data/override/config.json +5 -0
- data/override/models/districts_created.rb +206 -0
- data/override/models/districts_deleted.rb +207 -0
- data/override/models/districts_updated.rb +207 -0
- data/override/models/schooladmins_created.rb +207 -0
- data/override/models/schooladmins_deleted.rb +207 -0
- data/override/models/schooladmins_updated.rb +207 -0
- data/override/models/schools_created.rb +207 -0
- data/override/models/schools_deleted.rb +207 -0
- data/override/models/schools_updated.rb +207 -0
- data/override/models/sections_created.rb +207 -0
- data/override/models/sections_deleted.rb +207 -0
- data/override/models/sections_updated.rb +207 -0
- data/override/models/studentcontacts_created.rb +207 -0
- data/override/models/studentcontacts_deleted.rb +207 -0
- data/override/models/studentcontacts_updated.rb +207 -0
- data/override/models/students_created.rb +196 -0
- data/override/models/students_deleted.rb +206 -0
- data/override/models/students_updated.rb +207 -0
- data/override/models/teachers_created.rb +207 -0
- data/override/models/teachers_deleted.rb +207 -0
- data/override/models/teachers_updated.rb +207 -0
- data/override/override.sh +9 -0
- data/sample/sample.rb +16 -0
- metadata +252 -293
- data/.document +0 -5
- data/.gitignore +0 -22
- data/.rubocop.yml +0 -4
- data/.yardopts +0 -2
- data/LICENSE.txt +0 -20
- data/lib/clever-ruby/api_operations/list.rb +0 -130
- data/lib/clever-ruby/api_operations/nested_list.rb +0 -95
- data/lib/clever-ruby/api_operations/page.rb +0 -71
- data/lib/clever-ruby/api_operations/pagelist.rb +0 -43
- data/lib/clever-ruby/api_operations/results_list.rb +0 -31
- data/lib/clever-ruby/api_resource.rb +0 -174
- data/lib/clever-ruby/clever_object.rb +0 -246
- data/lib/clever-ruby/district.rb +0 -75
- data/lib/clever-ruby/district_admin.rb +0 -45
- data/lib/clever-ruby/errors/api_connection_error.rb +0 -5
- data/lib/clever-ruby/errors/api_error.rb +0 -5
- data/lib/clever-ruby/errors/authentication_error.rb +0 -5
- data/lib/clever-ruby/errors/clever_error.rb +0 -52
- data/lib/clever-ruby/errors/invalid_request_error.rb +0 -17
- data/lib/clever-ruby/event.rb +0 -61
- data/lib/clever-ruby/json.rb +0 -34
- data/lib/clever-ruby/nested_resource.rb +0 -41
- data/lib/clever-ruby/school.rb +0 -17
- data/lib/clever-ruby/school_admin.rb +0 -19
- data/lib/clever-ruby/section.rb +0 -17
- data/lib/clever-ruby/student.rb +0 -30
- data/lib/clever-ruby/teacher.rb +0 -17
- data/lib/clever-ruby/util.rb +0 -108
- data/test/data/vcr_cassettes/Clever_APIOperations_List/counts_district_properly.yml +0 -52
- data/test/data/vcr_cassettes/Clever_APIOperations_List/counts_event_properly.yml +0 -52
- data/test/data/vcr_cassettes/Clever_APIOperations_List/counts_school_admin_properly.yml +0 -52
- data/test/data/vcr_cassettes/Clever_APIOperations_List/counts_school_properly.yml +0 -52
- data/test/data/vcr_cassettes/Clever_APIOperations_List/counts_section_properly.yml +0 -52
- data/test/data/vcr_cassettes/Clever_APIOperations_List/counts_student_properly.yml +0 -52
- data/test/data/vcr_cassettes/Clever_APIOperations_List/counts_teacher_properly.yml +0 -52
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_district.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_district_admin.yml +0 -90
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_event.yml +0 -124
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_school.yml +0 -113
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_school_admin.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_section.yml +0 -368
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_student.yml +0 -176
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_a_single_teacher.yml +0 -191
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_districts_by_page.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_districts_with_multiple_ids.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_events_by_page.yml +0 -122
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_events_with_multiple_ids.yml +0 -131
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_school_admins_by_page.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_school_admins_with_multiple_ids.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_schools_by_page.yml +0 -110
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_schools_with_multiple_ids.yml +0 -116
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_sections_by_page.yml +0 -1168
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_sections_with_multiple_ids.yml +0 -163
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_students_by_page.yml +0 -1207
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_students_with_multiple_ids.yml +0 -127
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_teachers_by_page.yml +0 -190
- data/test/data/vcr_cassettes/Clever_APIOperations_List/finds_teachers_with_multiple_ids.yml +0 -131
- data/test/data/vcr_cassettes/Clever_APIOperations_List/retrieves_all_district.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/retrieves_all_event.yml +0 -122
- data/test/data/vcr_cassettes/Clever_APIOperations_List/retrieves_all_school.yml +0 -110
- data/test/data/vcr_cassettes/Clever_APIOperations_List/retrieves_all_school_admin.yml +0 -101
- data/test/data/vcr_cassettes/Clever_APIOperations_List/retrieves_all_section.yml +0 -1168
- data/test/data/vcr_cassettes/Clever_APIOperations_List/retrieves_all_student.yml +0 -1207
- data/test/data/vcr_cassettes/Clever_APIOperations_List/retrieves_all_teacher.yml +0 -190
- data/test/data/vcr_cassettes/Clever_District/pages_methods/pages_a_district_s_events.yml +0 -526
- data/test/data/vcr_cassettes/Clever_District/pages_methods/pages_a_district_s_schools.yml +0 -240
- data/test/data/vcr_cassettes/Clever_District/pages_methods/pages_a_district_s_sections.yml +0 -3674
- data/test/data/vcr_cassettes/Clever_District/pages_methods/pages_a_district_s_students.yml +0 -2387
- data/test/data/vcr_cassettes/Clever_District/pages_methods/pages_a_district_s_teachers.yml +0 -717
- data/test/data/vcr_cassettes/Clever_District_without_global_token/pages_methods/pages_a_district_s_events.yml +0 -152
- data/test/data/vcr_cassettes/Clever_District_without_global_token/pages_methods/pages_a_district_s_schools.yml +0 -211
- data/test/data/vcr_cassettes/Clever_District_without_global_token/pages_methods/pages_a_district_s_sections.yml +0 -3649
- data/test/data/vcr_cassettes/Clever_District_without_global_token/pages_methods/pages_a_district_s_students.yml +0 -2362
- data/test/data/vcr_cassettes/Clever_District_without_global_token/pages_methods/pages_a_district_s_teachers.yml +0 -688
- data/test/data/vcr_cassettes/Clever_District_without_global_token/retrieves_a_district_s_events.yml +0 -89
- data/test/data/vcr_cassettes/Clever_District_without_global_token/retrieves_a_district_s_school_admins.yml +0 -101
- data/test/data/vcr_cassettes/Clever_District_without_global_token/retrieves_a_district_s_schools.yml +0 -164
- data/test/data/vcr_cassettes/Clever_District_without_global_token/retrieves_a_district_s_sections.yml +0 -1168
- data/test/data/vcr_cassettes/Clever_District_without_global_token/retrieves_a_district_s_students.yml +0 -1207
- data/test/data/vcr_cassettes/Clever_District_without_global_token/retrieves_a_district_s_teachers.yml +0 -324
- data/test/data/vcr_cassettes/Clever_NestedResource/must_include_auth_token_in_linked_resources.yml +0 -197
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_district_s_events.yml +0 -237
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_district_s_schools.yml +0 -217
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_district_s_sections.yml +0 -2333
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_district_s_students.yml +0 -2411
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_district_s_teachers.yml +0 -377
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_school_admin_s_schools.yml +0 -205
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_school_s_district.yml +0 -162
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_school_s_events.yml +0 -215
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_school_s_sections.yml +0 -1153
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_school_s_students.yml +0 -1081
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_school_s_teachers.yml +0 -283
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_section_s_district.yml +0 -417
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_section_s_events.yml +0 -470
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_section_s_school.yml +0 -420
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_section_s_students.yml +0 -482
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_section_s_teacher.yml +0 -418
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_student_s_district.yml +0 -226
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_student_s_events.yml +0 -279
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_student_s_school.yml +0 -229
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_student_s_sections.yml +0 -301
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_student_s_teachers.yml +0 -277
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_teacher_s_district.yml +0 -240
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_teacher_s_events.yml +0 -293
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_teacher_s_school.yml +0 -243
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_teacher_s_sections.yml +0 -321
- data/test/data/vcr_cassettes/Clever_NestedResource/retrieves_a_teacher_s_students.yml +0 -323
- data/test/data/vcr_cassettes/Error_handling/raises_an_InvalidRequestError_when_given_a_bad_created_since.yml +0 -151
- data/test/data/vcr_cassettes/Optional_attributes/has_the_expected_value_for_an_optional_attribute_that_is_present.yml +0 -55
- data/test/data/vcr_cassettes/last_method/page/has_working_first_and_last_methods.yml +0 -800
- data/test/integration/api_operations/list_test.rb +0 -117
- data/test/integration/district_test.rb +0 -53
- data/test/integration/district_with_non_global_token_test.rb +0 -88
- data/test/integration/error_handling_test.rb +0 -17
- data/test/integration/last_test.rb +0 -56
- data/test/integration/nested_resource_test.rb +0 -31
- data/test/test_helper.rb +0 -18
- data/test/unit/api_resource_test.rb +0 -48
- data/test/unit/clever_test.rb +0 -65
- data/test/unit/configuration_test.rb +0 -37
- data/test/unit/event_test.rb +0 -57
- data/test/unit/optional_attributes_test.rb +0 -27
@@ -0,0 +1,189 @@
|
|
1
|
+
=begin
|
2
|
+
#Clever API
|
3
|
+
|
4
|
+
#The Clever API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module Clever
|
15
|
+
|
16
|
+
class SectionsResponse
|
17
|
+
attr_accessor :data
|
18
|
+
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'data' => :'data'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'data' => :'Array<SectionResponse>'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initializes the object
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
|
+
def initialize(attributes = {})
|
37
|
+
return unless attributes.is_a?(Hash)
|
38
|
+
|
39
|
+
# convert string to symbol for hash key
|
40
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
41
|
+
|
42
|
+
if attributes.has_key?(:'data')
|
43
|
+
if (value = attributes[:'data']).is_a?(Array)
|
44
|
+
self.data = value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
51
|
+
# @return Array for valid properies with the reasons
|
52
|
+
def list_invalid_properties
|
53
|
+
invalid_properties = Array.new
|
54
|
+
return invalid_properties
|
55
|
+
end
|
56
|
+
|
57
|
+
# Check to see if the all the properties in the model are valid
|
58
|
+
# @return true if the model is valid
|
59
|
+
def valid?
|
60
|
+
return true
|
61
|
+
end
|
62
|
+
|
63
|
+
# Checks equality by comparing each attribute.
|
64
|
+
# @param [Object] Object to be compared
|
65
|
+
def ==(o)
|
66
|
+
return true if self.equal?(o)
|
67
|
+
self.class == o.class &&
|
68
|
+
data == o.data
|
69
|
+
end
|
70
|
+
|
71
|
+
# @see the `==` method
|
72
|
+
# @param [Object] Object to be compared
|
73
|
+
def eql?(o)
|
74
|
+
self == o
|
75
|
+
end
|
76
|
+
|
77
|
+
# Calculates hash code according to all attributes.
|
78
|
+
# @return [Fixnum] Hash code
|
79
|
+
def hash
|
80
|
+
[data].hash
|
81
|
+
end
|
82
|
+
|
83
|
+
# Builds the object from hash
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
# @return [Object] Returns the model itself
|
86
|
+
def build_from_hash(attributes)
|
87
|
+
return nil unless attributes.is_a?(Hash)
|
88
|
+
self.class.swagger_types.each_pair do |key, type|
|
89
|
+
if type =~ /\AArray<(.*)>/i
|
90
|
+
# check to ensure the input is an array given that the the attribute
|
91
|
+
# is documented as an array but the input is not
|
92
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
93
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
94
|
+
end
|
95
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
96
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
97
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
98
|
+
end
|
99
|
+
|
100
|
+
self
|
101
|
+
end
|
102
|
+
|
103
|
+
# Deserializes the data based on type
|
104
|
+
# @param string type Data type
|
105
|
+
# @param string value Value to be deserialized
|
106
|
+
# @return [Object] Deserialized data
|
107
|
+
def _deserialize(type, value)
|
108
|
+
case type.to_sym
|
109
|
+
when :DateTime
|
110
|
+
DateTime.parse(value)
|
111
|
+
when :Date
|
112
|
+
Date.parse(value)
|
113
|
+
when :String
|
114
|
+
value.to_s
|
115
|
+
when :Integer
|
116
|
+
value.to_i
|
117
|
+
when :Float
|
118
|
+
value.to_f
|
119
|
+
when :BOOLEAN
|
120
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
121
|
+
true
|
122
|
+
else
|
123
|
+
false
|
124
|
+
end
|
125
|
+
when :Object
|
126
|
+
# generic object (usually a Hash), return directly
|
127
|
+
value
|
128
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
129
|
+
inner_type = Regexp.last_match[:inner_type]
|
130
|
+
value.map { |v| _deserialize(inner_type, v) }
|
131
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
132
|
+
k_type = Regexp.last_match[:k_type]
|
133
|
+
v_type = Regexp.last_match[:v_type]
|
134
|
+
{}.tap do |hash|
|
135
|
+
value.each do |k, v|
|
136
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
else # model
|
140
|
+
temp_model = Clever.const_get(type).new
|
141
|
+
temp_model.build_from_hash(value)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns the string representation of the object
|
146
|
+
# @return [String] String presentation of the object
|
147
|
+
def to_s
|
148
|
+
to_hash.to_s
|
149
|
+
end
|
150
|
+
|
151
|
+
# to_body is an alias to to_hash (backward compatibility)
|
152
|
+
# @return [Hash] Returns the object in the form of hash
|
153
|
+
def to_body
|
154
|
+
to_hash
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns the object in the form of hash
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
159
|
+
def to_hash
|
160
|
+
hash = {}
|
161
|
+
self.class.attribute_map.each_pair do |attr, param|
|
162
|
+
value = self.send(attr)
|
163
|
+
next if value.nil?
|
164
|
+
hash[param] = _to_hash(value)
|
165
|
+
end
|
166
|
+
hash
|
167
|
+
end
|
168
|
+
|
169
|
+
# Outputs non-array value in the form of hash
|
170
|
+
# For object, use to_hash. Otherwise, just return the value
|
171
|
+
# @param [Object] value Any valid value
|
172
|
+
# @return [Hash] Returns the value in the form of hash
|
173
|
+
def _to_hash(value)
|
174
|
+
if value.is_a?(Array)
|
175
|
+
value.compact.map{ |v| _to_hash(v) }
|
176
|
+
elsif value.is_a?(Hash)
|
177
|
+
{}.tap do |hash|
|
178
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
179
|
+
end
|
180
|
+
elsif value.respond_to? :to_hash
|
181
|
+
value.to_hash
|
182
|
+
else
|
183
|
+
value
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
@@ -0,0 +1,207 @@
|
|
1
|
+
=begin
|
2
|
+
#Clever API
|
3
|
+
|
4
|
+
#The Clever API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
require File.expand_path('../event.rb', __FILE__)
|
14
|
+
|
15
|
+
module Clever
|
16
|
+
|
17
|
+
class SectionsUpdated < Event
|
18
|
+
attr_accessor :data
|
19
|
+
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'type' => :'type',
|
25
|
+
:'id' => :'id',
|
26
|
+
:'data' => :'data'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.swagger_types
|
32
|
+
{
|
33
|
+
:'type' => :'String',
|
34
|
+
:'id' => :'String',
|
35
|
+
:'data' => :'SectionObject'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
return unless attributes.is_a?(Hash)
|
43
|
+
|
44
|
+
# convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
46
|
+
|
47
|
+
if attributes.has_key?(:'type')
|
48
|
+
self.type = attributes[:'type']
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:'id')
|
52
|
+
self.id = attributes[:'id']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'data')
|
56
|
+
self.data = attributes[:'data']
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properies with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
if @type.nil?
|
66
|
+
invalid_properties.push("invalid value for 'type', type cannot be nil.")
|
67
|
+
end
|
68
|
+
|
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 false if @type.nil?
|
76
|
+
return true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
type == o.type &&
|
85
|
+
id == o.id &&
|
86
|
+
data == o.data
|
87
|
+
end
|
88
|
+
|
89
|
+
# @see the `==` method
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def eql?(o)
|
92
|
+
self == o
|
93
|
+
end
|
94
|
+
|
95
|
+
# Calculates hash code according to all attributes.
|
96
|
+
# @return [Fixnum] Hash code
|
97
|
+
def hash
|
98
|
+
[type, id, data].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# Builds the object from hash
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
# @return [Object] Returns the model itself
|
104
|
+
def build_from_hash(attributes)
|
105
|
+
return nil unless attributes.is_a?(Hash)
|
106
|
+
self.class.swagger_types.each_pair do |key, type|
|
107
|
+
if type =~ /\AArray<(.*)>/i
|
108
|
+
# check to ensure the input is an array given that the the attribute
|
109
|
+
# is documented as an array but the input is not
|
110
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
111
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
112
|
+
end
|
113
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
114
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
115
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
116
|
+
end
|
117
|
+
|
118
|
+
self
|
119
|
+
end
|
120
|
+
|
121
|
+
# Deserializes the data based on type
|
122
|
+
# @param string type Data type
|
123
|
+
# @param string value Value to be deserialized
|
124
|
+
# @return [Object] Deserialized data
|
125
|
+
def _deserialize(type, value)
|
126
|
+
case type.to_sym
|
127
|
+
when :DateTime
|
128
|
+
DateTime.parse(value)
|
129
|
+
when :Date
|
130
|
+
Date.parse(value)
|
131
|
+
when :String
|
132
|
+
value.to_s
|
133
|
+
when :Integer
|
134
|
+
value.to_i
|
135
|
+
when :Float
|
136
|
+
value.to_f
|
137
|
+
when :BOOLEAN
|
138
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
139
|
+
true
|
140
|
+
else
|
141
|
+
false
|
142
|
+
end
|
143
|
+
when :Object
|
144
|
+
# generic object (usually a Hash), return directly
|
145
|
+
value
|
146
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
147
|
+
inner_type = Regexp.last_match[:inner_type]
|
148
|
+
value.map { |v| _deserialize(inner_type, v) }
|
149
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
150
|
+
k_type = Regexp.last_match[:k_type]
|
151
|
+
v_type = Regexp.last_match[:v_type]
|
152
|
+
{}.tap do |hash|
|
153
|
+
value.each do |k, v|
|
154
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
else # model
|
158
|
+
temp_model = CleverAPI.const_get(type).new
|
159
|
+
temp_model.build_from_hash(value)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the string representation of the object
|
164
|
+
# @return [String] String presentation of the object
|
165
|
+
def to_s
|
166
|
+
to_hash.to_s
|
167
|
+
end
|
168
|
+
|
169
|
+
# to_body is an alias to to_hash (backward compatibility)
|
170
|
+
# @return [Hash] Returns the object in the form of hash
|
171
|
+
def to_body
|
172
|
+
to_hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the object in the form of hash
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
177
|
+
def to_hash
|
178
|
+
hash = {}
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
180
|
+
value = self.send(attr)
|
181
|
+
next if value.nil?
|
182
|
+
hash[param] = _to_hash(value)
|
183
|
+
end
|
184
|
+
hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Outputs non-array value in the form of hash
|
188
|
+
# For object, use to_hash. Otherwise, just return the value
|
189
|
+
# @param [Object] value Any valid value
|
190
|
+
# @return [Hash] Returns the value in the form of hash
|
191
|
+
def _to_hash(value)
|
192
|
+
if value.is_a?(Array)
|
193
|
+
value.compact.map{ |v| _to_hash(v) }
|
194
|
+
elsif value.is_a?(Hash)
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
197
|
+
end
|
198
|
+
elsif value.respond_to? :to_hash
|
199
|
+
value.to_hash
|
200
|
+
else
|
201
|
+
value
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
@@ -0,0 +1,360 @@
|
|
1
|
+
=begin
|
2
|
+
#Clever API
|
3
|
+
|
4
|
+
#The Clever API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.2.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module Clever
|
15
|
+
|
16
|
+
class Student
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
attr_accessor :created
|
20
|
+
|
21
|
+
attr_accessor :district
|
22
|
+
|
23
|
+
attr_accessor :dob
|
24
|
+
|
25
|
+
attr_accessor :ell_status
|
26
|
+
|
27
|
+
attr_accessor :email
|
28
|
+
|
29
|
+
attr_accessor :frl_status
|
30
|
+
|
31
|
+
attr_accessor :gender
|
32
|
+
|
33
|
+
attr_accessor :grade
|
34
|
+
|
35
|
+
attr_accessor :hispanic_ethnicity
|
36
|
+
|
37
|
+
attr_accessor :iep_status
|
38
|
+
|
39
|
+
attr_accessor :last_modified
|
40
|
+
|
41
|
+
attr_accessor :location
|
42
|
+
|
43
|
+
attr_accessor :name
|
44
|
+
|
45
|
+
attr_accessor :race
|
46
|
+
|
47
|
+
attr_accessor :school
|
48
|
+
|
49
|
+
attr_accessor :schools
|
50
|
+
|
51
|
+
attr_accessor :sis_id
|
52
|
+
|
53
|
+
attr_accessor :state_id
|
54
|
+
|
55
|
+
attr_accessor :student_number
|
56
|
+
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'id' => :'id',
|
62
|
+
:'created' => :'created',
|
63
|
+
:'district' => :'district',
|
64
|
+
:'dob' => :'dob',
|
65
|
+
:'ell_status' => :'ell_status',
|
66
|
+
:'email' => :'email',
|
67
|
+
:'frl_status' => :'frl_status',
|
68
|
+
:'gender' => :'gender',
|
69
|
+
:'grade' => :'grade',
|
70
|
+
:'hispanic_ethnicity' => :'hispanic_ethnicity',
|
71
|
+
:'iep_status' => :'iep_status',
|
72
|
+
:'last_modified' => :'last_modified',
|
73
|
+
:'location' => :'location',
|
74
|
+
:'name' => :'name',
|
75
|
+
:'race' => :'race',
|
76
|
+
:'school' => :'school',
|
77
|
+
:'schools' => :'schools',
|
78
|
+
:'sis_id' => :'sis_id',
|
79
|
+
:'state_id' => :'state_id',
|
80
|
+
:'student_number' => :'student_number'
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
# Attribute type mapping.
|
85
|
+
def self.swagger_types
|
86
|
+
{
|
87
|
+
:'id' => :'String',
|
88
|
+
:'created' => :'String',
|
89
|
+
:'district' => :'String',
|
90
|
+
:'dob' => :'String',
|
91
|
+
:'ell_status' => :'String',
|
92
|
+
:'email' => :'String',
|
93
|
+
:'frl_status' => :'String',
|
94
|
+
:'gender' => :'String',
|
95
|
+
:'grade' => :'String',
|
96
|
+
:'hispanic_ethnicity' => :'String',
|
97
|
+
:'iep_status' => :'String',
|
98
|
+
:'last_modified' => :'String',
|
99
|
+
:'location' => :'Location',
|
100
|
+
:'name' => :'Name',
|
101
|
+
:'race' => :'String',
|
102
|
+
:'school' => :'String',
|
103
|
+
:'schools' => :'Array<String>',
|
104
|
+
:'sis_id' => :'String',
|
105
|
+
:'state_id' => :'String',
|
106
|
+
:'student_number' => :'String'
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
# Initializes the object
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
def initialize(attributes = {})
|
113
|
+
return unless attributes.is_a?(Hash)
|
114
|
+
|
115
|
+
# convert string to symbol for hash key
|
116
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
117
|
+
|
118
|
+
if attributes.has_key?(:'id')
|
119
|
+
self.id = attributes[:'id']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.has_key?(:'created')
|
123
|
+
self.created = attributes[:'created']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.has_key?(:'district')
|
127
|
+
self.district = attributes[:'district']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.has_key?(:'dob')
|
131
|
+
self.dob = attributes[:'dob']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.has_key?(:'ell_status')
|
135
|
+
self.ell_status = attributes[:'ell_status']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.has_key?(:'email')
|
139
|
+
self.email = attributes[:'email']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.has_key?(:'frl_status')
|
143
|
+
self.frl_status = attributes[:'frl_status']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.has_key?(:'gender')
|
147
|
+
self.gender = attributes[:'gender']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.has_key?(:'grade')
|
151
|
+
self.grade = attributes[:'grade']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.has_key?(:'hispanic_ethnicity')
|
155
|
+
self.hispanic_ethnicity = attributes[:'hispanic_ethnicity']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.has_key?(:'iep_status')
|
159
|
+
self.iep_status = attributes[:'iep_status']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.has_key?(:'last_modified')
|
163
|
+
self.last_modified = attributes[:'last_modified']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.has_key?(:'location')
|
167
|
+
self.location = attributes[:'location']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.has_key?(:'name')
|
171
|
+
self.name = attributes[:'name']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.has_key?(:'race')
|
175
|
+
self.race = attributes[:'race']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.has_key?(:'school')
|
179
|
+
self.school = attributes[:'school']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.has_key?(:'schools')
|
183
|
+
if (value = attributes[:'schools']).is_a?(Array)
|
184
|
+
self.schools = value
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.has_key?(:'sis_id')
|
189
|
+
self.sis_id = attributes[:'sis_id']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.has_key?(:'state_id')
|
193
|
+
self.state_id = attributes[:'state_id']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.has_key?(:'student_number')
|
197
|
+
self.student_number = attributes[:'student_number']
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
|
202
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
203
|
+
# @return Array for valid properies with the reasons
|
204
|
+
def list_invalid_properties
|
205
|
+
invalid_properties = Array.new
|
206
|
+
return invalid_properties
|
207
|
+
end
|
208
|
+
|
209
|
+
# Check to see if the all the properties in the model are valid
|
210
|
+
# @return true if the model is valid
|
211
|
+
def valid?
|
212
|
+
return true
|
213
|
+
end
|
214
|
+
|
215
|
+
# Checks equality by comparing each attribute.
|
216
|
+
# @param [Object] Object to be compared
|
217
|
+
def ==(o)
|
218
|
+
return true if self.equal?(o)
|
219
|
+
self.class == o.class &&
|
220
|
+
id == o.id &&
|
221
|
+
created == o.created &&
|
222
|
+
district == o.district &&
|
223
|
+
dob == o.dob &&
|
224
|
+
ell_status == o.ell_status &&
|
225
|
+
email == o.email &&
|
226
|
+
frl_status == o.frl_status &&
|
227
|
+
gender == o.gender &&
|
228
|
+
grade == o.grade &&
|
229
|
+
hispanic_ethnicity == o.hispanic_ethnicity &&
|
230
|
+
iep_status == o.iep_status &&
|
231
|
+
last_modified == o.last_modified &&
|
232
|
+
location == o.location &&
|
233
|
+
name == o.name &&
|
234
|
+
race == o.race &&
|
235
|
+
school == o.school &&
|
236
|
+
schools == o.schools &&
|
237
|
+
sis_id == o.sis_id &&
|
238
|
+
state_id == o.state_id &&
|
239
|
+
student_number == o.student_number
|
240
|
+
end
|
241
|
+
|
242
|
+
# @see the `==` method
|
243
|
+
# @param [Object] Object to be compared
|
244
|
+
def eql?(o)
|
245
|
+
self == o
|
246
|
+
end
|
247
|
+
|
248
|
+
# Calculates hash code according to all attributes.
|
249
|
+
# @return [Fixnum] Hash code
|
250
|
+
def hash
|
251
|
+
[id, created, district, dob, ell_status, email, frl_status, gender, grade, hispanic_ethnicity, iep_status, last_modified, location, name, race, school, schools, sis_id, state_id, student_number].hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Builds the object from hash
|
255
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
256
|
+
# @return [Object] Returns the model itself
|
257
|
+
def build_from_hash(attributes)
|
258
|
+
return nil unless attributes.is_a?(Hash)
|
259
|
+
self.class.swagger_types.each_pair do |key, type|
|
260
|
+
if type =~ /\AArray<(.*)>/i
|
261
|
+
# check to ensure the input is an array given that the the attribute
|
262
|
+
# is documented as an array but the input is not
|
263
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
264
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
265
|
+
end
|
266
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
267
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
268
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
269
|
+
end
|
270
|
+
|
271
|
+
self
|
272
|
+
end
|
273
|
+
|
274
|
+
# Deserializes the data based on type
|
275
|
+
# @param string type Data type
|
276
|
+
# @param string value Value to be deserialized
|
277
|
+
# @return [Object] Deserialized data
|
278
|
+
def _deserialize(type, value)
|
279
|
+
case type.to_sym
|
280
|
+
when :DateTime
|
281
|
+
DateTime.parse(value)
|
282
|
+
when :Date
|
283
|
+
Date.parse(value)
|
284
|
+
when :String
|
285
|
+
value.to_s
|
286
|
+
when :Integer
|
287
|
+
value.to_i
|
288
|
+
when :Float
|
289
|
+
value.to_f
|
290
|
+
when :BOOLEAN
|
291
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
292
|
+
true
|
293
|
+
else
|
294
|
+
false
|
295
|
+
end
|
296
|
+
when :Object
|
297
|
+
# generic object (usually a Hash), return directly
|
298
|
+
value
|
299
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
300
|
+
inner_type = Regexp.last_match[:inner_type]
|
301
|
+
value.map { |v| _deserialize(inner_type, v) }
|
302
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
303
|
+
k_type = Regexp.last_match[:k_type]
|
304
|
+
v_type = Regexp.last_match[:v_type]
|
305
|
+
{}.tap do |hash|
|
306
|
+
value.each do |k, v|
|
307
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
else # model
|
311
|
+
temp_model = Clever.const_get(type).new
|
312
|
+
temp_model.build_from_hash(value)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
# Returns the string representation of the object
|
317
|
+
# @return [String] String presentation of the object
|
318
|
+
def to_s
|
319
|
+
to_hash.to_s
|
320
|
+
end
|
321
|
+
|
322
|
+
# to_body is an alias to to_hash (backward compatibility)
|
323
|
+
# @return [Hash] Returns the object in the form of hash
|
324
|
+
def to_body
|
325
|
+
to_hash
|
326
|
+
end
|
327
|
+
|
328
|
+
# Returns the object in the form of hash
|
329
|
+
# @return [Hash] Returns the object in the form of hash
|
330
|
+
def to_hash
|
331
|
+
hash = {}
|
332
|
+
self.class.attribute_map.each_pair do |attr, param|
|
333
|
+
value = self.send(attr)
|
334
|
+
next if value.nil?
|
335
|
+
hash[param] = _to_hash(value)
|
336
|
+
end
|
337
|
+
hash
|
338
|
+
end
|
339
|
+
|
340
|
+
# Outputs non-array value in the form of hash
|
341
|
+
# For object, use to_hash. Otherwise, just return the value
|
342
|
+
# @param [Object] value Any valid value
|
343
|
+
# @return [Hash] Returns the value in the form of hash
|
344
|
+
def _to_hash(value)
|
345
|
+
if value.is_a?(Array)
|
346
|
+
value.compact.map{ |v| _to_hash(v) }
|
347
|
+
elsif value.is_a?(Hash)
|
348
|
+
{}.tap do |hash|
|
349
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
350
|
+
end
|
351
|
+
elsif value.respond_to? :to_hash
|
352
|
+
value.to_hash
|
353
|
+
else
|
354
|
+
value
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
end
|
359
|
+
|
360
|
+
end
|