Class: UltracartClient::PricingTier

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/pricing_tier.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PricingTier

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/ultracart_api/models/pricing_tier.rb', line 184

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?(:'allow_3rd_party_billing')
    self.allow_3rd_party_billing = attributes[:'allow_3rd_party_billing']
  end

  if attributes.has_key?(:'allow_cod')
    self.allow_cod = attributes[:'allow_cod']
  end

  if attributes.has_key?(:'allow_purchase_order')
    self.allow_purchase_order = attributes[:'allow_purchase_order']
  end

  if attributes.has_key?(:'allow_quote_request')
    self.allow_quote_request = attributes[:'allow_quote_request']
  end

  if attributes.has_key?(:'approval_notification')
    self.approval_notification = attributes[:'approval_notification']
  end

  if attributes.has_key?(:'auto_approve_cod')
    self.auto_approve_cod = attributes[:'auto_approve_cod']
  end

  if attributes.has_key?(:'auto_approve_purchase_order')
    self.auto_approve_purchase_order = attributes[:'auto_approve_purchase_order']
  end

  if attributes.has_key?(:'default_on_wholesale_signup')
    self. = attributes[:'default_on_wholesale_signup']
  end

  if attributes.has_key?(:'default_percentage_discount')
    self.default_percentage_discount = attributes[:'default_percentage_discount']
  end

  if attributes.has_key?(:'default_shipping_method_oid')
    self.default_shipping_method_oid = attributes[:'default_shipping_method_oid']
  end

  if attributes.has_key?(:'default_tier')
    self.default_tier = attributes[:'default_tier']
  end

  if attributes.has_key?(:'display_on_wholesale_signup')
    self. = attributes[:'display_on_wholesale_signup']
  end

  if attributes.has_key?(:'exclude_from_free_promotion')
    self.exclude_from_free_promotion = attributes[:'exclude_from_free_promotion']
  end

  if attributes.has_key?(:'exempt_shipping_handling_charge')
    self.exempt_shipping_handling_charge = attributes[:'exempt_shipping_handling_charge']
  end

  if attributes.has_key?(:'free_shipping')
    self.free_shipping = attributes[:'free_shipping']
  end

  if attributes.has_key?(:'free_shipping_minimum')
    self.free_shipping_minimum = attributes[:'free_shipping_minimum']
  end

  if attributes.has_key?(:'maximum_item_count')
    self.maximum_item_count = attributes[:'maximum_item_count']
  end

  if attributes.has_key?(:'minimum_item_count')
    self.minimum_item_count = attributes[:'minimum_item_count']
  end

  if attributes.has_key?(:'minimum_subtotal')
    self.minimum_subtotal = attributes[:'minimum_subtotal']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'no_coupons')
    self.no_coupons = attributes[:'no_coupons']
  end

  if attributes.has_key?(:'no_free_shipping')
    self.no_free_shipping = attributes[:'no_free_shipping']
  end

  if attributes.has_key?(:'no_realtime_charge')
    self.no_realtime_charge = attributes[:'no_realtime_charge']
  end

  if attributes.has_key?(:'not_valid_when_coupon_present')
    self.not_valid_when_coupon_present = attributes[:'not_valid_when_coupon_present']
  end

  if attributes.has_key?(:'pricing_tier_oid')
    self.pricing_tier_oid = attributes[:'pricing_tier_oid']
  end

  if attributes.has_key?(:'realtime_percentage_discount')
    self.realtime_percentage_discount = attributes[:'realtime_percentage_discount']
  end

  if attributes.has_key?(:'signup_notification')
    self. = attributes[:'signup_notification']
  end

  if attributes.has_key?(:'suppress_buysafe')
    self.suppress_buysafe = attributes[:'suppress_buysafe']
  end

  if attributes.has_key?(:'suppress_mailing_list')
    self.suppress_mailing_list = attributes[:'suppress_mailing_list']
  end

  if attributes.has_key?(:'tax_exempt')
    self.tax_exempt = attributes[:'tax_exempt']
  end

  if attributes.has_key?(:'track_separately')
    self.track_separately = attributes[:'track_separately']
  end
end

Instance Attribute Details

#allow_3rd_party_billingObject

Allow 3rd party billing



