Class: UltracartClient::AutoOrderItem

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AutoOrderItem

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
271
272
273
274
275
276
277
# File 'lib/ultracart_api/models/auto_order_item.rb', line 172

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'future_schedules')
    if (value = attributes[:'future_schedules']).is_a?(Array)
      self.future_schedules = value
    end
  end

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

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

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

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

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

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

  if attributes.has_key?(:'options')
    if (value = attributes[:'options']).is_a?(Array)
      self.options = value
    end
  end

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

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

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

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

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

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

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

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

Instance Attribute Details

#arbitrary_item_idObject

Arbitrary item id that should be rebilled instead of the normal schedule



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

def arbitrary_item_id
  @arbitrary_item_id
end

#arbitrary_percentage_discountObject

An arbitrary percentage discount to provide on future rebills



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

def arbitrary_percentage_discount
  @arbitrary_percentage_discount
end

#arbitrary_quantityObject

Arbitrary quantity to rebill



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

def arbitrary_quantity
  @arbitrary_quantity
end

#arbitrary_schedule_daysObject

The number of days to rebill if the frequency is set to an arbitrary number of days



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

def arbitrary_schedule_days
  @arbitrary_schedule_days
end

#arbitrary_unit_costObject

Arbitrary unit cost that rebills of this item should occur at



30
31
32
# File 'lib/ultracart_api/models/auto_order_item.rb', line 30

def arbitrary_unit_cost
  @arbitrary_unit_cost
end

#arbitrary_unit_cost_remaining_ordersObject

The number of rebills to give the arbitrary unit cost on before reverting to normal pricing.



33
34
35
# File 'lib/ultracart_api/models/auto_order_item.rb', line 33

def arbitrary_unit_cost_remaining_orders
  @arbitrary_unit_cost_remaining_orders
end

#auto_order_item_oidObject

Primary key of AutoOrderItem



36
37
38
# File 'lib/ultracart_api/models/auto_order_item.rb', line 36

def auto_order_item_oid
  @auto_order_item_oid
end

#frequencyObject

Frequency of the rebill if not a fixed schedule



39
40
41
# File 'lib/ultracart_api/models/auto_order_item.rb', line 39

def frequency
  @frequency
end

#future_schedulesObject

The future rebill schedule for this item up to the next ten rebills



42
43
44
# File 'lib/ultracart_api/models/auto_order_item.rb', line 42

def future_schedules
  @future_schedules
end

#last_order_dtsObject

Date/time of the last order of this item



45
46
47
# File 'lib/ultracart_api/models/auto_order_item.rb', line 45

def last_order_dts
  @last_order_dts
end

#life_time_valueObject

The life time value of this item including the original purchase



48
49
50
# File 'lib/ultracart_api/models/auto_order_item.rb', line 48

def life_time_value
  @life_time_value
end

#next_preshipment_notice_dtsObject

The date/time of when the next pre-shipment notice should be sent



51
52
53
# File 'lib/ultracart_api/models/auto_order_item.rb', line 51

def next_preshipment_notice_dts
  @next_preshipment_notice_dts
end

#next_shipment_dtsObject

Date/time that this item is scheduled to rebill



54
55
56
# File 'lib/ultracart_api/models/auto_order_item.rb', line 54

def next_shipment_dts
  @next_shipment_dts
end

#no_order_after_dtsObject

Date/time after which no additional rebills of this item should occur



57
58
59
# File 'lib/ultracart_api/models/auto_order_item.rb', line 57

def no_order_after_dts
  @no_order_after_dts
end

#number_of_rebillsObject

The number of times this item has rebilled



60
61
62
# File 'lib/ultracart_api/models/auto_order_item.rb', line 60

def number_of_rebills
  @number_of_rebills
end

#optionsObject

Options associated with this item



63
64
65
# File 'lib/ultracart_api/models/auto_order_item.rb', line 63

def options
  @options
end

#original_item_idObject

The original item id purchased. This item controls scheduling. If you wish to modify a schedule, for example, from monthly to yearly, change this item from your monthly item to your yearly item, and then change the next_shipment_dts to your desired date.



