=begin PureCloud API PureCloud API OpenAPI spec version: v1 Contact: chuck.pulfer@inin.com Generated by: https://github.com/swagger-api/swagger-codegen.git License: ININ http://www.inin.com Terms of Service: http://www.inin.com =end require 'date' module PureCloud class Account # The globally unique identifier for the object. attr_accessor :id attr_accessor :name attr_accessor :org_legal_name attr_accessor :billing_address_line1 attr_accessor :billing_address_line2 attr_accessor :billing_address_city attr_accessor :billing_address_state attr_accessor :billing_address_zip_code attr_accessor :billing_address_country attr_accessor :legal_address_line1 attr_accessor :legal_address_line2 attr_accessor :legal_address_city attr_accessor :legal_address_state attr_accessor :legal_address_zip_code attr_accessor :legal_address_country attr_accessor :billing_contact_first_name attr_accessor :billing_contact_last_name attr_accessor :billing_contact_email attr_accessor :billing_contact_phone attr_accessor :purchase_order_number attr_accessor :is_tax_exempt attr_accessor :currency attr_accessor :payment_term attr_accessor :contract_term attr_accessor :auto_renew attr_accessor :enabled attr_accessor :min_commit_quantities attr_accessor :estimated_quantities attr_accessor :one_time_charges # 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', :'org_legal_name' => :'orgLegalName', :'billing_address_line1' => :'billingAddressLine1', :'billing_address_line2' => :'billingAddressLine2', :'billing_address_city' => :'billingAddressCity', :'billing_address_state' => :'billingAddressState', :'billing_address_zip_code' => :'billingAddressZipCode', :'billing_address_country' => :'billingAddressCountry', :'legal_address_line1' => :'legalAddressLine1', :'legal_address_line2' => :'legalAddressLine2', :'legal_address_city' => :'legalAddressCity', :'legal_address_state' => :'legalAddressState', :'legal_address_zip_code' => :'legalAddressZipCode', :'legal_address_country' => :'legalAddressCountry', :'billing_contact_first_name' => :'billingContactFirstName', :'billing_contact_last_name' => :'billingContactLastName', :'billing_contact_email' => :'billingContactEmail', :'billing_contact_phone' => :'billingContactPhone', :'purchase_order_number' => :'purchaseOrderNumber', :'is_tax_exempt' => :'isTaxExempt', :'currency' => :'currency', :'payment_term' => :'paymentTerm', :'contract_term' => :'contractTerm', :'auto_renew' => :'autoRenew', :'enabled' => :'enabled', :'min_commit_quantities' => :'minCommitQuantities', :'estimated_quantities' => :'estimatedQuantities', :'one_time_charges' => :'oneTimeCharges', :'self_uri' => :'selfUri' } end # Attribute type mapping. def self.swagger_types { :'id' => :'String', :'name' => :'String', :'org_legal_name' => :'String', :'billing_address_line1' => :'String', :'billing_address_line2' => :'String', :'billing_address_city' => :'String', :'billing_address_state' => :'String', :'billing_address_zip_code' => :'String', :'billing_address_country' => :'String', :'legal_address_line1' => :'String', :'legal_address_line2' => :'String', :'legal_address_city' => :'String', :'legal_address_state' => :'String', :'legal_address_zip_code' => :'String', :'legal_address_country' => :'String', :'billing_contact_first_name' => :'String', :'billing_contact_last_name' => :'String', :'billing_contact_email' => :'String', :'billing_contact_phone' => :'String', :'purchase_order_number' => :'String', :'is_tax_exempt' => :'BOOLEAN', :'currency' => :'String', :'payment_term' => :'String', :'contract_term' => :'Integer', :'auto_renew' => :'BOOLEAN', :'enabled' => :'BOOLEAN', :'min_commit_quantities' => :'Hash', :'estimated_quantities' => :'Hash', :'one_time_charges' => :'Array', :'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[:'orgLegalName'] self.org_legal_name = attributes[:'orgLegalName'] end if attributes[:'billingAddressLine1'] self.billing_address_line1 = attributes[:'billingAddressLine1'] end if attributes[:'billingAddressLine2'] self.billing_address_line2 = attributes[:'billingAddressLine2'] end if attributes[:'billingAddressCity'] self.billing_address_city = attributes[:'billingAddressCity'] end if attributes[:'billingAddressState'] self.billing_address_state = attributes[:'billingAddressState'] end if attributes[:'billingAddressZipCode'] self.billing_address_zip_code = attributes[:'billingAddressZipCode'] end if attributes[:'billingAddressCountry'] self.billing_address_country = attributes[:'billingAddressCountry'] end if attributes[:'legalAddressLine1'] self.legal_address_line1 = attributes[:'legalAddressLine1'] end if attributes[:'legalAddressLine2'] self.legal_address_line2 = attributes[:'legalAddressLine2'] end if attributes[:'legalAddressCity'] self.legal_address_city = attributes[:'legalAddressCity'] end if attributes[:'legalAddressState'] self.legal_address_state = attributes[:'legalAddressState'] end if attributes[:'legalAddressZipCode'] self.legal_address_zip_code = attributes[:'legalAddressZipCode'] end if attributes[:'legalAddressCountry'] self.legal_address_country = attributes[:'legalAddressCountry'] end if attributes[:'billingContactFirstName'] self.billing_contact_first_name = attributes[:'billingContactFirstName'] end if attributes[:'billingContactLastName'] self.billing_contact_last_name = attributes[:'billingContactLastName'] end if attributes[:'billingContactEmail'] self.billing_contact_email = attributes[:'billingContactEmail'] end if attributes[:'billingContactPhone'] self.billing_contact_phone = attributes[:'billingContactPhone'] end if attributes[:'purchaseOrderNumber'] self.purchase_order_number = attributes[:'purchaseOrderNumber'] end if attributes[:'isTaxExempt'] self.is_tax_exempt = attributes[:'isTaxExempt'] else self.is_tax_exempt = false end if attributes[:'currency'] self.currency = attributes[:'currency'] end if attributes[:'paymentTerm'] self.payment_term = attributes[:'paymentTerm'] end if attributes[:'contractTerm'] self.contract_term = attributes[:'contractTerm'] end if attributes[:'autoRenew'] self.auto_renew = attributes[:'autoRenew'] else self.auto_renew = false end if attributes[:'enabled'] self.enabled = attributes[:'enabled'] else self.enabled = false end if attributes[:'minCommitQuantities'] if (value = attributes[:'minCommitQuantities']).is_a?(Array) self.min_commit_quantities = value end end if attributes[:'estimatedQuantities'] if (value = attributes[:'estimatedQuantities']).is_a?(Array) self.estimated_quantities = value end end if attributes[:'oneTimeCharges'] if (value = attributes[:'oneTimeCharges']).is_a?(Array) self.one_time_charges = value end 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 && org_legal_name == o.org_legal_name && billing_address_line1 == o.billing_address_line1 && billing_address_line2 == o.billing_address_line2 && billing_address_city == o.billing_address_city && billing_address_state == o.billing_address_state && billing_address_zip_code == o.billing_address_zip_code && billing_address_country == o.billing_address_country && legal_address_line1 == o.legal_address_line1 && legal_address_line2 == o.legal_address_line2 && legal_address_city == o.legal_address_city && legal_address_state == o.legal_address_state && legal_address_zip_code == o.legal_address_zip_code && legal_address_country == o.legal_address_country && billing_contact_first_name == o.billing_contact_first_name && billing_contact_last_name == o.billing_contact_last_name && billing_contact_email == o.billing_contact_email && billing_contact_phone == o.billing_contact_phone && purchase_order_number == o.purchase_order_number && is_tax_exempt == o.is_tax_exempt && currency == o.currency && payment_term == o.payment_term && contract_term == o.contract_term && auto_renew == o.auto_renew && enabled == o.enabled && min_commit_quantities == o.min_commit_quantities && estimated_quantities == o.estimated_quantities && one_time_charges == o.one_time_charges && 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, org_legal_name, billing_address_line1, billing_address_line2, billing_address_city, billing_address_state, billing_address_zip_code, billing_address_country, legal_address_line1, legal_address_line2, legal_address_city, legal_address_state, legal_address_zip_code, legal_address_country, billing_contact_first_name, billing_contact_last_name, billing_contact_email, billing_contact_phone, purchase_order_number, is_tax_exempt, currency, payment_term, contract_term, auto_renew, enabled, min_commit_quantities, estimated_quantities, one_time_charges, 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.to_s =~ /^(true|t|yes|y|1)$/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 _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