Class: CyberSource::Acpv1instructionsinstructionIdcredentialsOrderInformationItems
- Inherits:
-
Object
- Object
- CyberSource::Acpv1instructionsinstructionIdcredentialsOrderInformationItems
- Defined in:
- lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb
Instance Attribute Summary collapse
-
#additional_info ⇒ Object
Returns the value of attribute additional_info.
-
#amount_detail ⇒ Object
Returns the value of attribute amount_detail.
-
#policies ⇒ Object
Returns the value of attribute policies.
-
#product_name ⇒ Object
Name of the product.
-
#product_sku ⇒ Object
Unique identifier for the product.
-
#product_url ⇒ Object
URL of the product.
-
#quantity ⇒ Object
(Conditional) Quantity of the product.
-
#unit_price ⇒ Object
The price of a single unit.
-
#unit_price_currency ⇒ Object
ISO 4217 currency code.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.json_map ⇒ Object
Attribute mapping from JSON key to ruby-style variable name.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Acpv1instructionsinstructionIdcredentialsOrderInformationItems
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Acpv1instructionsinstructionIdcredentialsOrderInformationItems
Initializes the object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 87 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?(:'productSku') self.product_sku = attributes[:'productSku'] end if attributes.has_key?(:'productName') self.product_name = attributes[:'productName'] end if attributes.has_key?(:'quantity') self.quantity = attributes[:'quantity'] end if attributes.has_key?(:'unitPrice') self.unit_price = attributes[:'unitPrice'] end if attributes.has_key?(:'unitPriceCurrency') self.unit_price_currency = attributes[:'unitPriceCurrency'] end if attributes.has_key?(:'amountDetail') self.amount_detail = attributes[:'amountDetail'] end if attributes.has_key?(:'productUrl') self.product_url = attributes[:'productUrl'] end if attributes.has_key?(:'policies') self.policies = attributes[:'policies'] end if attributes.has_key?(:'additionalInfo') if (value = attributes[:'additionalInfo']).is_a?(Array) self.additional_info = value end end end |
Instance Attribute Details
#additional_info ⇒ Object
Returns the value of attribute additional_info.
38 39 40 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 38 def additional_info @additional_info end |
#amount_detail ⇒ Object
Returns the value of attribute amount_detail.
31 32 33 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 31 def amount_detail @amount_detail end |
#policies ⇒ Object
Returns the value of attribute policies.
36 37 38 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 36 def policies @policies end |
#product_name ⇒ Object
Name of the product.
20 21 22 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 20 def product_name @product_name end |
#product_sku ⇒ Object
Unique identifier for the product.
17 18 19 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 17 def product_sku @product_sku end |
#product_url ⇒ Object
URL of the product.
34 35 36 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 34 def product_url @product_url end |
#quantity ⇒ Object
(Conditional) Quantity of the product.
23 24 25 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 23 def quantity @quantity end |
#unit_price ⇒ Object
The price of a single unit.
26 27 28 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 26 def unit_price @unit_price end |
#unit_price_currency ⇒ Object
ISO 4217 currency code. Currency in which the unit price is expressed.
29 30 31 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 29 def unit_price_currency @unit_price_currency end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 41 def self.attribute_map { :'product_sku' => :'productSku', :'product_name' => :'productName', :'quantity' => :'quantity', :'unit_price' => :'unitPrice', :'unit_price_currency' => :'unitPriceCurrency', :'amount_detail' => :'amountDetail', :'product_url' => :'productUrl', :'policies' => :'policies', :'additional_info' => :'additionalInfo' } end |
.json_map ⇒ Object
Attribute mapping from JSON key to ruby-style variable name.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 56 def self.json_map { :'product_sku' => :'product_sku', :'product_name' => :'product_name', :'quantity' => :'quantity', :'unit_price' => :'unit_price', :'unit_price_currency' => :'unit_price_currency', :'amount_detail' => :'amount_detail', :'product_url' => :'product_url', :'policies' => :'policies', :'additional_info' => :'additional_info' } end |
.swagger_types ⇒ Object
Attribute type mapping.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 71 def self.swagger_types { :'product_sku' => :'String', :'product_name' => :'String', :'quantity' => :'String', :'unit_price' => :'String', :'unit_price_currency' => :'String', :'amount_detail' => :'Acpv1instructionsinstructionIdcredentialsOrderInformationAmountDetail', :'product_url' => :'String', :'policies' => :'Acpv1instructionsinstructionIdcredentialsOrderInformationItemsPolicies', :'additional_info' => :'Array<Acpv1instructionsinstructionIdcredentialsOrderInformationItemsAdditionalInfo>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 237 def ==(o) return true if self.equal?(o) self.class == o.class && product_sku == o.product_sku && product_name == o.product_name && quantity == o.quantity && unit_price == o.unit_price && unit_price_currency == o.unit_price_currency && amount_detail == o.amount_detail && product_url == o.product_url && policies == o.policies && additional_info == o.additional_info end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 287 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 = CyberSource.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
353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 353 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
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 266 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("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{self.class.json_map[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
253 254 255 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 253 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
259 260 261 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 259 def hash [product_sku, product_name, quantity, unit_price, unit_price_currency, amount_detail, product_url, policies, additional_info].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
134 135 136 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 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 134 def list_invalid_properties invalid_properties = Array.new #if !@product_sku.nil? && @product_sku !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "product_sku", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end #if !@product_name.nil? && @product_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "product_name", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end #if [email protected]? && @quantity !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "quantity", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end #if !@unit_price.nil? && @unit_price !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "unit_price", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end #if !@unit_price_currency.nil? && @unit_price_currency !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "unit_price_currency", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end #if !@product_url.nil? && @product_url !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "product_url", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
333 334 335 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 333 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
339 340 341 342 343 344 345 346 347 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 339 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 ⇒ String
Returns the string representation of the object
327 328 329 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 327 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
165 166 167 168 169 170 171 172 173 |
# File 'lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb', line 165 def valid? #return false if !@product_sku.nil? && @product_sku !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #return false if !@product_name.nil? && @product_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #return false if [email protected]? && @quantity !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #return false if !@unit_price.nil? && @unit_price !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #return false if !@unit_price_currency.nil? && @unit_price_currency !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #return false if !@product_url.nil? && @product_url !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) true end |