66
67
68
# File 'lib/ultracart_api/models/auto_order_item.rb', line 66

def original_item_id
  @original_item_id
end

#original_quantityObject

The original quantity purchased



69
70
71
# File 'lib/ultracart_api/models/auto_order_item.rb', line 69

def original_quantity
  @original_quantity
end

#paypal_payer_idObject

The PayPal Payer ID tied to this item



72
73
74
# File 'lib/ultracart_api/models/auto_order_item.rb', line 72

def paypal_payer_id
  @paypal_payer_id
end

#paypal_recurring_payment_profile_idObject

The PayPal Profile ID tied to this item



75
76
77
# File 'lib/ultracart_api/models/auto_order_item.rb', line 75

def paypal_recurring_payment_profile_id
  @paypal_recurring_payment_profile_id
end

#preshipment_notice_sentObject

True if the preshipment notice associated with the next rebill has been sent



78
79
80
# File 'lib/ultracart_api/models/auto_order_item.rb', line 78

def preshipment_notice_sent
  @preshipment_notice_sent
end

#rebill_valueObject

The value of the rebills of this item



81
82
83
# File 'lib/ultracart_api/models/auto_order_item.rb', line 81

def rebill_value
  @rebill_value
end

#remaining_repeat_countObject

The number of rebills remaining before this item is complete



84
85
86
# File 'lib/ultracart_api/models/auto_order_item.rb', line 84

def remaining_repeat_count
  @remaining_repeat_count
end

#simple_scheduleObject

Returns the value of attribute simple_schedule.



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

def simple_schedule
  @simple_schedule
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'arbitrary_item_id' => :'arbitrary_item_id',
    :'arbitrary_percentage_discount' => :'arbitrary_percentage_discount',
    :'arbitrary_quantity' => :'arbitrary_quantity',
    :'arbitrary_schedule_days' => :'arbitrary_schedule_days',
    :'arbitrary_unit_cost' => :'arbitrary_unit_cost',
    :'arbitrary_unit_cost_remaining_orders' => :'arbitrary_unit_cost_remaining_orders',
    :'auto_order_item_oid' => :'auto_order_item_oid',
    :'frequency' => :'frequency',
    :'future_schedules' => :'future_schedules',
    :'last_order_dts' => :'last_order_dts',
    :'life_time_value' => :'life_time_value',
    :'next_preshipment_notice_dts' => :'next_preshipment_notice_dts',
    :'next_shipment_dts' => :'next_shipment_dts',
    :'no_order_after_dts' => :'no_order_after_dts',
    :'number_of_rebills' => :'number_of_rebills',
    :'options' => :'options',
    :'original_item_id' => :'original_item_id',
    :'original_quantity' => :'original_quantity',
    :'paypal_payer_id' => :'paypal_payer_id',
    :'paypal_recurring_payment_profile_id' => :'paypal_recurring_payment_profile_id',
    :'preshipment_notice_sent' => :'preshipment_notice_sent',
    :'rebill_value' => :'rebill_value',
    :'remaining_repeat_count' => :'remaining_repeat_count',
    :'simple_schedule' => :'simple_schedule'
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    :'arbitrary_item_id' => :'String',
    :'arbitrary_percentage_discount' => :'Float',
    :'arbitrary_quantity' => :'Float',
    :'arbitrary_schedule_days' => :'Integer',
    :'arbitrary_unit_cost' => :'Float',
    :'arbitrary_unit_cost_remaining_orders' => :'Integer',
    :'auto_order_item_oid' => :'Integer',
    :'frequency' => :'String',
    :'future_schedules' => :'Array<AutoOrderItemFutureSchedule>',
    :'last_order_dts' => :'String',
    :'life_time_value' => :'Float',
    :'next_preshipment_notice_dts' => :'String',
    :'next_shipment_dts' => :'String',
    :'no_order_after_dts' => :'String',
    :'number_of_rebills' => :'Integer',
    :'options' => :'Array<AutoOrderItemOption>',
    :'original_item_id' => :'String',
    :'original_quantity' => :'Float',
    :'paypal_payer_id' => :'String',
    :'paypal_recurring_payment_profile_id' => :'String',
    :'preshipment_notice_sent' => :'BOOLEAN',
    :'rebill_value' => :'Float',
    :'remaining_repeat_count' => :'Integer',
    :'simple_schedule' => :'AutoOrderItemSimpleSchedule'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/ultracart_api/models/auto_order_item.rb', line 306

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      arbitrary_item_id == o.arbitrary_item_id &&
      arbitrary_percentage_discount == o.arbitrary_percentage_discount &&
      arbitrary_quantity == o.arbitrary_quantity &&
      arbitrary_schedule_days == o.arbitrary_schedule_days &&
      arbitrary_unit_cost == o.arbitrary_unit_cost &&
      arbitrary_unit_cost_remaining_orders == o.arbitrary_unit_cost_remaining_orders &&
      auto_order_item_oid == o.auto_order_item_oid &&
      frequency == o.frequency &&
      future_schedules == o.future_schedules &&
      last_order_dts == o.last_order_dts &&
      life_time_value == o.life_time_value &&
      next_preshipment_notice_dts == o.next_preshipment_notice_dts &&
      next_shipment_dts == o.next_shipment_dts &&
      no_order_after_dts == o.no_order_after_dts &&
      number_of_rebills == o.number_of_rebills &&
      options == o.options &&
      original_item_id == o.original_item_id &&
      original_quantity == o.original_quantity &&
      paypal_payer_id == o.paypal_payer_id &&
      paypal_recurring_payment_profile_id == o.paypal_recurring_payment_profile_id &&
      preshipment_notice_sent == o.preshipment_notice_sent &&
      rebill_value == o.rebill_value &&
      remaining_repeat_count == o.remaining_repeat_count &&
      simple_schedule == o.simple_schedule
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



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
399
400
401
402
403
404
405
406
407
# File 'lib/ultracart_api/models/auto_order_item.rb', line 371

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



