lib/connectwise-ruby-sdk/models/manufacturer.rb in connectwise-ruby-sdk-1.0.3 vs lib/connectwise-ruby-sdk/models/manufacturer.rb in connectwise-ruby-sdk-2.0.0

- old
+ new

@@ -1,31 +1,9 @@ -=begin -#Connectwise REST API -#ConnectWise API - -OpenAPI spec version: 1.0.0 -Contact: platform@connectwise.com -Generated by: https://github.com/swagger-api/swagger-codegen.git - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=end - require 'date' -module Connectwise +module ConnectWise class Manufacturer attr_accessor :id attr_accessor :name @@ -146,11 +124,11 @@ # @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 =~ /^Array<(.*)>/i + 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 @@ -177,30 +155,30 @@ when :Integer value.to_i when :Float value.to_f when :BOOLEAN - if value.to_s =~ /^(true|t|yes|y|1)$/i + 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<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/ + when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\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 = Connectwise.const_get(type).new + temp_model = ConnectWise.const_get(type).new temp_model.build_from_hash(value) end end # Returns the string representation of the object