Class: ConnectWise::CompanySite
- Inherits:
-
Object
- Object
- ConnectWise::CompanySite
- Defined in:
- lib/connectwise-ruby-sdk/models/company_site.rb
Instance Attribute Summary collapse
-
#_info ⇒ Object
Metadata of the entity.
-
#address_format ⇒ Object
Returns the value of attribute address_format.
-
#address_line1 ⇒ Object
Returns the value of attribute address_line1.
-
#address_line2 ⇒ Object
Returns the value of attribute address_line2.
-
#calendar ⇒ Object
Returns the value of attribute calendar.
-
#city ⇒ Object
Returns the value of attribute city.
-
#company ⇒ Object
Returns the value of attribute company.
-
#country ⇒ Object
Returns the value of attribute country.
-
#default_billing_flag ⇒ Object
Returns the value of attribute default_billing_flag.
-
#default_mailing_flag ⇒ Object
Returns the value of attribute default_mailing_flag.
-
#default_shipping_flag ⇒ Object
Returns the value of attribute default_shipping_flag.
-
#expense_reimbursement ⇒ Object
Returns the value of attribute expense_reimbursement.
-
#fax_number ⇒ Object
Returns the value of attribute fax_number.
-
#id ⇒ Object
Returns the value of attribute id.
-
#mobile_guid ⇒ Object
Returns the value of attribute mobile_guid.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone_number ⇒ Object
Returns the value of attribute phone_number.
-
#primary_address_flag ⇒ Object
Returns the value of attribute primary_address_flag.
-
#state ⇒ Object
Returns the value of attribute state.
-
#tax_code_id ⇒ Object
Returns the value of attribute tax_code_id.
-
#time_zone ⇒ Object
Returns the value of attribute time_zone.
-
#zip ⇒ Object
Returns the value of attribute zip.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CompanySite
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CompanySite
Initializes the object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 111 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?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'addressLine1') self.address_line1 = attributes[:'addressLine1'] end if attributes.has_key?(:'addressLine2') self.address_line2 = attributes[:'addressLine2'] end if attributes.has_key?(:'city') self.city = attributes[:'city'] end if attributes.has_key?(:'state') self.state = attributes[:'state'] end if attributes.has_key?(:'zip') self.zip = attributes[:'zip'] end if attributes.has_key?(:'country') self.country = attributes[:'country'] end if attributes.has_key?(:'addressFormat') self.address_format = attributes[:'addressFormat'] end if attributes.has_key?(:'phoneNumber') self.phone_number = attributes[:'phoneNumber'] end if attributes.has_key?(:'faxNumber') self.fax_number = attributes[:'faxNumber'] end if attributes.has_key?(:'taxCodeId') self.tax_code_id = attributes[:'taxCodeId'] end if attributes.has_key?(:'expenseReimbursement') self.expense_reimbursement = attributes[:'expenseReimbursement'] end if attributes.has_key?(:'primaryAddressFlag') self.primary_address_flag = attributes[:'primaryAddressFlag'] end if attributes.has_key?(:'defaultShippingFlag') self.default_shipping_flag = attributes[:'defaultShippingFlag'] end if attributes.has_key?(:'defaultBillingFlag') self.default_billing_flag = attributes[:'defaultBillingFlag'] end if attributes.has_key?(:'defaultMailingFlag') self.default_mailing_flag = attributes[:'defaultMailingFlag'] end if attributes.has_key?(:'mobileGuid') self.mobile_guid = attributes[:'mobileGuid'] end if attributes.has_key?(:'calendar') self.calendar = attributes[:'calendar'] end if attributes.has_key?(:'timeZone') self.time_zone = attributes[:'timeZone'] end if attributes.has_key?(:'company') self.company = attributes[:'company'] end if attributes.has_key?(:'_info') self._info = attributes[:'_info'] end end |
Instance Attribute Details
#_info ⇒ Object
Metadata of the entity
50 51 52 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 50 def _info @_info end |
#address_format ⇒ Object
Returns the value of attribute address_format.
23 24 25 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 23 def address_format @address_format end |
#address_line1 ⇒ Object
Returns the value of attribute address_line1.
11 12 13 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 11 def address_line1 @address_line1 end |
#address_line2 ⇒ Object
Returns the value of attribute address_line2.
13 14 15 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 13 def address_line2 @address_line2 end |
#calendar ⇒ Object
Returns the value of attribute calendar.
43 44 45 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 43 def calendar @calendar end |
#city ⇒ Object
Returns the value of attribute city.
15 16 17 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 15 def city @city end |
#company ⇒ Object
Returns the value of attribute company.
47 48 49 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 47 def company @company end |
#country ⇒ Object
Returns the value of attribute country.
21 22 23 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 21 def country @country end |
#default_billing_flag ⇒ Object
Returns the value of attribute default_billing_flag.
37 38 39 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 37 def default_billing_flag @default_billing_flag end |
#default_mailing_flag ⇒ Object
Returns the value of attribute default_mailing_flag.
39 40 41 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 39 def default_mailing_flag @default_mailing_flag end |
#default_shipping_flag ⇒ Object
Returns the value of attribute default_shipping_flag.
35 36 37 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 35 def default_shipping_flag @default_shipping_flag end |
#expense_reimbursement ⇒ Object
Returns the value of attribute expense_reimbursement.
31 32 33 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 31 def expense_reimbursement @expense_reimbursement end |
#fax_number ⇒ Object
Returns the value of attribute fax_number.
27 28 29 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 27 def fax_number @fax_number end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 7 def id @id end |
#mobile_guid ⇒ Object
Returns the value of attribute mobile_guid.
41 42 43 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 41 def mobile_guid @mobile_guid end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 9 def name @name end |
#phone_number ⇒ Object
Returns the value of attribute phone_number.
25 26 27 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 25 def phone_number @phone_number end |
#primary_address_flag ⇒ Object
Returns the value of attribute primary_address_flag.
33 34 35 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 33 def primary_address_flag @primary_address_flag end |
#state ⇒ Object
Returns the value of attribute state.
17 18 19 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 17 def state @state end |
#tax_code_id ⇒ Object
Returns the value of attribute tax_code_id.
29 30 31 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 29 def tax_code_id @tax_code_id end |
#time_zone ⇒ Object
Returns the value of attribute time_zone.
45 46 47 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 45 def time_zone @time_zone end |
#zip ⇒ Object
Returns the value of attribute zip.
19 20 21 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 19 def zip @zip end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 54 def self.attribute_map { :'id' => :'id', :'name' => :'name', :'address_line1' => :'addressLine1', :'address_line2' => :'addressLine2', :'city' => :'city', :'state' => :'state', :'zip' => :'zip', :'country' => :'country', :'address_format' => :'addressFormat', :'phone_number' => :'phoneNumber', :'fax_number' => :'faxNumber', :'tax_code_id' => :'taxCodeId', :'expense_reimbursement' => :'expenseReimbursement', :'primary_address_flag' => :'primaryAddressFlag', :'default_shipping_flag' => :'defaultShippingFlag', :'default_billing_flag' => :'defaultBillingFlag', :'default_mailing_flag' => :'defaultMailingFlag', :'mobile_guid' => :'mobileGuid', :'calendar' => :'calendar', :'time_zone' => :'timeZone', :'company' => :'company', :'_info' => :'_info' } end |
.swagger_types ⇒ Object
Attribute type mapping.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 82 def self.swagger_types { :'id' => :'Integer', :'name' => :'String', :'address_line1' => :'String', :'address_line2' => :'String', :'city' => :'String', :'state' => :'String', :'zip' => :'String', :'country' => :'CountryReference', :'address_format' => :'String', :'phone_number' => :'String', :'fax_number' => :'String', :'tax_code_id' => :'Integer', :'expense_reimbursement' => :'Float', :'primary_address_flag' => :'BOOLEAN', :'default_shipping_flag' => :'BOOLEAN', :'default_billing_flag' => :'BOOLEAN', :'default_mailing_flag' => :'BOOLEAN', :'mobile_guid' => :'Guid', :'calendar' => :'CalendarReference', :'time_zone' => :'TimeZoneSetupReference', :'company' => :'CompanyReference', :'_info' => :'Metadata' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 358 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && name == o.name && address_line1 == o.address_line1 && address_line2 == o.address_line2 && city == o.city && state == o.state && zip == o.zip && country == o.country && address_format == o.address_format && phone_number == o.phone_number && fax_number == o.fax_number && tax_code_id == o.tax_code_id && expense_reimbursement == o.expense_reimbursement && primary_address_flag == o.primary_address_flag && default_shipping_flag == o.default_shipping_flag && default_billing_flag == o.default_billing_flag && default_mailing_flag == o.default_mailing_flag && mobile_guid == o.mobile_guid && calendar == o.calendar && time_zone == o.time_zone && company == o.company && _info == o._info end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 421 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 |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 487 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 |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 400 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 |
#eql?(o) ⇒ Boolean
387 388 389 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 387 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
393 394 395 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 393 def hash [id, name, address_line1, address_line2, city, state, zip, country, address_format, phone_number, fax_number, tax_code_id, expense_reimbursement, primary_address_flag, default_shipping_flag, default_billing_flag, default_mailing_flag, mobile_guid, calendar, time_zone, company, _info].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 209 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 > 50 invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 50.") end if !@address_line1.nil? && @address_line1.to_s.length > 50 invalid_properties.push("invalid value for 'address_line1', the character length must be smaller than or equal to 50.") end if !@address_line2.nil? && @address_line2.to_s.length > 50 invalid_properties.push("invalid value for 'address_line2', the character length must be smaller than or equal to 50.") end if !@city.nil? && @city.to_s.length > 50 invalid_properties.push("invalid value for 'city', the character length must be smaller than or equal to 50.") end if !@state.nil? && @state.to_s.length > 50 invalid_properties.push("invalid value for 'state', the character length must be smaller than or equal to 50.") end if !@zip.nil? && @zip.to_s.length > 12 invalid_properties.push("invalid value for 'zip', the character length must be smaller than or equal to 12.") end if !@phone_number.nil? && @phone_number.to_s.length > 30 invalid_properties.push("invalid value for 'phone_number', the character length must be smaller than or equal to 30.") end if !@fax_number.nil? && @fax_number.to_s.length > 30 invalid_properties.push("invalid value for 'fax_number', the character length must be smaller than or equal to 30.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
467 468 469 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 467 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
473 474 475 476 477 478 479 480 481 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 473 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 |
#to_s ⇒ String
Returns the string representation of the object
461 462 463 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 461 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/connectwise-ruby-sdk/models/company_site.rb', line 252 def valid? return false if @name.nil? return false if @name.to_s.length > 50 return false if !@address_line1.nil? && @address_line1.to_s.length > 50 return false if !@address_line2.nil? && @address_line2.to_s.length > 50 return false if !@city.nil? && @city.to_s.length > 50 return false if !@state.nil? && @state.to_s.length > 50 return false if !@zip.nil? && @zip.to_s.length > 12 return false if !@phone_number.nil? && @phone_number.to_s.length > 30 return false if !@fax_number.nil? && @fax_number.to_s.length > 30 return true end |