class SwaggerClient::PurchaseGiftCardRequest
Attributes
The date that the gift card’s image is to be delivered to the recipient. This parameter cannot be set to a date in the past. This parameter is required if the `LayoutId` is not 0. Default: today Minimum: today
The product ID of the gift card being purchased.
A personal message to include in the gift card.<br /> Maximum length: 300
The ID of the layout used for the gift card’s image.
The ID of the location where the gift card is being sold.
Contains information about the payment.
The RSSID of the client who is purchasing the gift card.
The email address to send the gift card image to. This parameter is required if the `LayoutId` is not 0.<br /> Maximum length: 100
The name of the person who is to receive the gift card. This parameter is required if the `LayoutId` is not 0.<br /> Maximum length: 20
When `true`, indicates that a purchase receipt email should be sent to the purchasing client, if all settings are correctly configured.<br /> When `false`, no email is sent to the purchaser.
When `true`, allows you to test the request without affecting the database.<br /> When `false`, the request is carried out and the database is affected.
The text to use as the title of the gift card, for example: Happy Birthday, Maria! This parameter is required if the `LayoutId` is not 0.<br /> Maximum length: 20
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 54 def self.attribute_map { :'test' => :'Test', :'location_id' => :'LocationId', :'layout_id' => :'LayoutId', :'purchaser_client_id' => :'PurchaserClientId', :'gift_card_id' => :'GiftCardId', :'send_email_receipt' => :'SendEmailReceipt', :'recipient_email' => :'RecipientEmail', :'recipient_name' => :'RecipientName', :'title' => :'Title', :'gift_message' => :'GiftMessage', :'delivery_date' => :'DeliveryDate', :'payment_info' => :'PaymentInfo' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 91 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?(:'Test') self.test = attributes[:'Test'] end if attributes.has_key?(:'LocationId') self.location_id = attributes[:'LocationId'] end if attributes.has_key?(:'LayoutId') self.layout_id = attributes[:'LayoutId'] end if attributes.has_key?(:'PurchaserClientId') self.purchaser_client_id = attributes[:'PurchaserClientId'] end if attributes.has_key?(:'GiftCardId') self.gift_card_id = attributes[:'GiftCardId'] end if attributes.has_key?(:'SendEmailReceipt') self.send_email_receipt = attributes[:'SendEmailReceipt'] end if attributes.has_key?(:'RecipientEmail') self.recipient_email = attributes[:'RecipientEmail'] end if attributes.has_key?(:'RecipientName') self.recipient_name = attributes[:'RecipientName'] end if attributes.has_key?(:'Title') self.title = attributes[:'Title'] end if attributes.has_key?(:'GiftMessage') self.gift_message = attributes[:'GiftMessage'] end if attributes.has_key?(:'DeliveryDate') self.delivery_date = attributes[:'DeliveryDate'] end if attributes.has_key?(:'PaymentInfo') self.payment_info = attributes[:'PaymentInfo'] end end
Attribute type mapping.
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 72 def self.swagger_types { :'test' => :'BOOLEAN', :'location_id' => :'Integer', :'layout_id' => :'Integer', :'purchaser_client_id' => :'String', :'gift_card_id' => :'Integer', :'send_email_receipt' => :'BOOLEAN', :'recipient_email' => :'String', :'recipient_name' => :'String', :'title' => :'String', :'gift_message' => :'String', :'delivery_date' => :'DateTime', :'payment_info' => :'CheckoutPaymentInfo' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 176 def ==(o) return true if self.equal?(o) self.class == o.class && test == o.test && location_id == o.location_id && layout_id == o.layout_id && purchaser_client_id == o.purchaser_client_id && gift_card_id == o.gift_card_id && send_email_receipt == o.send_email_receipt && recipient_email == o.recipient_email && recipient_name == o.recipient_name && title == o.title && gift_message == o.gift_message && delivery_date == o.delivery_date && payment_info == o.payment_info end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 229 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 = SwaggerClient.const_get(type).new temp_model.build_from_hash(value) end end
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/swagger_client/models/purchase_gift_card_request.rb, line 295 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
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 208 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 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
@see the `==` method @param [Object] Object to be compared
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 195 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 201 def hash [test, location_id, layout_id, purchaser_client_id, gift_card_id, send_email_receipt, recipient_email, recipient_name, title, gift_message, delivery_date, payment_info].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 148 def list_invalid_properties invalid_properties = Array.new if @location_id.nil? invalid_properties.push('invalid value for "location_id", location_id cannot be nil.') end if @purchaser_client_id.nil? invalid_properties.push('invalid value for "purchaser_client_id", purchaser_client_id cannot be nil.') end if @gift_card_id.nil? invalid_properties.push('invalid value for "gift_card_id", gift_card_id cannot be nil.') end invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 281 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 269 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/swagger_client/models/purchase_gift_card_request.rb, line 167 def valid? return false if @location_id.nil? return false if @purchaser_client_id.nil? return false if @gift_card_id.nil? true end