lib/VoucherifySdk/models/earning_rule.rb in voucherify-5.0.0 vs lib/VoucherifySdk/models/earning_rule.rb in voucherify-6.0.0
- old
+ new
@@ -16,40 +16,44 @@
module VoucherifySdk
class EarningRule
# Assigned by the Voucherify API, identifies the earning rule object.
attr_accessor :id
- # Timestamp representing the date and time when the earning rule was created in ISO 8601 format.
+ # Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.
attr_accessor :created_at
attr_accessor :loyalty
attr_accessor :event
attr_accessor :custom_event
attr_accessor :segment
+ attr_accessor :loyalty_tier
+
attr_accessor :source
- # The type of object represented by JSON. Default is earning_rule.
+ # The type of the object represented by JSON. Default is earning_rule.
attr_accessor :object
# For internal use by Voucherify.
attr_accessor :automation_id
- # Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default.
+ # Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.
attr_accessor :start_date
- # Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default.
+ # Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.
attr_accessor :expiration_date
attr_accessor :validity_timeframe
- # Integer array corresponding to the particular days of the week in which the earning rule is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday
+ # Integer array corresponding to the particular days of the week in which the voucher is valid. - `0` Sunday - `1` Monday - `2` Tuesday - `3` Wednesday - `4` Thursday - `5` Friday - `6` Saturday
attr_accessor :validity_day_of_week
+ attr_accessor :validity_hours
+
# The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.
attr_accessor :metadata
# A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.
attr_accessor :validation_rule_id
@@ -89,17 +93,19 @@
:'created_at' => :'created_at',
:'loyalty' => :'loyalty',
:'event' => :'event',
:'custom_event' => :'custom_event',
:'segment' => :'segment',
+ :'loyalty_tier' => :'loyalty_tier',
:'source' => :'source',
:'object' => :'object',
:'automation_id' => :'automation_id',
:'start_date' => :'start_date',
:'expiration_date' => :'expiration_date',
:'validity_timeframe' => :'validity_timeframe',
:'validity_day_of_week' => :'validity_day_of_week',
+ :'validity_hours' => :'validity_hours',
:'metadata' => :'metadata',
:'validation_rule_id' => :'validation_rule_id',
:'updated_at' => :'updated_at',
:'active' => :'active'
}
@@ -113,74 +119,69 @@
# Attribute type mapping.
def self.openapi_types
{
:'id' => :'String',
:'created_at' => :'Time',
- :'loyalty' => :'EarningRuleBaseLoyalty',
- :'event' => :'EarningRuleEvent',
- :'custom_event' => :'EarningRuleBaseCustomEvent',
- :'segment' => :'EarningRuleBaseSegment',
- :'source' => :'EarningRuleBaseSource',
+ :'loyalty' => :'EarningRuleLoyalty',
+ :'event' => :'String',
+ :'custom_event' => :'EarningRuleCustomEvent',
+ :'segment' => :'EarningRuleSegment',
+ :'loyalty_tier' => :'EarningRuleLoyaltyTier',
+ :'source' => :'EarningRuleSource',
:'object' => :'String',
:'automation_id' => :'String',
:'start_date' => :'String',
:'expiration_date' => :'String',
- :'validity_timeframe' => :'EarningRuleBaseValidityTimeframe',
+ :'validity_timeframe' => :'ValidityTimeframe',
:'validity_day_of_week' => :'Array<Integer>',
+ :'validity_hours' => :'ValidityHours',
:'metadata' => :'Object',
:'validation_rule_id' => :'String',
:'updated_at' => :'Time',
:'active' => :'Boolean'
}
end
# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
+ :'id',
+ :'created_at',
+ :'loyalty',
+ :'custom_event',
+ :'segment',
+ :'loyalty_tier',
+ :'source',
+ :'object',
+ :'automation_id',
+ :'start_date',
+ :'expiration_date',
+ :'metadata',
:'validation_rule_id',
:'updated_at',
+ :'active'
])
end
- # List of class defined in allOf (OpenAPI v3)
- def self.openapi_all_of
- [
- :'EarningRuleBase'
- ]
- end
-
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
def initialize(attributes = {})
- if (!attributes.is_a?(Hash))
- fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::EarningRule` 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 `VoucherifySdk::EarningRule`. 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?(:'id')
self.id = attributes[:'id']
- else
- self.id = nil
end
if attributes.key?(:'created_at')
self.created_at = attributes[:'created_at']
- else
- self.created_at = nil
end
if attributes.key?(:'loyalty')
self.loyalty = attributes[:'loyalty']
- else
- self.loyalty = nil
end
if attributes.key?(:'event')
self.event = attributes[:'event']
end
@@ -191,26 +192,26 @@
if attributes.key?(:'segment')
self.segment = attributes[:'segment']
end
+ if attributes.key?(:'loyalty_tier')
+ self.loyalty_tier = attributes[:'loyalty_tier']
+ end
+
if attributes.key?(:'source')
self.source = attributes[:'source']
- else
- self.source = nil
end
if attributes.key?(:'object')
self.object = attributes[:'object']
else
self.object = 'earning_rule'
end
if attributes.key?(:'automation_id')
self.automation_id = attributes[:'automation_id']
- else
- self.automation_id = nil
end
if attributes.key?(:'start_date')
self.start_date = attributes[:'start_date']
end
@@ -227,102 +228,48 @@
if (value = attributes[:'validity_day_of_week']).is_a?(Array)
self.validity_day_of_week = value
end
end
+ if attributes.key?(:'validity_hours')
+ self.validity_hours = attributes[:'validity_hours']
+ end
+
if attributes.key?(:'metadata')
self.metadata = attributes[:'metadata']
- else
- self.metadata = nil
end
if attributes.key?(:'validation_rule_id')
self.validation_rule_id = attributes[:'validation_rule_id']
- else
- self.validation_rule_id = nil
end
if attributes.key?(:'updated_at')
self.updated_at = attributes[:'updated_at']
- else
- self.updated_at = nil
end
if attributes.key?(:'active')
self.active = attributes[:'active']
- else
- self.active = nil
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
invalid_properties = Array.new
- if @id.nil?
- invalid_properties.push('invalid value for "id", id cannot be nil.')
- end
-
- if @created_at.nil?
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
- end
-
- if @loyalty.nil?
- invalid_properties.push('invalid value for "loyalty", loyalty cannot be nil.')
- end
-
- if @source.nil?
- invalid_properties.push('invalid value for "source", source cannot be nil.')
- end
-
- if @object.nil?
- invalid_properties.push('invalid value for "object", object cannot be nil.')
- end
-
- if @automation_id.nil?
- invalid_properties.push('invalid value for "automation_id", automation_id cannot be nil.')
- end
-
- if @metadata.nil?
- invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
- end
-
- if @active.nil?
- invalid_properties.push('invalid value for "active", active cannot be nil.')
- end
-
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
- return false if @id.nil?
- return false if @created_at.nil?
- return false if @loyalty.nil?
- return false if @source.nil?
- return false if @object.nil?
object_validator = EnumAttributeValidator.new('String', ["earning_rule"])
return false unless object_validator.valid?(@object)
- return false if @automation_id.nil?
- return false if @metadata.nil?
- return false if @active.nil?
true
end
- # Custom attribute writer method checking allowed values (enum).
- # @param [Object] object Object to be assigned
- def object=(object)
- validator = EnumAttributeValidator.new('String', ["earning_rule"])
- unless validator.valid?(object)
- fail ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}."
- end
- @object = object
- end
-
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
@@ -330,17 +277,19 @@
created_at == o.created_at &&
loyalty == o.loyalty &&
event == o.event &&
custom_event == o.custom_event &&
segment == o.segment &&
+ loyalty_tier == o.loyalty_tier &&
source == o.source &&
object == o.object &&
automation_id == o.automation_id &&
start_date == o.start_date &&
expiration_date == o.expiration_date &&
validity_timeframe == o.validity_timeframe &&
validity_day_of_week == o.validity_day_of_week &&
+ validity_hours == o.validity_hours &&
metadata == o.metadata &&
validation_rule_id == o.validation_rule_id &&
updated_at == o.updated_at &&
active == o.active
end
@@ -352,10 +301,10 @@
end
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
- [id, created_at, loyalty, event, custom_event, segment, source, object, automation_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, metadata, validation_rule_id, updated_at, active].hash
+ [id, created_at, loyalty, event, custom_event, segment, loyalty_tier, source, object, automation_id, start_date, expiration_date, validity_timeframe, validity_day_of_week, validity_hours, metadata, validation_rule_id, updated_at, active].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself