diff --git a/docs/DistrictStatus.md b/docs/DistrictStatus.md deleted file mode 100644 index 4e0ba365..00000000 --- a/docs/DistrictStatus.md +++ /dev/null @@ -1,15 +0,0 @@ -# Clever::DistrictStatus - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**error** | **String** | | [optional] -**id** | **String** | | [optional] -**last_sync** | **String** | | [optional] -**launch_date** | **String** | | [optional] -**pause_end** | **String** | | [optional] -**pause_start** | **String** | | [optional] -**sis_type** | **String** | | [optional] -**state** | **String** | | [optional] - - diff --git a/docs/DistrictStatusResponse.md b/docs/DistrictStatusResponse.md deleted file mode 100644 index 7f9589d3..00000000 --- a/docs/DistrictStatusResponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# Clever::DistrictStatusResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**DistrictStatus**](DistrictStatus.md) | | [optional] - - diff --git a/docs/DistrictStatusResponses.md b/docs/DistrictStatusResponses.md deleted file mode 100644 index 7098e315..00000000 --- a/docs/DistrictStatusResponses.md +++ /dev/null @@ -1,8 +0,0 @@ -# Clever::DistrictStatusResponses - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**Array<DistrictStatusResponse>**](DistrictStatusResponse.md) | | [optional] - - diff --git a/docs/GradeLevelsResponse.md b/docs/GradeLevelsResponse.md deleted file mode 100644 index 5e356714..00000000 --- a/docs/GradeLevelsResponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# Clever::GradeLevelsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | **Array<String>** | | [optional] - - diff --git a/docs/StudentContact.md b/docs/StudentContact.md deleted file mode 100644 index 65645b41..00000000 --- a/docs/StudentContact.md +++ /dev/null @@ -1,17 +0,0 @@ -# Clever::StudentContact - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**district** | **String** | | [optional] -**email** | **String** | | [optional] -**id** | **String** | | [optional] -**name** | **String** | | [optional] -**phone** | **String** | | [optional] -**phone_type** | **String** | | [optional] -**relationship** | **String** | | [optional] -**sis_id** | **String** | | [optional] -**student** | **String** | | [optional] -**type** | **String** | | [optional] - - diff --git a/docs/StudentContactObject.md b/docs/StudentContactObject.md deleted file mode 100644 index e92e1c0f..00000000 --- a/docs/StudentContactObject.md +++ /dev/null @@ -1,8 +0,0 @@ -# Clever::StudentContactObject - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**object** | [**StudentContact**](StudentContact.md) | | [optional] - - diff --git a/docs/StudentContactResponse.md b/docs/StudentContactResponse.md deleted file mode 100644 index 1cddb832..00000000 --- a/docs/StudentContactResponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# Clever::StudentContactResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**StudentContact**](StudentContact.md) | | [optional] - - diff --git a/docs/StudentContactsForStudentResponse.md b/docs/StudentContactsForStudentResponse.md deleted file mode 100644 index 91f6d801..00000000 --- a/docs/StudentContactsForStudentResponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# Clever::StudentContactsForStudentResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**Array<StudentContact>**](StudentContact.md) | | [optional] - - diff --git a/docs/StudentContactsResponse.md b/docs/StudentContactsResponse.md deleted file mode 100644 index 20f693a2..00000000 --- a/docs/StudentContactsResponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# Clever::StudentContactsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**Array<StudentContactResponse>**](StudentContactResponse.md) | | [optional] - - diff --git a/docs/StudentcontactsCreated.md b/docs/StudentcontactsCreated.md deleted file mode 100644 index c6f07528..00000000 --- a/docs/StudentcontactsCreated.md +++ /dev/null @@ -1,11 +0,0 @@ -# Clever::StudentcontactsCreated - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**created** | **String** | | [optional] -**id** | **String** | | [optional] -**type** | **String** | | -**data** | [**StudentContactObject**](StudentContactObject.md) | | [optional] - - diff --git a/docs/StudentcontactsDeleted.md b/docs/StudentcontactsDeleted.md deleted file mode 100644 index 008b7303..00000000 --- a/docs/StudentcontactsDeleted.md +++ /dev/null @@ -1,11 +0,0 @@ -# Clever::StudentcontactsDeleted - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**created** | **String** | | [optional] -**id** | **String** | | [optional] -**type** | **String** | | -**data** | [**StudentContactObject**](StudentContactObject.md) | | [optional] - - diff --git a/docs/StudentcontactsUpdated.md b/docs/StudentcontactsUpdated.md deleted file mode 100644 index 65ce3e0b..00000000 --- a/docs/StudentcontactsUpdated.md +++ /dev/null @@ -1,11 +0,0 @@ -# Clever::StudentcontactsUpdated - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**created** | **String** | | [optional] -**id** | **String** | | [optional] -**type** | **String** | | -**data** | [**StudentContactObject**](StudentContactObject.md) | | [optional] - - diff --git a/lib/clever-ruby/models/district_status.rb b/lib/clever-ruby/models/district_status.rb deleted file mode 100644 index ab40fc22..00000000 --- a/lib/clever-ruby/models/district_status.rb +++ /dev/null @@ -1,284 +0,0 @@ -=begin -#Clever API - -#The Clever API - -OpenAPI spec version: 1.2.0 - -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.2.3 - -=end - -require 'date' - -module Clever - - class DistrictStatus - attr_accessor :error - - attr_accessor :id - - attr_accessor :last_sync - - attr_accessor :launch_date - - attr_accessor :pause_end - - attr_accessor :pause_start - - attr_accessor :sis_type - - attr_accessor :state - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'error' => :'error', - :'id' => :'id', - :'last_sync' => :'last_sync', - :'launch_date' => :'launch_date', - :'pause_end' => :'pause_end', - :'pause_start' => :'pause_start', - :'sis_type' => :'sis_type', - :'state' => :'state' - } - end - - # Attribute type mapping. - def self.swagger_types - { - :'error' => :'String', - :'id' => :'String', - :'last_sync' => :'String', - :'launch_date' => :'String', - :'pause_end' => :'String', - :'pause_start' => :'String', - :'sis_type' => :'String', - :'state' => :'String' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - - if attributes.has_key?(:'error') - self.error = attributes[:'error'] - end - - if attributes.has_key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.has_key?(:'last_sync') - self.last_sync = attributes[:'last_sync'] - end - - if attributes.has_key?(:'launch_date') - self.launch_date = attributes[:'launch_date'] - end - - if attributes.has_key?(:'pause_end') - self.pause_end = attributes[:'pause_end'] - end - - if attributes.has_key?(:'pause_start') - self.pause_start = attributes[:'pause_start'] - end - - if attributes.has_key?(:'sis_type') - self.sis_type = attributes[:'sis_type'] - end - - if attributes.has_key?(:'state') - self.state = attributes[:'state'] - end - - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properies with the reasons - def list_invalid_properties - invalid_properties = Array.new - return invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - state_validator = EnumAttributeValidator.new('String', ["running", "pending", "error", "paused"]) - return false unless state_validator.valid?(@state) - return true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] state Object to be assigned - def state=(state) - validator = EnumAttributeValidator.new('String', ["running", "pending", "error", "paused"]) - unless validator.valid?(state) - fail ArgumentError, "invalid value for 'state', must be one of #{validator.allowable_values}." - end - @state = state - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - error == o.error && - id == o.id && - last_sync == o.last_sync && - launch_date == o.launch_date && - pause_end == o.pause_end && - pause_start == o.pause_start && - sis_type == o.sis_type && - state == o.state - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [error, id, last_sync, launch_date, pause_end, pause_start, sis_type, state].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.swagger_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = Clever.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map{ |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/clever-ruby/models/district_status_response.rb b/lib/clever-ruby/models/district_status_response.rb deleted file mode 100644 index e462a4ba..00000000 --- a/lib/clever-ruby/models/district_status_response.rb +++ /dev/null @@ -1,188 +0,0 @@ -=begin -#Clever API - -#The Clever API - -OpenAPI spec version: 1.2.0 - -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.2.3 - -=end - -require 'date' - -module Clever - - class DistrictStatusResponse - attr_accessor :data - - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'data' => :'data' - } - end - - # Attribute type mapping. - def self.swagger_types - { - :'data' => :'DistrictStatus' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - - if attributes.has_key?(:'data') - self.data = attributes[:'data'] - end - - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properies with the reasons - def list_invalid_properties - invalid_properties = Array.new - return invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - data == o.data - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [data].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.swagger_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = Clever.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map{ |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/clever-ruby/models/district_status_responses.rb b/lib/clever-ruby/models/district_status_responses.rb deleted file mode 100644 index 357eff06..00000000 --- a/lib/clever-ruby/models/district_status_responses.rb +++ /dev/null @@ -1,190 +0,0 @@ -=begin -#Clever API - -#The Clever API - -OpenAPI spec version: 1.2.0 - -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.2.3 - -=end - -require 'date' - -module Clever - - class DistrictStatusResponses - attr_accessor :data - - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'data' => :'data' - } - end - - # Attribute type mapping. - def self.swagger_types - { - :'data' => :'Array' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - - if attributes.has_key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end - end - - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properies with the reasons - def list_invalid_properties - invalid_properties = Array.new - return invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - data == o.data - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [data].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.swagger_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = Clever.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map{ |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/clever-ruby/models/grade_levels_response.rb b/lib/clever-ruby/models/grade_levels_response.rb deleted file mode 100644 index 874e2ba2..00000000 --- a/lib/clever-ruby/models/grade_levels_response.rb +++ /dev/null @@ -1,190 +0,0 @@ -=begin -#Clever API - -#The Clever API - -OpenAPI spec version: 1.2.0 - -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.2.3 - -=end - -require 'date' - -module Clever - - class GradeLevelsResponse - attr_accessor :data - - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'data' => :'data' - } - end - - # Attribute type mapping. - def self.swagger_types - { - :'data' => :'Array' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} - - if attributes.has_key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end - end - - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properies with the reasons - def list_invalid_properties - invalid_properties = Array.new - return invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - data == o.data - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [data].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.swagger_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = Clever.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map{ |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end