18
19
20
# File 'lib/ultracart_api/models/pricing_tier.rb', line 18

def allow_3rd_party_billing
  @allow_3rd_party_billing
end

#allow_codObject

Allow COD



21
22
23
# File 'lib/ultracart_api/models/pricing_tier.rb', line 21

def allow_cod
  @allow_cod
end

#allow_purchase_orderObject

Allow purchase order



24
25
26
# File 'lib/ultracart_api/models/pricing_tier.rb', line 24

def allow_purchase_order
  @allow_purchase_order
end

#allow_quote_requestObject

Allow quote request



27
28
29
# File 'lib/ultracart_api/models/pricing_tier.rb', line 27

def allow_quote_request
  @allow_quote_request
end

#approval_notificationObject

Returns the value of attribute approval_notification.



29
30
31
# File 'lib/ultracart_api/models/pricing_tier.rb', line 29

def approval_notification
  @approval_notification
end

#auto_approve_codObject

Auto approve COD



32
33
34
# File 'lib/ultracart_api/models/pricing_tier.rb', line 32

def auto_approve_cod
  @auto_approve_cod
end

#auto_approve_purchase_orderObject

Auto approve purchase order



35
36
37
# File 'lib/ultracart_api/models/pricing_tier.rb', line 35

def auto_approve_purchase_order
  @auto_approve_purchase_order
end

#default_on_wholesale_signupObject

Default on wholesale signup



38
39
40
# File 'lib/ultracart_api/models/pricing_tier.rb', line 38

def 
  @default_on_wholesale_signup
end

#default_percentage_discountObject

Default percentage discount



41
42
43
# File 'lib/ultracart_api/models/pricing_tier.rb', line 41

def default_percentage_discount
  @default_percentage_discount
end

#default_shipping_method_oidObject

Default shipping method oid



44
45
46
# File 'lib/ultracart_api/models/pricing_tier.rb', line 44

def default_shipping_method_oid
  @default_shipping_method_oid
end

#default_tierObject

Default tier



47
48
49
# File 'lib/ultracart_api/models/pricing_tier.rb', line 47

def default_tier
  @default_tier
end

#display_on_wholesale_signupObject

Display on wholesale signup



50
51
52
# File 'lib/ultracart_api/models/pricing_tier.rb', line 50

def 
  @display_on_wholesale_signup
end

#exclude_from_free_promotionObject

Exclude from free promotion



53
54
55
# File 'lib/ultracart_api/models/pricing_tier.rb', line 53

def exclude_from_free_promotion
  @exclude_from_free_promotion
end

#exempt_shipping_handling_chargeObject

Exempt shipping handling charge



56
57
58
# File 'lib/ultracart_api/models/pricing_tier.rb', line 56

def exempt_shipping_handling_charge
  @exempt_shipping_handling_charge
end

#free_shippingObject

Free shipping



59
60
61
# File 'lib/ultracart_api/models/pricing_tier.rb', line 59

def free_shipping
  @free_shipping
end

#free_shipping_minimumObject

Free shipping minimum



62
63
64
# File 'lib/ultracart_api/models/pricing_tier.rb', line 62

def free_shipping_minimum
  @free_shipping_minimum
end

#maximum_item_countObject

Maximum item count



65
66
67
# File 'lib/ultracart_api/models/pricing_tier.rb', line 65

def maximum_item_count
  @maximum_item_count
end

#minimum_item_countObject

Minimum item count



68
69
70
# File 'lib/ultracart_api/models/pricing_tier.rb', line 68

def minimum_item_count
  @minimum_item_count
end

#minimum_subtotalObject

Minimum subtotal



71
72
73
# File 'lib/ultracart_api/models/pricing_tier.rb', line 71

def minimum_subtotal
  @minimum_subtotal
end

#nameObject

Name



74
75
76
# File 'lib/ultracart_api/models/pricing_tier.rb', line 74

def name
  @name
end

#no_couponsObject

No coupons



77
78
79
# File 'lib/ultracart_api/models/pricing_tier.rb', line 77

def no_coupons
  @no_coupons
end

#no_free_shippingObject

No free shipping



80
81
82
# File 'lib/ultracart_api/models/pricing_tier.rb', line 80

def no_free_shipping
  @no_free_shipping
end

#no_realtime_chargeObject

