Class: ConstantContactClient::Customer
- Inherits:
-
Object
- Object
- ConstantContactClient::Customer
- Defined in:
- lib/constant_contact_client/models/customer.rb
Instance Attribute Summary collapse
-
#company_logo ⇒ Object
Returns the value of attribute company_logo.
-
#contact_email ⇒ Object
Email addresses that are associated with the Constant Contact account owner.
-
#contact_phone ⇒ Object
The account owner’s contact phone number (up to 25 characters in length).
-
#country_code ⇒ Object
The uppercase two-letter <a href=‘en.wikipedia.org/wiki/ISO_3166-1’ target=‘_blank’>ISO 3166-1 code</a> representing the organization’s country.
-
#encoded_account_id ⇒ Object
The readOnly encoded account ID that uniquely identifies the account.
-
#first_name ⇒ Object
The account owner’s first name.
-
#last_name ⇒ Object
The account owner’s last name.
-
#organization_name ⇒ Object
The name of the organization that is associated with this account.
-
#organization_phone ⇒ Object
The phone number of the organization that is associated with this account.
-
#physical_address ⇒ Object
Returns the value of attribute physical_address.
-
#state_code ⇒ Object
The uppercase two letter <a href=‘en.wikipedia.org/wiki/ISO_3166-1’ target=‘_blank’>ISO 3166-1 code</a> for the organization’s state.
-
#time_zone_id ⇒ Object
The time zone that is automatically set based on the
state_code
setting; as defined in the IANA time-zone database (see www.iana.org/time-zones). -
#website ⇒ Object
The organization’s website URL.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Customer
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 = {}) ⇒ Customer
Initializes the object
106 107 108 109 110 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 |
# File 'lib/constant_contact_client/models/customer.rb', line 106 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `ConstantContactClient::Customer` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `ConstantContactClient::Customer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'contact_email') self.contact_email = attributes[:'contact_email'] end if attributes.key?(:'contact_phone') self.contact_phone = attributes[:'contact_phone'] end if attributes.key?(:'country_code') self.country_code = attributes[:'country_code'] end if attributes.key?(:'encoded_account_id') self.encoded_account_id = attributes[:'encoded_account_id'] end if attributes.key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.key?(:'organization_name') self.organization_name = attributes[:'organization_name'] end if attributes.key?(:'organization_phone') self.organization_phone = attributes[:'organization_phone'] end if attributes.key?(:'state_code') self.state_code = attributes[:'state_code'] end if attributes.key?(:'time_zone_id') self.time_zone_id = attributes[:'time_zone_id'] end if attributes.key?(:'website') self.website = attributes[:'website'] end if attributes.key?(:'physical_address') self.physical_address = attributes[:'physical_address'] end if attributes.key?(:'company_logo') self.company_logo = attributes[:'company_logo'] end end |
Instance Attribute Details
#company_logo ⇒ Object
Returns the value of attribute company_logo.
53 54 55 |
# File 'lib/constant_contact_client/models/customer.rb', line 53 def company_logo @company_logo end |
#contact_email ⇒ Object
Email addresses that are associated with the Constant Contact account owner.
19 20 21 |
# File 'lib/constant_contact_client/models/customer.rb', line 19 def contact_email @contact_email end |
#contact_phone ⇒ Object
The account owner’s contact phone number (up to 25 characters in length).
22 23 24 |
# File 'lib/constant_contact_client/models/customer.rb', line 22 def contact_phone @contact_phone end |
#country_code ⇒ Object
The uppercase two-letter <a href=‘en.wikipedia.org/wiki/ISO_3166-1’ target=‘_blank’>ISO 3166-1 code</a> representing the organization’s country.
25 26 27 |
# File 'lib/constant_contact_client/models/customer.rb', line 25 def country_code @country_code end |
#encoded_account_id ⇒ Object
The readOnly encoded account ID that uniquely identifies the account.
28 29 30 |
# File 'lib/constant_contact_client/models/customer.rb', line 28 def encoded_account_id @encoded_account_id end |
#first_name ⇒ Object
The account owner’s first name.
31 32 33 |
# File 'lib/constant_contact_client/models/customer.rb', line 31 def first_name @first_name end |
#last_name ⇒ Object
The account owner’s last name.
34 35 36 |
# File 'lib/constant_contact_client/models/customer.rb', line 34 def last_name @last_name end |
#organization_name ⇒ Object
The name of the organization that is associated with this account.
37 38 39 |
# File 'lib/constant_contact_client/models/customer.rb', line 37 def organization_name @organization_name end |
#organization_phone ⇒ Object
The phone number of the organization that is associated with this account.
40 41 42 |
# File 'lib/constant_contact_client/models/customer.rb', line 40 def organization_phone @organization_phone end |
#physical_address ⇒ Object
Returns the value of attribute physical_address.
51 52 53 |
# File 'lib/constant_contact_client/models/customer.rb', line 51 def physical_address @physical_address end |
#state_code ⇒ Object
The uppercase two letter <a href=‘en.wikipedia.org/wiki/ISO_3166-1’ target=‘_blank’>ISO 3166-1 code</a> for the organization’s state. This property is required if the country_code
is US (United States).
43 44 45 |
# File 'lib/constant_contact_client/models/customer.rb', line 43 def state_code @state_code end |
#time_zone_id ⇒ Object
The time zone that is automatically set based on the state_code
setting; as defined in the IANA time-zone database (see www.iana.org/time-zones).
46 47 48 |
# File 'lib/constant_contact_client/models/customer.rb', line 46 def time_zone_id @time_zone_id end |
#website ⇒ Object
The organization’s website URL.
49 50 51 |
# File 'lib/constant_contact_client/models/customer.rb', line 49 def website @website end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/constant_contact_client/models/customer.rb', line 265 def self._deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = ConstantContactClient.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
75 76 77 |
# File 'lib/constant_contact_client/models/customer.rb', line 75 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/constant_contact_client/models/customer.rb', line 56 def self.attribute_map { :'contact_email' => :'contact_email', :'contact_phone' => :'contact_phone', :'country_code' => :'country_code', :'encoded_account_id' => :'encoded_account_id', :'first_name' => :'first_name', :'last_name' => :'last_name', :'organization_name' => :'organization_name', :'organization_phone' => :'organization_phone', :'state_code' => :'state_code', :'time_zone_id' => :'time_zone_id', :'website' => :'website', :'physical_address' => :'physical_address', :'company_logo' => :'company_logo' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/constant_contact_client/models/customer.rb', line 241 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
99 100 101 102 |
# File 'lib/constant_contact_client/models/customer.rb', line 99 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/constant_contact_client/models/customer.rb', line 80 def self.openapi_types { :'contact_email' => :'String', :'contact_phone' => :'String', :'country_code' => :'String', :'encoded_account_id' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'organization_name' => :'String', :'organization_phone' => :'String', :'state_code' => :'String', :'time_zone_id' => :'String', :'website' => :'String', :'physical_address' => :'GetAccountDetails200ResponsePhysicalAddress', :'company_logo' => :'GetAccountDetails200ResponseCompanyLogo' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/constant_contact_client/models/customer.rb', line 208 def ==(o) return true if self.equal?(o) self.class == o.class && contact_email == o.contact_email && contact_phone == o.contact_phone && country_code == o.country_code && encoded_account_id == o.encoded_account_id && first_name == o.first_name && last_name == o.last_name && organization_name == o.organization_name && organization_phone == o.organization_phone && state_code == o.state_code && time_zone_id == o.time_zone_id && website == o.website && physical_address == o.physical_address && company_logo == o.company_logo end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/constant_contact_client/models/customer.rb', line 336 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 |
#eql?(o) ⇒ Boolean
228 229 230 |
# File 'lib/constant_contact_client/models/customer.rb', line 228 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
234 235 236 |
# File 'lib/constant_contact_client/models/customer.rb', line 234 def hash [contact_email, contact_phone, country_code, encoded_account_id, first_name, last_name, organization_name, organization_phone, state_code, time_zone_id, website, physical_address, company_logo].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
174 175 176 177 178 179 180 181 182 |
# File 'lib/constant_contact_client/models/customer.rb', line 174 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@contact_phone.nil? && @contact_phone.to_s.length > 25 invalid_properties.push('invalid value for "contact_phone", the character length must be smaller than or equal to 25.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
312 313 314 |
# File 'lib/constant_contact_client/models/customer.rb', line 312 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/constant_contact_client/models/customer.rb', line 318 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
306 307 308 |
# File 'lib/constant_contact_client/models/customer.rb', line 306 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
186 187 188 189 190 |
# File 'lib/constant_contact_client/models/customer.rb', line 186 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@contact_phone.nil? && @contact_phone.to_s.length > 25 true end |