Class: UltracartClient::CartCustomerProfile
- Inherits:
-
Object
- Object
- UltracartClient::CartCustomerProfile
- Defined in:
- lib/ultracart_api/models/cart_customer_profile.rb
Instance Attribute Summary collapse
-
#allow_3rd_party_billing ⇒ Object
True if profile is allowed to bill to their 3rd party shipping account.
-
#allow_cod ⇒ Object
True if this profile is allowed to use a COD.
-
#allow_purchase_order ⇒ Object
True if this profile is allowed to use a purchase order.
-
#billing_addresses ⇒ Object
Billing addresses on file for this profile.
-
#credit_cards ⇒ Object
Credit cards on file for this profile (masked).
-
#customer_profile_oid ⇒ Object
Unique identifier.
-
#dhl_account_number ⇒ Object
DHL account number on file.
-
#dhl_duty_account_number ⇒ Object
DHL duty account number on file.
-
#email ⇒ Object
Email.
-
#fedex_account_number ⇒ Object
FedEx account number on file.
-
#free_shipping ⇒ Object
True if this profile always qualifies for free shipping.
-
#free_shipping_minimum ⇒ Object
The minimum amount that this profile has to purchase to qualify for free shipping.
-
#maximum_item_count ⇒ Object
Maximum item count this profile can purchase.
-
#minimum_item_count ⇒ Object
Minimum item count this profile must purchase.
-
#minimum_subtotal ⇒ Object
Minimum subtotal this profile must purchase.
-
#no_coupons ⇒ Object
True if this profile is prevented from using coupons.
-
#no_free_shipping ⇒ Object
True if this profile is never given free shipping.
-
#no_realtime_charge ⇒ Object
True if this customers orders are not charged in real-time.
-
#pricing_tiers ⇒ Object
Pricing tier names this profile qualifies for.
-
#shipping_addresses ⇒ Object
Shipping addresses on file for this profile.
-
#signup_dts ⇒ Object
Signup date.
-
#tax_exempt ⇒ Object
True if this profile is exempt from sales tax.
-
#ups_account_number ⇒ Object
UPS account number on file.
Class Method Summary collapse
-
.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.
-
#_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 ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CartCustomerProfile
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 = {}) ⇒ CartCustomerProfile
Initializes the object
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 206 207 208 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 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 158 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::CartCustomerProfile` 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 `UltracartClient::CartCustomerProfile`. 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?(:'allow_3rd_party_billing') self.allow_3rd_party_billing = attributes[:'allow_3rd_party_billing'] end if attributes.key?(:'allow_cod') self.allow_cod = attributes[:'allow_cod'] end if attributes.key?(:'allow_purchase_order') self.allow_purchase_order = attributes[:'allow_purchase_order'] end if attributes.key?(:'billing_addresses') if (value = attributes[:'billing_addresses']).is_a?(Array) self.billing_addresses = value end end if attributes.key?(:'credit_cards') if (value = attributes[:'credit_cards']).is_a?(Array) self.credit_cards = value end end if attributes.key?(:'customer_profile_oid') self.customer_profile_oid = attributes[:'customer_profile_oid'] end if attributes.key?(:'dhl_account_number') self.dhl_account_number = attributes[:'dhl_account_number'] end if attributes.key?(:'dhl_duty_account_number') self.dhl_duty_account_number = attributes[:'dhl_duty_account_number'] end if attributes.key?(:'email') self.email = attributes[:'email'] end if attributes.key?(:'fedex_account_number') self.fedex_account_number = attributes[:'fedex_account_number'] end if attributes.key?(:'free_shipping') self.free_shipping = attributes[:'free_shipping'] end if attributes.key?(:'free_shipping_minimum') self.free_shipping_minimum = attributes[:'free_shipping_minimum'] end if attributes.key?(:'maximum_item_count') self.maximum_item_count = attributes[:'maximum_item_count'] end if attributes.key?(:'minimum_item_count') self.minimum_item_count = attributes[:'minimum_item_count'] end if attributes.key?(:'minimum_subtotal') self.minimum_subtotal = attributes[:'minimum_subtotal'] end if attributes.key?(:'no_coupons') self.no_coupons = attributes[:'no_coupons'] end if attributes.key?(:'no_free_shipping') self.no_free_shipping = attributes[:'no_free_shipping'] end if attributes.key?(:'no_realtime_charge') self.no_realtime_charge = attributes[:'no_realtime_charge'] end if attributes.key?(:'pricing_tiers') if (value = attributes[:'pricing_tiers']).is_a?(Array) self.pricing_tiers = value end end if attributes.key?(:'shipping_addresses') if (value = attributes[:'shipping_addresses']).is_a?(Array) self.shipping_addresses = value end end if attributes.key?(:'signup_dts') self.signup_dts = attributes[:'signup_dts'] end if attributes.key?(:'tax_exempt') self.tax_exempt = attributes[:'tax_exempt'] end if attributes.key?(:'ups_account_number') self.ups_account_number = attributes[:'ups_account_number'] end end |
Instance Attribute Details
#allow_3rd_party_billing ⇒ Object
True if profile is allowed to bill to their 3rd party shipping account
19 20 21 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 19 def allow_3rd_party_billing @allow_3rd_party_billing end |
#allow_cod ⇒ Object
True if this profile is allowed to use a COD
22 23 24 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 22 def allow_cod @allow_cod end |
#allow_purchase_order ⇒ Object
True if this profile is allowed to use a purchase order
25 26 27 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 25 def allow_purchase_order @allow_purchase_order end |
#billing_addresses ⇒ Object
Billing addresses on file for this profile
28 29 30 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 28 def billing_addresses @billing_addresses end |
#credit_cards ⇒ Object
Credit cards on file for this profile (masked)
31 32 33 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 31 def credit_cards @credit_cards end |
#customer_profile_oid ⇒ Object
Unique identifier
34 35 36 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 34 def customer_profile_oid @customer_profile_oid end |
#dhl_account_number ⇒ Object
DHL account number on file
37 38 39 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 37 def dhl_account_number @dhl_account_number end |
#dhl_duty_account_number ⇒ Object
DHL duty account number on file
40 41 42 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 40 def dhl_duty_account_number @dhl_duty_account_number end |
#email ⇒ Object
43 44 45 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 43 def email @email end |
#fedex_account_number ⇒ Object
FedEx account number on file
46 47 48 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 46 def fedex_account_number @fedex_account_number end |
#free_shipping ⇒ Object
True if this profile always qualifies for free shipping
49 50 51 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 49 def free_shipping @free_shipping end |
#free_shipping_minimum ⇒ Object
The minimum amount that this profile has to purchase to qualify for free shipping
52 53 54 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 52 def free_shipping_minimum @free_shipping_minimum end |
#maximum_item_count ⇒ Object
Maximum item count this profile can purchase
55 56 57 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 55 def maximum_item_count @maximum_item_count end |
#minimum_item_count ⇒ Object
Minimum item count this profile must purchase
58 59 60 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 58 def minimum_item_count @minimum_item_count end |
#minimum_subtotal ⇒ Object
Minimum subtotal this profile must purchase
61 62 63 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 61 def minimum_subtotal @minimum_subtotal end |
#no_coupons ⇒ Object
True if this profile is prevented from using coupons
64 65 66 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 64 def no_coupons @no_coupons end |
#no_free_shipping ⇒ Object
True if this profile is never given free shipping
67 68 69 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 67 def no_free_shipping @no_free_shipping end |
#no_realtime_charge ⇒ Object
True if this customers orders are not charged in real-time
70 71 72 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 70 def no_realtime_charge @no_realtime_charge end |
#pricing_tiers ⇒ Object
Pricing tier names this profile qualifies for
73 74 75 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 73 def pricing_tiers @pricing_tiers end |
#shipping_addresses ⇒ Object
Shipping addresses on file for this profile
76 77 78 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 76 def shipping_addresses @shipping_addresses end |
#signup_dts ⇒ Object
Signup date
79 80 81 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 79 def signup_dts @signup_dts end |
#tax_exempt ⇒ Object
True if this profile is exempt from sales tax
82 83 84 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 82 def tax_exempt @tax_exempt end |
#ups_account_number ⇒ Object
UPS account number on file
85 86 87 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 85 def ups_account_number @ups_account_number end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
117 118 119 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 117 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 88 def self.attribute_map { :'allow_3rd_party_billing' => :'allow_3rd_party_billing', :'allow_cod' => :'allow_cod', :'allow_purchase_order' => :'allow_purchase_order', :'billing_addresses' => :'billing_addresses', :'credit_cards' => :'credit_cards', :'customer_profile_oid' => :'customer_profile_oid', :'dhl_account_number' => :'dhl_account_number', :'dhl_duty_account_number' => :'dhl_duty_account_number', :'email' => :'email', :'fedex_account_number' => :'fedex_account_number', :'free_shipping' => :'free_shipping', :'free_shipping_minimum' => :'free_shipping_minimum', :'maximum_item_count' => :'maximum_item_count', :'minimum_item_count' => :'minimum_item_count', :'minimum_subtotal' => :'minimum_subtotal', :'no_coupons' => :'no_coupons', :'no_free_shipping' => :'no_free_shipping', :'no_realtime_charge' => :'no_realtime_charge', :'pricing_tiers' => :'pricing_tiers', :'shipping_addresses' => :'shipping_addresses', :'signup_dts' => :'signup_dts', :'tax_exempt' => :'tax_exempt', :'ups_account_number' => :'ups_account_number' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
330 331 332 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 330 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
151 152 153 154 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 151 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 122 def self.openapi_types { :'allow_3rd_party_billing' => :'Boolean', :'allow_cod' => :'Boolean', :'allow_purchase_order' => :'Boolean', :'billing_addresses' => :'Array<CartCustomerProfileAddress>', :'credit_cards' => :'Array<CartCustomerProfileCreditCard>', :'customer_profile_oid' => :'Integer', :'dhl_account_number' => :'String', :'dhl_duty_account_number' => :'String', :'email' => :'String', :'fedex_account_number' => :'String', :'free_shipping' => :'Boolean', :'free_shipping_minimum' => :'Float', :'maximum_item_count' => :'Integer', :'minimum_item_count' => :'Integer', :'minimum_subtotal' => :'Float', :'no_coupons' => :'Boolean', :'no_free_shipping' => :'Boolean', :'no_realtime_charge' => :'Boolean', :'pricing_tiers' => :'Array<String>', :'shipping_addresses' => :'Array<CartCustomerProfileAddress>', :'signup_dts' => :'String', :'tax_exempt' => :'Boolean', :'ups_account_number' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 287 def ==(o) return true if self.equal?(o) self.class == o.class && allow_3rd_party_billing == o.allow_3rd_party_billing && allow_cod == o.allow_cod && allow_purchase_order == o.allow_purchase_order && billing_addresses == o.billing_addresses && credit_cards == o.credit_cards && customer_profile_oid == o.customer_profile_oid && dhl_account_number == o.dhl_account_number && dhl_duty_account_number == o.dhl_duty_account_number && email == o.email && fedex_account_number == o.fedex_account_number && free_shipping == o.free_shipping && free_shipping_minimum == o.free_shipping_minimum && maximum_item_count == o.maximum_item_count && minimum_item_count == o.minimum_item_count && minimum_subtotal == o.minimum_subtotal && no_coupons == o.no_coupons && no_free_shipping == o.no_free_shipping && no_realtime_charge == o.no_realtime_charge && pricing_tiers == o.pricing_tiers && shipping_addresses == o.shipping_addresses && signup_dts == o.signup_dts && tax_exempt == o.tax_exempt && ups_account_number == o.ups_account_number end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 361 def _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 = UltracartClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 432 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
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 337 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{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[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 end self end |
#eql?(o) ⇒ Boolean
317 318 319 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 317 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
323 324 325 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 323 def hash [allow_3rd_party_billing, allow_cod, allow_purchase_order, billing_addresses, credit_cards, customer_profile_oid, dhl_account_number, dhl_duty_account_number, email, fedex_account_number, free_shipping, free_shipping_minimum, maximum_item_count, minimum_item_count, minimum_subtotal, no_coupons, no_free_shipping, no_realtime_charge, pricing_tiers, shipping_addresses, signup_dts, tax_exempt, ups_account_number].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
274 275 276 277 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 274 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
408 409 410 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 408 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 414 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
402 403 404 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 402 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
281 282 283 |
# File 'lib/ultracart_api/models/cart_customer_profile.rb', line 281 def valid? true end |