commonlit-clever-ruby 2.1.6.beta1 → 2.1.6.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +37 -29
- data/README.md +994 -61
- data/clever-ruby.gemspec +6 -13
- data/commonlit-clever-ruby-2.1.6.beta1.gem +0 -0
- data/docs/AdminName.md +0 -1
- data/docs/BadRequest.md +0 -1
- data/docs/Contact.md +1 -2
- data/docs/ContactObject.md +0 -1
- data/docs/ContactResponse.md +0 -1
- data/docs/ContactsCreated.md +2 -3
- data/docs/ContactsDeleted.md +2 -3
- data/docs/ContactsResponse.md +0 -1
- data/docs/ContactsUpdated.md +2 -3
- data/docs/Course.md +1 -2
- data/docs/CourseObject.md +0 -1
- data/docs/CourseResponse.md +0 -1
- data/docs/CoursesCreated.md +2 -3
- data/docs/CoursesDeleted.md +2 -3
- data/docs/CoursesResponse.md +0 -1
- data/docs/CoursesUpdated.md +2 -3
- data/docs/Credentials.md +0 -1
- data/docs/DataApi.md +2784 -0
- data/docs/District.md +9 -10
- data/docs/DistrictAdmin.md +2 -3
- data/docs/DistrictAdminObject.md +0 -1
- data/docs/DistrictAdminResponse.md +0 -1
- data/docs/DistrictAdminsResponse.md +0 -1
- data/docs/DistrictObject.md +0 -1
- data/docs/DistrictResponse.md +0 -1
- data/docs/DistrictadminsCreated.md +2 -3
- data/docs/DistrictadminsDeleted.md +2 -3
- data/docs/DistrictadminsUpdated.md +2 -3
- data/docs/DistrictsCreated.md +2 -3
- data/docs/DistrictsDeleted.md +2 -3
- data/docs/DistrictsResponse.md +0 -1
- data/docs/DistrictsUpdated.md +2 -3
- data/docs/Event.md +2 -3
- data/docs/EventResponse.md +0 -1
- data/docs/EventsApi.md +1 -4
- data/docs/EventsResponse.md +0 -1
- data/docs/InternalError.md +0 -1
- data/docs/Link.md +0 -1
- data/docs/Location.md +2 -3
- data/docs/Name.md +1 -2
- data/docs/NotFound.md +0 -1
- data/docs/Principal.md +1 -2
- data/docs/School.md +3 -4
- data/docs/SchoolAdmin.md +3 -4
- data/docs/SchoolAdminObject.md +0 -1
- data/docs/SchoolAdminResponse.md +0 -1
- data/docs/SchoolAdminsResponse.md +0 -1
- data/docs/SchoolEnrollment.md +1 -2
- data/docs/SchoolObject.md +0 -1
- data/docs/SchoolResponse.md +0 -1
- data/docs/SchooladminsCreated.md +2 -3
- data/docs/SchooladminsDeleted.md +2 -3
- data/docs/SchooladminsUpdated.md +2 -3
- data/docs/SchoolsCreated.md +2 -3
- data/docs/SchoolsDeleted.md +2 -3
- data/docs/SchoolsResponse.md +0 -1
- data/docs/SchoolsUpdated.md +2 -3
- data/docs/Section.md +2 -3
- data/docs/SectionObject.md +0 -1
- data/docs/SectionResponse.md +0 -1
- data/docs/SectionsCreated.md +2 -3
- data/docs/SectionsDeleted.md +2 -3
- data/docs/SectionsResponse.md +0 -1
- data/docs/SectionsUpdated.md +2 -3
- data/docs/Student.md +3 -4
- data/docs/StudentObject.md +0 -1
- data/docs/StudentResponse.md +0 -1
- data/docs/StudentsCreated.md +2 -3
- data/docs/StudentsDeleted.md +2 -3
- data/docs/StudentsResponse.md +0 -1
- data/docs/StudentsUpdated.md +2 -3
- data/docs/Teacher.md +2 -3
- data/docs/TeacherObject.md +0 -1
- data/docs/TeacherResponse.md +0 -1
- data/docs/TeachersCreated.md +2 -3
- data/docs/TeachersDeleted.md +2 -3
- data/docs/TeachersResponse.md +0 -1
- data/docs/TeachersUpdated.md +2 -3
- data/docs/Term.md +2 -3
- data/docs/TermObject.md +0 -1
- data/docs/TermResponse.md +0 -1
- data/docs/TermsCreated.md +2 -3
- data/docs/TermsDeleted.md +2 -3
- data/docs/TermsResponse.md +0 -1
- data/docs/TermsUpdated.md +2 -3
- data/git_push.sh +55 -0
- data/lib/clever-ruby/api/data_api.rb +2999 -0
- data/lib/clever-ruby/api/events_api.rb +25 -20
- data/lib/clever-ruby/api_error.rb +23 -4
- data/lib/clever-ruby/configuration.rb +5 -9
- data/lib/clever-ruby/models/admin_name.rb +46 -22
- data/lib/clever-ruby/models/bad_request.rb +42 -20
- data/lib/clever-ruby/models/contact.rb +83 -55
- data/lib/clever-ruby/models/contact_object.rb +42 -20
- data/lib/clever-ruby/models/contact_response.rb +42 -20
- data/lib/clever-ruby/models/contacts_response.rb +44 -22
- data/lib/clever-ruby/models/course.rb +60 -36
- data/lib/clever-ruby/models/course_object.rb +42 -20
- data/lib/clever-ruby/models/course_response.rb +42 -20
- data/lib/clever-ruby/models/courses_response.rb +44 -22
- data/lib/clever-ruby/models/credentials.rb +42 -20
- data/lib/clever-ruby/models/district.rb +122 -94
- data/lib/clever-ruby/models/district_admin.rb +67 -44
- data/lib/clever-ruby/models/district_admin_object.rb +42 -20
- data/lib/clever-ruby/models/district_admin_response.rb +42 -20
- data/lib/clever-ruby/models/district_admins_response.rb +44 -22
- data/lib/clever-ruby/models/district_object.rb +42 -20
- data/lib/clever-ruby/models/district_response.rb +42 -20
- data/lib/clever-ruby/models/districts_response.rb +44 -22
- data/lib/clever-ruby/models/event.rb +60 -33
- data/lib/clever-ruby/models/event_response.rb +42 -20
- data/lib/clever-ruby/models/events_response.rb +44 -22
- data/lib/clever-ruby/models/internal_error.rb +42 -20
- data/lib/clever-ruby/models/link.rb +47 -25
- data/lib/clever-ruby/models/location.rb +73 -45
- data/lib/clever-ruby/models/name.rb +58 -33
- data/lib/clever-ruby/models/not_found.rb +42 -20
- data/lib/clever-ruby/models/principal.rb +55 -31
- data/lib/clever-ruby/models/school.rb +108 -80
- data/lib/clever-ruby/models/school_admin.rb +85 -61
- data/lib/clever-ruby/models/school_admin_object.rb +42 -20
- data/lib/clever-ruby/models/school_admin_response.rb +42 -20
- data/lib/clever-ruby/models/school_admins_response.rb +44 -22
- data/lib/clever-ruby/models/school_enrollment.rb +56 -34
- data/lib/clever-ruby/models/school_object.rb +42 -20
- data/lib/clever-ruby/models/school_response.rb +42 -20
- data/lib/clever-ruby/models/schools_response.rb +44 -22
- data/lib/clever-ruby/models/section.rb +104 -75
- data/lib/clever-ruby/models/section_object.rb +42 -20
- data/lib/clever-ruby/models/section_response.rb +42 -20
- data/lib/clever-ruby/models/sections_response.rb +44 -22
- data/lib/clever-ruby/models/student.rb +147 -126
- data/lib/clever-ruby/models/student_object.rb +42 -20
- data/lib/clever-ruby/models/student_response.rb +42 -20
- data/lib/clever-ruby/models/students_response.rb +44 -22
- data/lib/clever-ruby/models/teacher.rb +89 -63
- data/lib/clever-ruby/models/teacher_object.rb +42 -20
- data/lib/clever-ruby/models/teacher_response.rb +42 -20
- data/lib/clever-ruby/models/teachers_response.rb +44 -22
- data/lib/clever-ruby/models/term.rb +69 -44
- data/lib/clever-ruby/models/term_object.rb +42 -20
- data/lib/clever-ruby/models/term_response.rb +42 -20
- data/lib/clever-ruby/models/terms_response.rb +44 -22
- data/lib/clever-ruby/version.rb +4 -5
- data/lib/clever-ruby.rb +4 -14
- data/override/README-extension.md +1 -1
- data/override/override.sh +3 -0
- data/spec/api/data_api_spec.rb +671 -0
- data/spec/api/events_api_spec.rb +4 -3
- data/spec/api_client_spec.rb +21 -3
- data/spec/spec_helper.rb +4 -3
- metadata +25 -179
- data/docs/ContactsApi.md +0 -231
- data/docs/CoursesApi.md +0 -231
- data/docs/DistrictAdminsApi.md +0 -171
- data/docs/DistrictsApi.md +0 -113
- data/docs/SchoolAdminsApi.md +0 -231
- data/docs/SchoolsApi.md +0 -351
- data/docs/SectionsApi.md +0 -499
- data/docs/StudentsApi.md +0 -463
- data/docs/TeachersApi.md +0 -403
- data/docs/TermsApi.md +0 -231
- data/lib/clever-ruby/api/contacts_api.rb +0 -241
- data/lib/clever-ruby/api/courses_api.rb +0 -241
- data/lib/clever-ruby/api/district_admins_api.rb +0 -182
- data/lib/clever-ruby/api/districts_api.rb +0 -123
- data/lib/clever-ruby/api/school_admins_api.rb +0 -241
- data/lib/clever-ruby/api/schools_api.rb +0 -359
- data/lib/clever-ruby/api/sections_api.rb +0 -500
- data/lib/clever-ruby/api/students_api.rb +0 -468
- data/lib/clever-ruby/api/teachers_api.rb +0 -409
- data/lib/clever-ruby/api/terms_api.rb +0 -241
- data/spec/api/contacts_api_spec.rb +0 -84
- data/spec/api/courses_api_spec.rb +0 -84
- data/spec/api/district_admins_api_spec.rb +0 -70
- data/spec/api/districts_api_spec.rb +0 -56
- data/spec/api/school_admins_api_spec.rb +0 -84
- data/spec/api/schools_api_spec.rb +0 -112
- data/spec/api/sections_api_spec.rb +0 -142
- data/spec/api/students_api_spec.rb +0 -137
- data/spec/api/teachers_api_spec.rb +0 -123
- data/spec/api/terms_api_spec.rb +0 -84
@@ -1,17 +1,14 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Clever API
|
3
3
|
|
4
|
-
#
|
4
|
+
#The Clever API
|
5
5
|
|
6
6
|
OpenAPI spec version: 2.1.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
|
-
require 'uri'
|
14
|
-
|
15
12
|
module Clever
|
16
13
|
class EventsApi
|
17
14
|
attr_accessor :api_client
|
@@ -31,7 +28,7 @@ module Clever
|
|
31
28
|
# Returns the specific event
|
32
29
|
# @param id
|
33
30
|
# @param [Hash] opts the optional parameters
|
34
|
-
# @return [Array<(EventResponse,
|
31
|
+
# @return [Array<(EventResponse, Integer, Hash)>] EventResponse data, response status code and response headers
|
35
32
|
def get_event_with_http_info(id, opts = {})
|
36
33
|
if @api_client.config.debugging
|
37
34
|
@api_client.config.logger.debug 'Calling API: EventsApi.get_event ...'
|
@@ -44,26 +41,30 @@ module Clever
|
|
44
41
|
local_var_path = '/events/{id}'.sub('{' + 'id' + '}', id.to_s)
|
45
42
|
|
46
43
|
# query parameters
|
47
|
-
query_params = {}
|
44
|
+
query_params = opts[:query_params] || {}
|
48
45
|
|
49
46
|
# header parameters
|
50
|
-
header_params = {}
|
47
|
+
header_params = opts[:header_params] || {}
|
51
48
|
# HTTP header 'Accept' (if needed)
|
52
49
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
53
50
|
|
54
51
|
# form parameters
|
55
|
-
form_params = {}
|
52
|
+
form_params = opts[:form_params] || {}
|
56
53
|
|
57
54
|
# http body (model)
|
58
|
-
post_body =
|
59
|
-
|
55
|
+
post_body = opts[:body]
|
56
|
+
|
57
|
+
return_type = opts[:return_type] || 'EventResponse'
|
58
|
+
|
59
|
+
auth_names = opts[:auth_names] || ['oauth']
|
60
60
|
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
61
61
|
:header_params => header_params,
|
62
62
|
:query_params => query_params,
|
63
63
|
:form_params => form_params,
|
64
64
|
:body => post_body,
|
65
65
|
:auth_names => auth_names,
|
66
|
-
:return_type =>
|
66
|
+
:return_type => return_type)
|
67
|
+
|
67
68
|
if @api_client.config.debugging
|
68
69
|
@api_client.config.logger.debug "API called: EventsApi#get_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
69
70
|
end
|
@@ -89,7 +90,7 @@ module Clever
|
|
89
90
|
# @option opts [String] :ending_before
|
90
91
|
# @option opts [String] :school
|
91
92
|
# @option opts [Array<String>] :record_type
|
92
|
-
# @return [Array<(EventsResponse,
|
93
|
+
# @return [Array<(EventsResponse, Integer, Hash)>] EventsResponse data, response status code and response headers
|
93
94
|
def get_events_with_http_info(opts = {})
|
94
95
|
if @api_client.config.debugging
|
95
96
|
@api_client.config.logger.debug 'Calling API: EventsApi.get_events ...'
|
@@ -98,7 +99,7 @@ module Clever
|
|
98
99
|
local_var_path = '/events'
|
99
100
|
|
100
101
|
# query parameters
|
101
|
-
query_params = {}
|
102
|
+
query_params = opts[:query_params] || {}
|
102
103
|
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
103
104
|
query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?
|
104
105
|
query_params[:'ending_before'] = opts[:'ending_before'] if !opts[:'ending_before'].nil?
|
@@ -106,23 +107,27 @@ module Clever
|
|
106
107
|
query_params[:'record_type'] = @api_client.build_collection_param(opts[:'record_type'], :multi) if !opts[:'record_type'].nil?
|
107
108
|
|
108
109
|
# header parameters
|
109
|
-
header_params = {}
|
110
|
+
header_params = opts[:header_params] || {}
|
110
111
|
# HTTP header 'Accept' (if needed)
|
111
112
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
112
113
|
|
113
114
|
# form parameters
|
114
|
-
form_params = {}
|
115
|
+
form_params = opts[:form_params] || {}
|
115
116
|
|
116
117
|
# http body (model)
|
117
|
-
post_body =
|
118
|
-
|
118
|
+
post_body = opts[:body]
|
119
|
+
|
120
|
+
return_type = opts[:return_type] || 'EventsResponse'
|
121
|
+
|
122
|
+
auth_names = opts[:auth_names] || ['oauth']
|
119
123
|
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
120
124
|
:header_params => header_params,
|
121
125
|
:query_params => query_params,
|
122
126
|
:form_params => form_params,
|
123
127
|
:body => post_body,
|
124
128
|
:auth_names => auth_names,
|
125
|
-
:return_type =>
|
129
|
+
:return_type => return_type)
|
130
|
+
|
126
131
|
if @api_client.config.debugging
|
127
132
|
@api_client.config.logger.debug "API called: EventsApi#get_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
128
133
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Clever API
|
3
3
|
|
4
|
-
#
|
4
|
+
#The Clever API
|
5
5
|
|
6
6
|
OpenAPI spec version: 2.1.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
12
|
module Clever
|
@@ -34,5 +33,25 @@ module Clever
|
|
34
33
|
super arg
|
35
34
|
end
|
36
35
|
end
|
36
|
+
|
37
|
+
# Override to_s to display a friendly error message
|
38
|
+
def to_s
|
39
|
+
message
|
40
|
+
end
|
41
|
+
|
42
|
+
def message
|
43
|
+
if @message.nil?
|
44
|
+
msg = "Error message: the server returns an error"
|
45
|
+
else
|
46
|
+
msg = @message
|
47
|
+
end
|
48
|
+
|
49
|
+
msg += "\nHTTP status code: #{code}" if code
|
50
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
51
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
52
|
+
|
53
|
+
msg
|
54
|
+
end
|
55
|
+
|
37
56
|
end
|
38
57
|
end
|
@@ -1,17 +1,14 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Clever API
|
3
3
|
|
4
|
-
#
|
4
|
+
#The Clever API
|
5
5
|
|
6
6
|
OpenAPI spec version: 2.1.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
|
-
require 'addressable/uri'
|
14
|
-
|
15
12
|
module Clever
|
16
13
|
class Configuration
|
17
14
|
# Defines url scheme
|
@@ -130,7 +127,7 @@ module Clever
|
|
130
127
|
def initialize
|
131
128
|
@scheme = 'https'
|
132
129
|
@host = 'api.clever.com'
|
133
|
-
@base_path = ''
|
130
|
+
@base_path = 'https://api.clever.com/v2.1'
|
134
131
|
@api_key = {}
|
135
132
|
@api_key_prefix = {}
|
136
133
|
@timeout = 0
|
@@ -174,8 +171,7 @@ module Clever
|
|
174
171
|
end
|
175
172
|
|
176
173
|
def base_url
|
177
|
-
|
178
|
-
Addressable::URI.encode(url)
|
174
|
+
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
179
175
|
end
|
180
176
|
|
181
177
|
# Gets API key (with prefix if set).
|
@@ -1,13 +1,12 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Clever API
|
3
3
|
|
4
|
-
#
|
4
|
+
#The Clever API
|
5
5
|
|
6
6
|
OpenAPI spec version: 2.1.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
12
|
require 'date'
|
@@ -27,26 +26,41 @@ module Clever
|
|
27
26
|
end
|
28
27
|
|
29
28
|
# Attribute type mapping.
|
30
|
-
def self.
|
29
|
+
def self.openapi_types
|
31
30
|
{
|
32
|
-
:'first' => :'
|
33
|
-
:'last' => :'
|
31
|
+
:'first' => :'Object',
|
32
|
+
:'last' => :'Object'
|
34
33
|
}
|
35
34
|
end
|
36
35
|
|
36
|
+
# List of attributes with nullable: true
|
37
|
+
def self.openapi_nullable
|
38
|
+
Set.new([
|
39
|
+
:'first',
|
40
|
+
:'last'
|
41
|
+
])
|
42
|
+
end
|
43
|
+
|
37
44
|
# Initializes the object
|
38
45
|
# @param [Hash] attributes Model attributes in the form of hash
|
39
46
|
def initialize(attributes = {})
|
40
|
-
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::AdminName` initialize method"
|
49
|
+
end
|
41
50
|
|
42
|
-
# convert string to symbol for hash key
|
43
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::AdminName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
55
|
+
end
|
56
|
+
h[k.to_sym] = v
|
57
|
+
}
|
44
58
|
|
45
|
-
if attributes.
|
59
|
+
if attributes.key?(:'first')
|
46
60
|
self.first = attributes[:'first']
|
47
61
|
end
|
48
62
|
|
49
|
-
if attributes.
|
63
|
+
if attributes.key?(:'last')
|
50
64
|
self.last = attributes[:'last']
|
51
65
|
end
|
52
66
|
end
|
@@ -80,17 +94,24 @@ module Clever
|
|
80
94
|
end
|
81
95
|
|
82
96
|
# Calculates hash code according to all attributes.
|
83
|
-
# @return [
|
97
|
+
# @return [Integer] Hash code
|
84
98
|
def hash
|
85
99
|
[first, last].hash
|
86
100
|
end
|
87
101
|
|
102
|
+
# Builds the object from hash
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
# @return [Object] Returns the model itself
|
105
|
+
def self.build_from_hash(attributes)
|
106
|
+
new.build_from_hash(attributes)
|
107
|
+
end
|
108
|
+
|
88
109
|
# Builds the object from hash
|
89
110
|
# @param [Hash] attributes Model attributes in the form of hash
|
90
111
|
# @return [Object] Returns the model itself
|
91
112
|
def build_from_hash(attributes)
|
92
113
|
return nil unless attributes.is_a?(Hash)
|
93
|
-
self.class.
|
114
|
+
self.class.openapi_types.each_pair do |key, type|
|
94
115
|
if type =~ /\AArray<(.*)>/i
|
95
116
|
# check to ensure the input is an array given that the attribute
|
96
117
|
# is documented as an array but the input is not
|
@@ -99,7 +120,9 @@ module Clever
|
|
99
120
|
end
|
100
121
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
101
122
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
102
|
-
|
123
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
124
|
+
self.send("#{key}=", nil)
|
125
|
+
end
|
103
126
|
end
|
104
127
|
|
105
128
|
self
|
@@ -121,7 +144,7 @@ module Clever
|
|
121
144
|
value.to_i
|
122
145
|
when :Float
|
123
146
|
value.to_f
|
124
|
-
when :
|
147
|
+
when :Boolean
|
125
148
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
126
149
|
true
|
127
150
|
else
|
@@ -142,8 +165,7 @@ module Clever
|
|
142
165
|
end
|
143
166
|
end
|
144
167
|
else # model
|
145
|
-
|
146
|
-
temp_model.build_from_hash(value)
|
168
|
+
Clever.const_get(type).build_from_hash(value)
|
147
169
|
end
|
148
170
|
end
|
149
171
|
|
@@ -165,7 +187,11 @@ module Clever
|
|
165
187
|
hash = {}
|
166
188
|
self.class.attribute_map.each_pair do |attr, param|
|
167
189
|
value = self.send(attr)
|
168
|
-
|
190
|
+
if value.nil?
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
193
|
+
end
|
194
|
+
|
169
195
|
hash[param] = _to_hash(value)
|
170
196
|
end
|
171
197
|
hash
|
@@ -187,7 +213,5 @@ module Clever
|
|
187
213
|
else
|
188
214
|
value
|
189
215
|
end
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|
216
|
+
end end
|
193
217
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Clever API
|
3
3
|
|
4
|
-
#
|
4
|
+
#The Clever API
|
5
5
|
|
6
6
|
OpenAPI spec version: 2.1.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version:
|
10
|
-
|
9
|
+
Swagger Codegen version: 3.0.51
|
11
10
|
=end
|
12
11
|
|
13
12
|
require 'date'
|
@@ -24,21 +23,34 @@ module Clever
|
|
24
23
|
end
|
25
24
|
|
26
25
|
# Attribute type mapping.
|
27
|
-
def self.
|
26
|
+
def self.openapi_types
|
28
27
|
{
|
29
|
-
:'message' => :'
|
28
|
+
:'message' => :'Object'
|
30
29
|
}
|
31
30
|
end
|
32
31
|
|
32
|
+
# List of attributes with nullable: true
|
33
|
+
def self.openapi_nullable
|
34
|
+
Set.new([
|
35
|
+
])
|
36
|
+
end
|
37
|
+
|
33
38
|
# Initializes the object
|
34
39
|
# @param [Hash] attributes Model attributes in the form of hash
|
35
40
|
def initialize(attributes = {})
|
36
|
-
|
41
|
+
if (!attributes.is_a?(Hash))
|
42
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Clever::BadRequest` initialize method"
|
43
|
+
end
|
37
44
|
|
38
|
-
# convert string to symbol for hash key
|
39
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
45
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
47
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
48
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Clever::BadRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
49
|
+
end
|
50
|
+
h[k.to_sym] = v
|
51
|
+
}
|
40
52
|
|
41
|
-
if attributes.
|
53
|
+
if attributes.key?(:'message')
|
42
54
|
self.message = attributes[:'message']
|
43
55
|
end
|
44
56
|
end
|
@@ -71,17 +83,24 @@ module Clever
|
|
71
83
|
end
|
72
84
|
|
73
85
|
# Calculates hash code according to all attributes.
|
74
|
-
# @return [
|
86
|
+
# @return [Integer] Hash code
|
75
87
|
def hash
|
76
88
|
[message].hash
|
77
89
|
end
|
78
90
|
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def self.build_from_hash(attributes)
|
95
|
+
new.build_from_hash(attributes)
|
96
|
+
end
|
97
|
+
|
79
98
|
# Builds the object from hash
|
80
99
|
# @param [Hash] attributes Model attributes in the form of hash
|
81
100
|
# @return [Object] Returns the model itself
|
82
101
|
def build_from_hash(attributes)
|
83
102
|
return nil unless attributes.is_a?(Hash)
|
84
|
-
self.class.
|
103
|
+
self.class.openapi_types.each_pair do |key, type|
|
85
104
|
if type =~ /\AArray<(.*)>/i
|
86
105
|
# check to ensure the input is an array given that the attribute
|
87
106
|
# is documented as an array but the input is not
|
@@ -90,7 +109,9 @@ module Clever
|
|
90
109
|
end
|
91
110
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
111
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
-
|
112
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
end
|
94
115
|
end
|
95
116
|
|
96
117
|
self
|
@@ -112,7 +133,7 @@ module Clever
|
|
112
133
|
value.to_i
|
113
134
|
when :Float
|
114
135
|
value.to_f
|
115
|
-
when :
|
136
|
+
when :Boolean
|
116
137
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
117
138
|
true
|
118
139
|
else
|
@@ -133,8 +154,7 @@ module Clever
|
|
133
154
|
end
|
134
155
|
end
|
135
156
|
else # model
|
136
|
-
|
137
|
-
temp_model.build_from_hash(value)
|
157
|
+
Clever.const_get(type).build_from_hash(value)
|
138
158
|
end
|
139
159
|
end
|
140
160
|
|
@@ -156,7 +176,11 @@ module Clever
|
|
156
176
|
hash = {}
|
157
177
|
self.class.attribute_map.each_pair do |attr, param|
|
158
178
|
value = self.send(attr)
|
159
|
-
|
179
|
+
if value.nil?
|
180
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
181
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
182
|
+
end
|
183
|
+
|
160
184
|
hash[param] = _to_hash(value)
|
161
185
|
end
|
162
186
|
hash
|
@@ -178,7 +202,5 @@ module Clever
|
|
178
202
|
else
|
179
203
|
value
|
180
204
|
end
|
181
|
-
end
|
182
|
-
|
183
|
-
end
|
205
|
+
end end
|
184
206
|
end
|