No realtime charge



83
84
85
# File 'lib/ultracart_api/models/pricing_tier.rb', line 83

def no_realtime_charge
  @no_realtime_charge
end

#not_valid_when_coupon_presentObject

Not valid when coupon present



86
87
88
# File 'lib/ultracart_api/models/pricing_tier.rb', line 86

def not_valid_when_coupon_present
  @not_valid_when_coupon_present
end

#pricing_tier_oidObject

Pricing Tier Oid



89
90
91
# File 'lib/ultracart_api/models/pricing_tier.rb', line 89

def pricing_tier_oid
  @pricing_tier_oid
end

#realtime_percentage_discountObject

Realtime percentage discount



92
93
94
# File 'lib/ultracart_api/models/pricing_tier.rb', line 92

def realtime_percentage_discount
  @realtime_percentage_discount
end

#signup_notificationObject

Returns the value of attribute signup_notification.



94
95
96
# File 'lib/ultracart_api/models/pricing_tier.rb', line 94

def 
  @signup_notification
end

#suppress_buysafeObject

Suppress buySAFE (deprecated)



97
98
99
# File 'lib/ultracart_api/models/pricing_tier.rb', line 97

def suppress_buysafe
  @suppress_buysafe
end

#suppress_mailing_listObject

Suppress mailing list



100
101
102
# File 'lib/ultracart_api/models/pricing_tier.rb', line 100

def suppress_mailing_list
  @suppress_mailing_list
end

#tax_exemptObject

Tax Exempt



103
104
105
# File 'lib/ultracart_api/models/pricing_tier.rb', line 103

def tax_exempt
  @tax_exempt
end

#track_separatelyObject

Track separately



106
107
108
# File 'lib/ultracart_api/models/pricing_tier.rb', line 106

def track_separately
  @track_separately
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/ultracart_api/models/pricing_tier.rb', line 109