437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/ultracart_api/models/auto_order_item.rb', line 437

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



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/ultracart_api/models/auto_order_item.rb', line 350

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


337
338
339
# File 'lib/ultracart_api/models/auto_order_item.rb', line 337

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



343
344
345
# File 'lib/ultracart_api/models/auto_order_item.rb', line 343

def hash
  [arbitrary_item_id, arbitrary_percentage_discount, arbitrary_quantity, arbitrary_schedule_days, arbitrary_unit_cost, arbitrary_unit_cost_remaining_orders, auto_order_item_oid, frequency, future_schedules, last_order_dts, life_time_value, next_preshipment_notice_dts, next_shipment_dts, no_order_after_dts, number_of_rebills, options, original_item_id, original_quantity, paypal_payer_id, paypal_recurring_payment_profile_id, preshipment_notice_sent, rebill_value, remaining_repeat_count, simple_schedule].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



281
282
283
284
# File 'lib/ultracart_api/models/auto_order_item.rb', line 281

def list_invalid_properties
  invalid_properties = Array.new
  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



417
418
419
# File 'lib/ultracart_api/models/auto_order_item.rb', line 417

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



423
424
425
426
427
428
429
430
431
# File 'lib/ultracart_api/models/auto_order_item.rb', line 423

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



411
412
413
# File 'lib/ultracart_api/models/auto_order_item.rb', line 411

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



288
289
290
291
292
# File 'lib/ultracart_api/models/auto_order_item.rb', line 288

def valid?
  frequency_validator = EnumAttributeValidator.new('String', ['Weekly', 'Biweekly', 'Every...', 'Every 10 Days', 'Every 24 Days', 'Every 28 Days', 'Monthly', 'Every 45 Days', 'Every 2 Months', 'Every 3 Months', 'Every 4 Months', 'Every 6 Months', 'Yearly'])
  return false unless frequency_validator.valid?(@frequency)
  true
end