class ConnectWise::Configuration
Attributes
Metadata
of the entity
Defines the access token (Bearer) used with OAuth2.
Defines API keys used with API Key authentications.
@return [Hash] key: parameter name, value: parameter value (API key)
@example parameter name is “api_key”, API key is “xxx” (e.g. “api_key=xxx” in query string)
config.api_key['api_key'] = 'xxx'
Defines API key prefixes used with API Key authentications.
@return [Hash] key: parameter name, value: API key prefix
@example parameter name is “Authorization”, API key prefix is “Token” (e.g. “Authorization: Token
xxx” in headers)
config.api_key_prefix['api_key'] = 'Token'
Defines url base path
TLS/SSL setting
Client certificate file (for client certificate)
Defines the clientId header to send with requests
@return [String]
Set this to false to skip client side validation in the operation. Default to true. @return [true, false]
Set this to enable/disable debugging. When enabled (set to true), HTTP request/response details will be logged with `logger.debug` (see the `logger` attribute). Default to false.
@return [true, false]
Defines url host
TLS/SSL setting
Client private key file (for client certificate)
Defines the logger used for debugging. Default to `Rails.logger` (when in Rails) or logging to STDOUT.
@return [#debug]
Set this to customize parameters encoding of array parameter with multi collectionFormat. Default to nil.
@see The params_encoding
option of Ethon. Related source code: github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
Defines the password used with HTTP basic authentication.
@return [String]
Defines url scheme
TLS/SSL setting
Set this to customize the certificate file to verify the peer.
@return [String] the path to the certificate file
@see The `cainfo` option of Typhoeus, `–cert` option of libcurl. Related source code: github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
Defines the temporary folder to store downloaded files (for API endpoints that have file response). Default to use `Tempfile`.
@return [String]
The time limit for HTTP request in seconds. Default to 0 (never times out).
Defines the username used with HTTP basic authentication.
@return [String]
TLS/SSL setting
Set this to false to skip verifying SSL certificate when calling API from https server. Default to true.
@note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
@return [true, false]
TLS/SSL setting
Set this to false to skip verifying SSL host name Default to true.
@note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
@return [true, false]
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 112 def self.attribute_map { :'id' => :'id', :'name' => :'name', :'type' => :'type', :'status' => :'status', :'company' => :'company', :'contact' => :'contact', :'site' => :'site', :'location_id' => :'locationId', :'business_unit_id' => :'businessUnitId', :'device_identifier' => :'deviceIdentifier', :'serial_number' => :'serialNumber', :'model_number' => :'modelNumber', :'tag_number' => :'tagNumber', :'purchase_date' => :'purchaseDate', :'installation_date' => :'installationDate', :'installed_by' => :'installedBy', :'warranty_expiration_date' => :'warrantyExpirationDate', :'vendor_notes' => :'vendorNotes', :'notes' => :'notes', :'mac_address' => :'macAddress', :'last_login_name' => :'lastLoginName', :'bill_flag' => :'billFlag', :'backup_successes' => :'backupSuccesses', :'backup_incomplete' => :'backupIncomplete', :'backup_failed' => :'backupFailed', :'backup_restores' => :'backupRestores', :'last_backup_date' => :'lastBackupDate', :'backup_server_name' => :'backupServerName', :'backup_billable_space_gb' => :'backupBillableSpaceGb', :'backup_protected_device_list' => :'backupProtectedDeviceList', :'backup_year' => :'backupYear', :'backup_month' => :'backupMonth', :'ip_address' => :'ipAddress', :'default_gateway' => :'defaultGateway', :'os_type' => :'osType', :'os_info' => :'osInfo', :'cpu_speed' => :'cpuSpeed', :'ram' => :'ram', :'local_hard_drives' => :'localHardDrives', :'parent_configuration_id' => :'parentConfigurationId', :'vendor' => :'vendor', :'manufacturer' => :'manufacturer', :'questions' => :'questions', :'active_flag' => :'activeFlag', :'management_link' => :'managementLink', :'remote_link' => :'remoteLink', :'sla' => :'sla', :'mobile_guid' => :'mobileGuid', :'_info' => :'_info', :'display_vendor_flag' => :'displayVendorFlag', :'custom_fields' => :'customFields' } end
The default Configuration
object.
# File lib/connectwise-ruby-sdk/configuration.rb, line 147 def self.default @@default ||= Configuration.new end
# File lib/connectwise-ruby-sdk/configuration.rb, line 125 def initialize @scheme = 'https' @host = 'api-na.myconnectwise.net' @base_path = '/v4_6_release/apis/3.0' @api_key = {} @api_key_prefix = {} @timeout = 0 @client_side_validation = true @verify_ssl = true @verify_ssl_host = true @params_encoding = nil @cert_file = nil @key_file = nil @debugging = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) yield(self) if block_given? end
Attribute type mapping.
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 169 def self.swagger_types { :'id' => :'Integer', :'name' => :'String', :'type' => :'ConfigurationTypeReference', :'status' => :'ConfigurationStatusReference', :'company' => :'CompanyReference', :'contact' => :'ContactReference', :'site' => :'SiteReference', :'location_id' => :'Integer', :'business_unit_id' => :'Integer', :'device_identifier' => :'String', :'serial_number' => :'String', :'model_number' => :'String', :'tag_number' => :'String', :'purchase_date' => :'DateTime', :'installation_date' => :'DateTime', :'installed_by' => :'MemberReference', :'warranty_expiration_date' => :'DateTime', :'vendor_notes' => :'String', :'notes' => :'String', :'mac_address' => :'String', :'last_login_name' => :'String', :'bill_flag' => :'BOOLEAN', :'backup_successes' => :'Integer', :'backup_incomplete' => :'Integer', :'backup_failed' => :'Integer', :'backup_restores' => :'Integer', :'last_backup_date' => :'DateTime', :'backup_server_name' => :'String', :'backup_billable_space_gb' => :'Float', :'backup_protected_device_list' => :'String', :'backup_year' => :'Integer', :'backup_month' => :'Integer', :'ip_address' => :'String', :'default_gateway' => :'String', :'os_type' => :'String', :'os_info' => :'String', :'cpu_speed' => :'String', :'ram' => :'String', :'local_hard_drives' => :'String', :'parent_configuration_id' => :'Integer', :'vendor' => :'CompanyReference', :'manufacturer' => :'ManufacturerReference', :'questions' => :'Array<ConfigurationQuestion>', :'active_flag' => :'BOOLEAN', :'management_link' => :'String', :'remote_link' => :'String', :'sla' => :'SLAReference', :'mobile_guid' => :'Guid', :'_info' => :'Metadata', :'display_vendor_flag' => :'BOOLEAN', :'custom_fields' => :'Array<CustomFieldValue>' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 732 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && type == o.type && status == o.status && company == o.company && contact == o.contact && site == o.site && location_id == o.location_id && business_unit_id == o.business_unit_id && device_identifier == o.device_identifier && serial_number == o.serial_number && model_number == o.model_number && tag_number == o.tag_number && purchase_date == o.purchase_date && installation_date == o.installation_date && installed_by == o.installed_by && warranty_expiration_date == o.warranty_expiration_date && vendor_notes == o.vendor_notes && notes == o.notes && mac_address == o.mac_address && last_login_name == o.last_login_name && bill_flag == o.bill_flag && backup_successes == o.backup_successes && backup_incomplete == o.backup_incomplete && backup_failed == o.backup_failed && backup_restores == o.backup_restores && last_backup_date == o.last_backup_date && backup_server_name == o.backup_server_name && backup_billable_space_gb == o.backup_billable_space_gb && backup_protected_device_list == o.backup_protected_device_list && backup_year == o.backup_year && backup_month == o.backup_month && ip_address == o.ip_address && default_gateway == o.default_gateway && os_type == o.os_type && os_info == o.os_info && cpu_speed == o.cpu_speed && ram == o.ram && local_hard_drives == o.local_hard_drives && parent_configuration_id == o.parent_configuration_id && vendor == o.vendor && manufacturer == o.manufacturer && questions == o.questions && active_flag == o.active_flag && management_link == o.management_link && remote_link == o.remote_link && sla == o.sla && mobile_guid == o.mobile_guid && _info == o._info && display_vendor_flag == o.display_vendor_flag && custom_fields == o.custom_fields end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 824 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<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } 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.build_from_hash(value) end 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
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 890 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
Gets API key (with prefix if set). @param [String] param_name the parameter name of API key auth
# File lib/connectwise-ruby-sdk/configuration.rb, line 178 def api_key_with_prefix(param_name) if @api_key_prefix[param_name] "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" else @api_key[param_name] end end
Returns Auth Settings hash for api client.
# File lib/connectwise-ruby-sdk/configuration.rb, line 192 def auth_settings { 'BasicAuth' => { type: 'basic', in: 'header', key: 'Authorization', value: basic_auth_token }, } end
Custom attribute writer method with validation @param [Object] backup_server_name
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 633 def backup_server_name=(backup_server_name) if !backup_server_name.nil? && backup_server_name.to_s.length > 50 fail ArgumentError, "invalid value for 'backup_server_name', the character length must be smaller than or equal to 50." end @backup_server_name = backup_server_name end
# File lib/connectwise-ruby-sdk/configuration.rb, line 165 def base_path=(base_path) # Add leading and trailing slashes to base_path @base_path = "/#{base_path}".gsub(/\/+/, '/') @base_path = "" if @base_path == "/" end
# File lib/connectwise-ruby-sdk/configuration.rb, line 171 def base_url url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') URI.encode(url) end
Gets Basic Auth token string
# File lib/connectwise-ruby-sdk/configuration.rb, line 187 def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 803 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
# File lib/connectwise-ruby-sdk/configuration.rb, line 151 def configure yield(self) if block_given? end
Custom attribute writer method with validation @param [Object] cpu_speed
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 688 def cpu_speed=(cpu_speed) if !cpu_speed.nil? && cpu_speed.to_s.length > 100 fail ArgumentError, "invalid value for 'cpu_speed', the character length must be smaller than or equal to 100." end @cpu_speed = cpu_speed end
Custom attribute writer method with validation @param [Object] default_gateway
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 655 def default_gateway=(default_gateway) if !default_gateway.nil? && default_gateway.to_s.length > 50 fail ArgumentError, "invalid value for 'default_gateway', the character length must be smaller than or equal to 50." end @default_gateway = default_gateway end
Custom attribute writer method with validation @param [Object] device_identifier
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 567 def device_identifier=(device_identifier) if !device_identifier.nil? && device_identifier.to_s.length > 100 fail ArgumentError, "invalid value for 'device_identifier', the character length must be smaller than or equal to 100." end @device_identifier = device_identifier end
@see the `==` method @param [Object] Object to be compared
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 790 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 796 def hash [id, name, type, status, company, contact, site, location_id, business_unit_id, device_identifier, serial_number, model_number, tag_number, purchase_date, installation_date, installed_by, warranty_expiration_date, vendor_notes, notes, mac_address, last_login_name, bill_flag, backup_successes, backup_incomplete, backup_failed, backup_restores, last_backup_date, backup_server_name, backup_billable_space_gb, backup_protected_device_list, backup_year, backup_month, ip_address, default_gateway, os_type, os_info, cpu_speed, ram, local_hard_drives, parent_configuration_id, vendor, manufacturer, questions, active_flag, management_link, remote_link, sla, mobile_guid, _info, display_vendor_flag, custom_fields].hash end
# File lib/connectwise-ruby-sdk/configuration.rb, line 160 def host=(host) # remove http(s):// and anything after a slash @host = host.sub(/https?:\/\//, '').split('/').first end
Custom attribute writer method with validation @param [Object] ip_address
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 644 def ip_address=(ip_address) if !ip_address.nil? && ip_address.to_s.length > 50 fail ArgumentError, "invalid value for 'ip_address', the character length must be smaller than or equal to 50." end @ip_address = ip_address end
Custom attribute writer method with validation @param [Object] last_login_name
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 622 def last_login_name=(last_login_name) if !last_login_name.nil? && last_login_name.to_s.length > 100 fail ArgumentError, "invalid value for 'last_login_name', the character length must be smaller than or equal to 100." end @last_login_name = last_login_name end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 445 def list_invalid_properties invalid_properties = Array.new if @name.nil? invalid_properties.push("invalid value for 'name', name cannot be nil.") end if @name.to_s.length > 100 invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 100.") end if @type.nil? invalid_properties.push("invalid value for 'type', type cannot be nil.") end if @company.nil? invalid_properties.push("invalid value for 'company', company cannot be nil.") end if !@device_identifier.nil? && @device_identifier.to_s.length > 100 invalid_properties.push("invalid value for 'device_identifier', the character length must be smaller than or equal to 100.") end if !@serial_number.nil? && @serial_number.to_s.length > 250 invalid_properties.push("invalid value for 'serial_number', the character length must be smaller than or equal to 250.") end if !@model_number.nil? && @model_number.to_s.length > 50 invalid_properties.push("invalid value for 'model_number', the character length must be smaller than or equal to 50.") end if !@tag_number.nil? && @tag_number.to_s.length > 50 invalid_properties.push("invalid value for 'tag_number', the character length must be smaller than or equal to 50.") end if !@mac_address.nil? && @mac_address.to_s.length > 25 invalid_properties.push("invalid value for 'mac_address', the character length must be smaller than or equal to 25.") end if !@last_login_name.nil? && @last_login_name.to_s.length > 100 invalid_properties.push("invalid value for 'last_login_name', the character length must be smaller than or equal to 100.") end if !@backup_server_name.nil? && @backup_server_name.to_s.length > 50 invalid_properties.push("invalid value for 'backup_server_name', the character length must be smaller than or equal to 50.") end if !@ip_address.nil? && @ip_address.to_s.length > 50 invalid_properties.push("invalid value for 'ip_address', the character length must be smaller than or equal to 50.") end if !@default_gateway.nil? && @default_gateway.to_s.length > 50 invalid_properties.push("invalid value for 'default_gateway', the character length must be smaller than or equal to 50.") end if !@os_type.nil? && @os_type.to_s.length > 250 invalid_properties.push("invalid value for 'os_type', the character length must be smaller than or equal to 250.") end if !@os_info.nil? && @os_info.to_s.length > 250 invalid_properties.push("invalid value for 'os_info', the character length must be smaller than or equal to 250.") end if !@cpu_speed.nil? && @cpu_speed.to_s.length > 100 invalid_properties.push("invalid value for 'cpu_speed', the character length must be smaller than or equal to 100.") end if !@ram.nil? && @ram.to_s.length > 25 invalid_properties.push("invalid value for 'ram', the character length must be smaller than or equal to 25.") end if !@management_link.nil? && @management_link.to_s.length > 200 invalid_properties.push("invalid value for 'management_link', the character length must be smaller than or equal to 200.") end if !@remote_link.nil? && @remote_link.to_s.length > 200 invalid_properties.push("invalid value for 'remote_link', the character length must be smaller than or equal to 200.") end return invalid_properties end
Custom attribute writer method with validation @param [Object] mac_address
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 611 def mac_address=(mac_address) if !mac_address.nil? && mac_address.to_s.length > 25 fail ArgumentError, "invalid value for 'mac_address', the character length must be smaller than or equal to 25." end @mac_address = mac_address end
Custom attribute writer method with validation @param [Object] management_link
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 710 def management_link=(management_link) if !management_link.nil? && management_link.to_s.length > 200 fail ArgumentError, "invalid value for 'management_link', the character length must be smaller than or equal to 200." end @management_link = management_link end
Custom attribute writer method with validation @param [Object] model_number
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 589 def model_number=(model_number) if !model_number.nil? && model_number.to_s.length > 50 fail ArgumentError, "invalid value for 'model_number', the character length must be smaller than or equal to 50." end @model_number = model_number end
Custom attribute writer method with validation @param [Object] name Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 553 def name=(name) if name.nil? fail ArgumentError, "name cannot be nil" end if name.to_s.length > 100 fail ArgumentError, "invalid value for 'name', the character length must be smaller than or equal to 100." end @name = name end
Custom attribute writer method with validation @param [Object] os_info
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 677 def os_info=(os_info) if !os_info.nil? && os_info.to_s.length > 250 fail ArgumentError, "invalid value for 'os_info', the character length must be smaller than or equal to 250." end @os_info = os_info end
Custom attribute writer method with validation @param [Object] os_type
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 666 def os_type=(os_type) if !os_type.nil? && os_type.to_s.length > 250 fail ArgumentError, "invalid value for 'os_type', the character length must be smaller than or equal to 250." end @os_type = os_type end
Custom attribute writer method with validation @param [Object] ram Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 699 def ram=(ram) if !ram.nil? && ram.to_s.length > 25 fail ArgumentError, "invalid value for 'ram', the character length must be smaller than or equal to 25." end @ram = ram end
Custom attribute writer method with validation @param [Object] remote_link
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 721 def remote_link=(remote_link) if !remote_link.nil? && remote_link.to_s.length > 200 fail ArgumentError, "invalid value for 'remote_link', the character length must be smaller than or equal to 200." end @remote_link = remote_link end
# File lib/connectwise-ruby-sdk/configuration.rb, line 155 def scheme=(scheme) # remove :// from scheme @scheme = scheme.sub(/:\/\//, '') end
Custom attribute writer method with validation @param [Object] serial_number
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 578 def serial_number=(serial_number) if !serial_number.nil? && serial_number.to_s.length > 250 fail ArgumentError, "invalid value for 'serial_number', the character length must be smaller than or equal to 250." end @serial_number = serial_number end
Custom attribute writer method with validation @param [Object] tag_number
Value to be assigned
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 600 def tag_number=(tag_number) if !tag_number.nil? && tag_number.to_s.length > 50 fail ArgumentError, "invalid value for 'tag_number', the character length must be smaller than or equal to 50." end @tag_number = tag_number end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 876 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 864 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/connectwise-ruby-sdk/models/configuration.rb, line 528 def valid? return false if @name.nil? return false if @name.to_s.length > 100 return false if @type.nil? return false if @company.nil? return false if !@device_identifier.nil? && @device_identifier.to_s.length > 100 return false if !@serial_number.nil? && @serial_number.to_s.length > 250 return false if !@model_number.nil? && @model_number.to_s.length > 50 return false if !@tag_number.nil? && @tag_number.to_s.length > 50 return false if !@mac_address.nil? && @mac_address.to_s.length > 25 return false if !@last_login_name.nil? && @last_login_name.to_s.length > 100 return false if !@backup_server_name.nil? && @backup_server_name.to_s.length > 50 return false if !@ip_address.nil? && @ip_address.to_s.length > 50 return false if !@default_gateway.nil? && @default_gateway.to_s.length > 50 return false if !@os_type.nil? && @os_type.to_s.length > 250 return false if !@os_info.nil? && @os_info.to_s.length > 250 return false if !@cpu_speed.nil? && @cpu_speed.to_s.length > 100 return false if !@ram.nil? && @ram.to_s.length > 25 return false if !@management_link.nil? && @management_link.to_s.length > 200 return false if !@remote_link.nil? && @remote_link.to_s.length > 200 return true end