def self.attribute_map
  {
    :'allow_3rd_party_billing' => :'allow_3rd_party_billing',
    :'allow_cod' => :'allow_cod',
    :'allow_purchase_order' => :'allow_purchase_order',
    :'allow_quote_request' => :'allow_quote_request',
    :'approval_notification' => :'approval_notification',
    :'auto_approve_cod' => :'auto_approve_cod',
    :'auto_approve_purchase_order' => :'auto_approve_purchase_order',
    :'default_on_wholesale_signup' => :'default_on_wholesale_signup',
    :'default_percentage_discount' => :'default_percentage_discount',
    :'default_shipping_method_oid' => :'default_shipping_method_oid',
    :'default_tier' => :'default_tier',
    :'display_on_wholesale_signup' => :'display_on_wholesale_signup',
    :'exclude_from_free_promotion' => :'exclude_from_free_promotion',
    :'exempt_shipping_handling_charge' => :'exempt_shipping_handling_charge',
    :'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',
    :'name' => :'name',
    :'no_coupons' => :'no_coupons',
    :'no_free_shipping' => :'no_free_shipping',
    :'no_realtime_charge' => :'no_realtime_charge',
    :'not_valid_when_coupon_present' => :'not_valid_when_coupon_present',
    :'pricing_tier_oid' => :'pricing_tier_oid',
    :'realtime_percentage_discount' => :'realtime_percentage_discount',
    :'signup_notification' => :'signup_notification',
    :'suppress_buysafe' => :'suppress_buysafe',
    :'suppress_mailing_list' => :'suppress_mailing_list',
    :'tax_exempt' => :'tax_exempt',
    :'track_separately' => :'track_separately'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/ultracart_api/models/pricing_tier.rb', line 146

def self.swagger_types
  {
    :'allow_3rd_party_billing' => :'BOOLEAN',
    :'allow_cod' => :'BOOLEAN',
    :'allow_purchase_order' => :'BOOLEAN',
    :'allow_quote_request' => :'BOOLEAN',
    :'approval_notification' => :'PricingTierNotification',
    :'auto_approve_cod' => :'BOOLEAN',
    :'auto_approve_purchase_order' => :'BOOLEAN',
    :'default_on_wholesale_signup' => :'BOOLEAN',
    :'default_percentage_discount' => :'Float',
    :'default_shipping_method_oid' => :'Integer',
    :'default_tier' => :'BOOLEAN',
    :'display_on_wholesale_signup' => :'BOOLEAN',
    :'exclude_from_free_promotion' => :'BOOLEAN',
    :'exempt_shipping_handling_charge' => :'BOOLEAN',
    :'free_shipping' => :'BOOLEAN',
    :'free_shipping_minimum' => :'Float',
    :'maximum_item_count' => :'Integer',
    :'minimum_item_count' => :'Integer',
    :'minimum_subtotal' => :'Float',
    :'name' => :'String',
    :'no_coupons' => :'BOOLEAN',
    :'no_free_shipping' => :'BOOLEAN',
    :'no_realtime_charge' => :'BOOLEAN',
    :'not_valid_when_coupon_present' => :'BOOLEAN',
    :'pricing_tier_oid' => :'Integer',
    :'realtime_percentage_discount' => :'Float',
    :'signup_notification' => :'PricingTierNotification',
    :'suppress_buysafe' => :'BOOLEAN',
    :'suppress_mailing_list' => :'BOOLEAN',
    :'tax_exempt' => :'BOOLEAN',
    :'track_separately' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/ultracart_api/models/pricing_tier.rb', line 345

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 &&
      allow_quote_request == o.allow_quote_request &&
      approval_notification == o.approval_notification &&
      auto_approve_cod == o.auto_approve_cod &&
      auto_approve_purchase_order == o.auto_approve_purchase_order &&
       == o. &&
      default_percentage_discount == o.default_percentage_discount &&
      default_shipping_method_oid == o.default_shipping_method_oid &&
      default_tier == o.default_tier &&
       == o. &&
      exclude_from_free_promotion == o.exclude_from_free_promotion &&
      exempt_shipping_handling_charge == o.exempt_shipping_handling_charge &&
      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 &&
      name == o.name &&
      no_coupons == o.no_coupons &&
      no_free_shipping == o.no_free_shipping &&
      no_realtime_charge == o.no_realtime_charge &&
      not_valid_when_coupon_present == o.not_valid_when_coupon_present &&
      pricing_tier_oid == o.pricing_tier_oid &&
      realtime_percentage_discount == o.realtime_percentage_discount &&
       == o. &&
      suppress_buysafe == o.suppress_buysafe &&
      suppress_mailing_list == o.suppress_mailing_list &&
      tax_exempt == o.tax_exempt &&
      track_separately == o.track_separately
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



417
418
419
420
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
# File 'lib/ultracart_api/models/pricing_tier.rb', line 417

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 = UltracartClient.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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/ultracart_api/models/pricing_tier.rb', line 483

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/ultracart_api/models/pricing_tier.rb', line 396

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 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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


383
384
385
# File 'lib/ultracart_api/models/pricing_tier.rb', line 383

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



389
390
391
# File 'lib/ultracart_api/models/pricing_tier.rb', line 389

def hash
  [allow_3rd_party_billing, allow_cod, allow_purchase_order, allow_quote_request, approval_notification, auto_approve_cod, auto_approve_purchase_order, , default_percentage_discount, default_shipping_method_oid, default_tier, , exclude_from_free_promotion, exempt_shipping_handling_charge, free_shipping, free_shipping_minimum, maximum_item_count, minimum_item_count, minimum_subtotal, name, no_coupons, no_free_shipping, no_realtime_charge, not_valid_when_coupon_present, pricing_tier_oid, realtime_percentage_discount, , suppress_buysafe, suppress_mailing_list, tax_exempt, track_separately].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



317
318
319
320
321
322
323
324
# File 'lib/ultracart_api/models/pricing_tier.rb', line 317

def list_invalid_properties
  invalid_properties = Array.new
  if !@name.nil? && @name.to_s.length > 50
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 50.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



463
464
465
# File 'lib/ultracart_api/models/pricing_tier.rb', line 463

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



469
470
471
472
473
474
475
476
477
# File 'lib/ultracart_api/models/pricing_tier.rb', line 469

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



457
458
459
# File 'lib/ultracart_api/models/pricing_tier.rb', line 457

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



328
329
330
331
# File 'lib/ultracart_api/models/pricing_tier.rb', line 328

def valid?
  return false if !@name.nil? && @name.to_s.length > 50
  true
end