class UltracartClient::AutoOrderItem

Attributes

arbitrary_item_id[RW]

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

arbitrary_percentage_discount[RW]

An arbitrary percentage discount to provide on future rebills

arbitrary_quantity[RW]

Arbitrary quantity to rebill

arbitrary_schedule_days[RW]

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

arbitrary_unit_cost[RW]

Arbitrary unit cost that rebills of this item should occur at

arbitrary_unit_cost_remaining_orders[RW]

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

auto_order_item_oid[RW]

Primary key of AutoOrderItem

frequency[RW]

Frequency of the rebill if not a fixed schedule

future_schedules[RW]

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

last_order_dts[RW]

Date/time of the last order of this item

life_time_value[RW]

The life time value of this item including the original purchase

next_preshipment_notice_dts[RW]

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

next_shipment_dts[RW]

Date/time that this item is scheduled to rebill

no_order_after_dts[RW]

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

number_of_rebills[RW]

The number of times this item has rebilled

options[RW]

Options associated with this item

original_item_id[RW]

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.

original_quantity[RW]

The original quantity purchased

paypal_payer_id[RW]

The PayPal Payer ID tied to this item

paypal_recurring_payment_profile_id[RW]

The PayPal Profile ID tied to this item

preshipment_notice_sent[RW]

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

rebill_value[RW]

The value of the rebills of this item

remaining_repeat_count[RW]

The number of rebills remaining before this item is complete

simple_schedule[RW]

Public Class Methods

attribute_map() click to toggle source

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

# 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
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# 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
swagger_types() click to toggle source

Attribute type mapping.

# 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

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# 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) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# 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) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# 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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# 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) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/ultracart_api/models/auto_order_item.rb, line 337
def eql?(o)
  self == o
end
frequency=(frequency) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] frequency Object to be assigned

# File lib/ultracart_api/models/auto_order_item.rb, line 296
def frequency=(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'])
  unless validator.valid?(frequency)
    fail ArgumentError, 'invalid value for "frequency", must be one of #{validator.allowable_values}.'
  end
  @frequency = frequency
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# 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_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/ultracart_api/models/auto_order_item.rb, line 281
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/ultracart_api/models/auto_order_item.rb, line 417
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# 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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/ultracart_api/models/auto_order_item.rb, line 411
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# 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