require 'date' module PureCloud class TransformEndpoint # The globally unique identifier for the object. attr_accessor :id attr_accessor :name # The Url to the swagger documentation of the endpoint where parsed entities will be posted attr_accessor :swagger_url # The swagger route to use attr_accessor :route # The entity type being posted attr_accessor :entity # The swagger function being called attr_accessor :api_function # Whether this TransformEndpoint has been configured to work (security groups, permissions, etc) attr_accessor :ready # Whether this TransformEndpoint is currently active and accepting transformation operations attr_accessor :active # The number of entities to send in an array for batch POSTs, or 0 for unbatched POSTs attr_accessor :batch_size # The number of parallel POSTs to allow at once attr_accessor :parallelism # The swagger route to use attr_accessor :update_progress_every # The URI for this object attr_accessor :self_uri # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'name' => :'name', :'swagger_url' => :'swaggerUrl', :'route' => :'route', :'entity' => :'entity', :'api_function' => :'apiFunction', :'ready' => :'ready', :'active' => :'active', :'batch_size' => :'batchSize', :'parallelism' => :'parallelism', :'update_progress_every' => :'updateProgressEvery', :'self_uri' => :'selfUri' } end # Attribute type mapping. def self.swagger_types { :'id' => :'String', :'name' => :'String', :'swagger_url' => :'String', :'route' => :'String', :'entity' => :'String', :'api_function' => :'String', :'ready' => :'BOOLEAN', :'active' => :'BOOLEAN', :'batch_size' => :'Integer', :'parallelism' => :'Integer', :'update_progress_every' => :'Integer', :'self_uri' => :'String' } end def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} if attributes[:'id'] self.id = attributes[:'id'] end if attributes[:'name'] self.name = attributes[:'name'] end if attributes[:'swaggerUrl'] self.swagger_url = attributes[:'swaggerUrl'] end if attributes[:'route'] self.route = attributes[:'route'] end if attributes[:'entity'] self.entity = attributes[:'entity'] end if attributes[:'apiFunction'] self.api_function = attributes[:'apiFunction'] end if attributes[:'ready'] self.ready = attributes[:'ready'] else self.ready = false end if attributes[:'active'] self.active = attributes[:'active'] else self.active = false end if attributes[:'batchSize'] self.batch_size = attributes[:'batchSize'] end if attributes[:'parallelism'] self.parallelism = attributes[:'parallelism'] end if attributes[:'updateProgressEvery'] self.update_progress_every = attributes[:'updateProgressEvery'] end if attributes[:'selfUri'] self.self_uri = attributes[:'selfUri'] end end # Check equality by comparing each attribute. def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && swagger_url == o.swagger_url && route == o.route && entity == o.entity && api_function == o.api_function && ready == o.ready && active == o.active && batch_size == o.batch_size && parallelism == o.parallelism && update_progress_every == o.update_progress_every && self_uri == o.self_uri end # @see the `==` method def eql?(o) self == o end # Calculate hash code according to all attributes. def hash [id, name, swagger_url, route, entity, api_function, ready, active, batch_size, parallelism, update_progress_every, self_uri].hash end # build the object from hash 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 attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end 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 =~ /^(true|t|yes|y|1)$/i true else false end 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 _model = Object.const_get("PureCloud").const_get(type).new _model.build_from_hash(value) end end def to_s to_hash.to_s end # to_body is an alias to to_body (backward compatibility)) def to_body to_hash end # return 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 # Method to output non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value 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