Class: Ifeelgoods::PromotionDetails
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Ifeelgoods::PromotionDetails
- Defined in:
- lib/ifeelgoods/models/promotion_details.rb
Overview
A Promotion represents the settings of a campaign in which a Client distributes their Rewards to the end-users.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#allow_pdf ⇒ Object
Returns the value of attribute allow_pdf.
-
#authentication_systems ⇒ Object
List of authentication systems used for the campaign (eg.
[\"email\", \"sms\"]). -
#client ⇒ Object
Returns the value of attribute client.
-
#end_datetime ⇒ Object
Returns the value of attribute end_datetime.
-
#fraud_level ⇒ Object
Returns the value of attribute fraud_level.
-
#id ⇒ Object
Returns the value of attribute id.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#name ⇒ Object
Campaign name.
-
#redeem_frequency ⇒ Object
Returns the value of attribute redeem_frequency.
-
#rewards ⇒ Object
Returns the value of attribute rewards.
-
#secured_order_ids ⇒ Object
Indicates whether the campaign stores secured order ids.
-
#start_datetime ⇒ Object
Returns the value of attribute start_datetime.
-
#state ⇒ Object
Returns the value of attribute state.
-
#status ⇒ Object
Returns the value of attribute status.
-
#ui_id ⇒ Object
Returns the value of attribute ui_id.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.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.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PromotionDetails
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ PromotionDetails
Initializes the object
137 138 139 140 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 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 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 137 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Ifeelgoods::PromotionDetails` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Ifeelgoods::PromotionDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'ui_id') self.ui_id = attributes[:'ui_id'] end if attributes.key?(:'locale') self.locale = attributes[:'locale'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'start_datetime') self.start_datetime = attributes[:'start_datetime'] end if attributes.key?(:'end_datetime') self.end_datetime = attributes[:'end_datetime'] end if attributes.key?(:'client') self.client = attributes[:'client'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'rewards') if (value = attributes[:'rewards']).is_a?(Array) self.rewards = value end end if attributes.key?(:'fraud_level') self.fraud_level = attributes[:'fraud_level'] end if attributes.key?(:'redeem_frequency') self.redeem_frequency = attributes[:'redeem_frequency'] end if attributes.key?(:'authentication_systems') if (value = attributes[:'authentication_systems']).is_a?(Array) self.authentication_systems = value end end if attributes.key?(:'secured_order_ids') self.secured_order_ids = attributes[:'secured_order_ids'] end if attributes.key?(:'allow_pdf') self.allow_pdf = attributes[:'allow_pdf'] end end |
Instance Attribute Details
#allow_pdf ⇒ Object
Returns the value of attribute allow_pdf.
50 51 52 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 50 def allow_pdf @allow_pdf end |
#authentication_systems ⇒ Object
List of authentication systems used for the campaign (eg. [\"email\", \"sms\"]).
45 46 47 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 45 def authentication_systems @authentication_systems end |
#client ⇒ Object
Returns the value of attribute client.
32 33 34 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 32 def client @client end |
#end_datetime ⇒ Object
Returns the value of attribute end_datetime.
30 31 32 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 30 def end_datetime @end_datetime end |
#fraud_level ⇒ Object
Returns the value of attribute fraud_level.
40 41 42 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 40 def fraud_level @fraud_level end |
#id ⇒ Object
Returns the value of attribute id.
19 20 21 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 19 def id @id end |
#locale ⇒ Object
Returns the value of attribute locale.
23 24 25 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 23 def locale @locale end |
#name ⇒ Object
Campaign name.
26 27 28 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 26 def name @name end |
#redeem_frequency ⇒ Object
Returns the value of attribute redeem_frequency.
42 43 44 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 42 def redeem_frequency @redeem_frequency end |
#rewards ⇒ Object
Returns the value of attribute rewards.
38 39 40 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 38 def rewards @rewards end |
#secured_order_ids ⇒ Object
Indicates whether the campaign stores secured order ids.
48 49 50 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 48 def secured_order_ids @secured_order_ids end |
#start_datetime ⇒ Object
Returns the value of attribute start_datetime.
28 29 30 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 28 def start_datetime @start_datetime end |
#state ⇒ Object
Returns the value of attribute state.
36 37 38 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 36 def state @state end |
#status ⇒ Object
Returns the value of attribute status.
34 35 36 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 34 def status @status end |
#ui_id ⇒ Object
Returns the value of attribute ui_id.
21 22 23 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 21 def ui_id @ui_id end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
96 97 98 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 96 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
101 102 103 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 101 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 75 def self.attribute_map { :'id' => :'id', :'ui_id' => :'ui_id', :'locale' => :'locale', :'name' => :'name', :'start_datetime' => :'start_datetime', :'end_datetime' => :'end_datetime', :'client' => :'client', :'status' => :'status', :'state' => :'state', :'rewards' => :'rewards', :'fraud_level' => :'fraud_level', :'redeem_frequency' => :'redeem_frequency', :'authentication_systems' => :'authentication_systems', :'secured_order_ids' => :'secured_order_ids', :'allow_pdf' => :'allow_pdf' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 316 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
127 128 129 130 131 132 133 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 127 def self.openapi_nullable Set.new([ :'ui_id', :'locale', :'end_datetime', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 106 def self.openapi_types { :'id' => :'Integer', :'ui_id' => :'String', :'locale' => :'String', :'name' => :'String', :'start_datetime' => :'Time', :'end_datetime' => :'Time', :'client' => :'PromotionDetailsClient', :'status' => :'String', :'state' => :'String', :'rewards' => :'Array<PromotionDetailsRewardsInner>', :'fraud_level' => :'String', :'redeem_frequency' => :'String', :'authentication_systems' => :'Array<String>', :'secured_order_ids' => :'Boolean', :'allow_pdf' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 281 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && ui_id == o.ui_id && locale == o.locale && name == o.name && start_datetime == o.start_datetime && end_datetime == o.end_datetime && client == o.client && status == o.status && state == o.state && rewards == o.rewards && fraud_level == o.fraud_level && redeem_frequency == o.redeem_frequency && authentication_systems == o.authentication_systems && secured_order_ids == o.secured_order_ids && allow_pdf == o.allow_pdf end |
#eql?(o) ⇒ Boolean
303 304 305 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 303 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
309 310 311 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 309 def hash [id, ui_id, locale, name, start_datetime, end_datetime, client, status, state, rewards, fraud_level, redeem_frequency, authentication_systems, secured_order_ids, allow_pdf].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
218 219 220 221 222 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 218 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 338 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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/ifeelgoods/models/promotion_details.rb', line 226 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' status_validator = EnumAttributeValidator.new('String', ["enabled", "disabled", "paused", "completed"]) return false unless status_validator.valid?(@status) state_validator = EnumAttributeValidator.new('String', ["ready", "pending", "ended", "legacy"]) return false unless state_validator.valid?(@state) fraud_level_validator = EnumAttributeValidator.new('String', ["standard", "strong"]) return false unless fraud_level_validator.valid?(@fraud_level) redeem_frequency_validator = EnumAttributeValidator.new('String', ["unique", "multiple"]) return false unless redeem_frequency_validator.valid?(@redeem_frequency) true end |