Class: ZSGFClient::Order
- Inherits:
-
Object
- Object
- ZSGFClient::Order
- Defined in:
- lib/zsgf_client/models/order.rb
Overview
订单实体,用于记录用户的订单信息。
Instance Attribute Summary collapse
-
#allow_refund ⇒ Object
指示订单是否允许进行退款操作。.
-
#allow_refund_until ⇒ Object
订单允许进行退款操作的截止时间。.
-
#amount ⇒ Object
订单的总金额。.
-
#create_date ⇒ Object
订单的创建时间,默认为当前时间。.
-
#description ⇒ Object
订单的详细描述信息。.
-
#expire_time ⇒ Object
订单的过期时间,超过该时间订单将自动取消。.
-
#id ⇒ Object
订单的唯一标识符。.
-
#last_update ⇒ Object
订单的最后更新时间,默认为当前时间。.
-
#order_no ⇒ Object
订单的唯一编号,通常由系统生成。.
-
#order_pay_time ⇒ Object
订单完成支付的时间。.
-
#pay_type ⇒ Object
订单的支付类型,例如 ‘信用卡’, ‘支付宝’, ‘微信支付’ 等。.
-
#product_id ⇒ Object
订单中商品的唯一标识符。.
-
#product_name ⇒ Object
订单中商品的名称。.
-
#product_type ⇒ Object
订单中商品的类型分类。.
-
#remark ⇒ Object
订单的额外备注信息。.
-
#status ⇒ Object
订单的当前状态,例如 ‘待支付’, ‘已完成’, ‘已取消’ 等。.
-
#tags ⇒ Object
用于分类或标记订单的标签。.
-
#trade_no ⇒ Object
与订单关联的交易编号,通常由支付平台提供。.
-
#user_id ⇒ Object
创建订单的用户ID。.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.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.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Order
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 = {}) ⇒ Order
Initializes the object
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 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/zsgf_client/models/order.rb', line 154 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `ZSGFClient::Order` 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 `ZSGFClient::Order`. 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?(:'user_id') self.user_id = attributes[:'user_id'] end if attributes.key?(:'pay_type') self.pay_type = attributes[:'pay_type'] end if attributes.key?(:'amount') self.amount = attributes[:'amount'] end if attributes.key?(:'order_no') self.order_no = attributes[:'order_no'] end if attributes.key?(:'trade_no') self.trade_no = attributes[:'trade_no'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'product_type') self.product_type = attributes[:'product_type'] end if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] end if attributes.key?(:'product_name') self.product_name = attributes[:'product_name'] end if attributes.key?(:'allow_refund') self.allow_refund = attributes[:'allow_refund'] end if attributes.key?(:'allow_refund_until') self.allow_refund_until = attributes[:'allow_refund_until'] end if attributes.key?(:'tags') self. = attributes[:'tags'] end if attributes.key?(:'remark') self.remark = attributes[:'remark'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'order_pay_time') self.order_pay_time = attributes[:'order_pay_time'] end if attributes.key?(:'expire_time') self.expire_time = attributes[:'expire_time'] end if attributes.key?(:'create_date') self.create_date = attributes[:'create_date'] end if attributes.key?(:'last_update') self.last_update = attributes[:'last_update'] end end |
Instance Attribute Details
#allow_refund ⇒ Object
指示订单是否允许进行退款操作。
50 51 52 |
# File 'lib/zsgf_client/models/order.rb', line 50 def allow_refund @allow_refund end |
#allow_refund_until ⇒ Object
订单允许进行退款操作的截止时间。
53 54 55 |
# File 'lib/zsgf_client/models/order.rb', line 53 def allow_refund_until @allow_refund_until end |
#amount ⇒ Object
订单的总金额。
29 30 31 |
# File 'lib/zsgf_client/models/order.rb', line 29 def amount @amount end |
#create_date ⇒ Object
订单的创建时间,默认为当前时间。
71 72 73 |
# File 'lib/zsgf_client/models/order.rb', line 71 def create_date @create_date end |
#description ⇒ Object
订单的详细描述信息。
62 63 64 |
# File 'lib/zsgf_client/models/order.rb', line 62 def description @description end |
#expire_time ⇒ Object
订单的过期时间,超过该时间订单将自动取消。
68 69 70 |
# File 'lib/zsgf_client/models/order.rb', line 68 def expire_time @expire_time end |
#id ⇒ Object
订单的唯一标识符。
20 21 22 |
# File 'lib/zsgf_client/models/order.rb', line 20 def id @id end |
#last_update ⇒ Object
订单的最后更新时间,默认为当前时间。
74 75 76 |
# File 'lib/zsgf_client/models/order.rb', line 74 def last_update @last_update end |
#order_no ⇒ Object
订单的唯一编号,通常由系统生成。
32 33 34 |
# File 'lib/zsgf_client/models/order.rb', line 32 def order_no @order_no end |
#order_pay_time ⇒ Object
订单完成支付的时间。
65 66 67 |
# File 'lib/zsgf_client/models/order.rb', line 65 def order_pay_time @order_pay_time end |
#pay_type ⇒ Object
订单的支付类型,例如 ‘信用卡’, ‘支付宝’, ‘微信支付’ 等。
26 27 28 |
# File 'lib/zsgf_client/models/order.rb', line 26 def pay_type @pay_type end |
#product_id ⇒ Object
订单中商品的唯一标识符。
44 45 46 |
# File 'lib/zsgf_client/models/order.rb', line 44 def product_id @product_id end |
#product_name ⇒ Object
订单中商品的名称。
47 48 49 |
# File 'lib/zsgf_client/models/order.rb', line 47 def product_name @product_name end |
#product_type ⇒ Object
订单中商品的类型分类。
41 42 43 |
# File 'lib/zsgf_client/models/order.rb', line 41 def product_type @product_type end |
#remark ⇒ Object
订单的额外备注信息。
59 60 61 |
# File 'lib/zsgf_client/models/order.rb', line 59 def remark @remark end |
#status ⇒ Object
订单的当前状态,例如 ‘待支付’, ‘已完成’, ‘已取消’ 等。
38 39 40 |
# File 'lib/zsgf_client/models/order.rb', line 38 def status @status end |
#tags ⇒ Object
用于分类或标记订单的标签。
56 57 58 |
# File 'lib/zsgf_client/models/order.rb', line 56 def end |
#trade_no ⇒ Object
与订单关联的交易编号,通常由支付平台提供。
35 36 37 |
# File 'lib/zsgf_client/models/order.rb', line 35 def trade_no @trade_no end |
#user_id ⇒ Object
创建订单的用户ID。
23 24 25 |
# File 'lib/zsgf_client/models/order.rb', line 23 def user_id @user_id end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/zsgf_client/models/order.rb', line 460 def self._deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = ZSGFClient.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
102 103 104 |
# File 'lib/zsgf_client/models/order.rb', line 102 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
107 108 109 |
# File 'lib/zsgf_client/models/order.rb', line 107 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/zsgf_client/models/order.rb', line 77 def self.attribute_map { :'id' => :'id', :'user_id' => :'userID', :'pay_type' => :'payType', :'amount' => :'amount', :'order_no' => :'orderNo', :'trade_no' => :'tradeNo', :'status' => :'status', :'product_type' => :'productType', :'product_id' => :'productID', :'product_name' => :'productName', :'allow_refund' => :'allowRefund', :'allow_refund_until' => :'allowRefundUntil', :'tags' => :'tags', :'remark' => :'remark', :'description' => :'description', :'order_pay_time' => :'orderPayTime', :'expire_time' => :'expireTime', :'create_date' => :'createDate', :'last_update' => :'lastUpdate' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/zsgf_client/models/order.rb', line 436 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
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/zsgf_client/models/order.rb', line 137 def self.openapi_nullable Set.new([ :'pay_type', :'order_no', :'trade_no', :'status', :'product_type', :'product_id', :'product_name', :'tags', :'remark', :'description', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/zsgf_client/models/order.rb', line 112 def self.openapi_types { :'id' => :'Integer', :'user_id' => :'Integer', :'pay_type' => :'String', :'amount' => :'Float', :'order_no' => :'String', :'trade_no' => :'String', :'status' => :'String', :'product_type' => :'String', :'product_id' => :'String', :'product_name' => :'String', :'allow_refund' => :'Boolean', :'allow_refund_until' => :'Time', :'tags' => :'String', :'remark' => :'String', :'description' => :'String', :'order_pay_time' => :'Time', :'expire_time' => :'Time', :'create_date' => :'Time', :'last_update' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/zsgf_client/models/order.rb', line 397 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && user_id == o.user_id && pay_type == o.pay_type && amount == o.amount && order_no == o.order_no && trade_no == o.trade_no && status == o.status && product_type == o.product_type && product_id == o.product_id && product_name == o.product_name && allow_refund == o.allow_refund && allow_refund_until == o.allow_refund_until && == o. && remark == o.remark && description == o.description && order_pay_time == o.order_pay_time && expire_time == o.expire_time && create_date == o.create_date && last_update == o.last_update end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
531 532 533 534 535 536 537 538 539 540 541 542 543 |
# File 'lib/zsgf_client/models/order.rb', line 531 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 |
#eql?(o) ⇒ Boolean
423 424 425 |
# File 'lib/zsgf_client/models/order.rb', line 423 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
429 430 431 |
# File 'lib/zsgf_client/models/order.rb', line 429 def hash [id, user_id, pay_type, amount, order_no, trade_no, status, product_type, product_id, product_name, allow_refund, allow_refund_until, , remark, description, order_pay_time, expire_time, create_date, last_update].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/zsgf_client/models/order.rb', line 247 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@pay_type.nil? && @pay_type.to_s.length > 50 invalid_properties.push('invalid value for "pay_type", the character length must be smaller than or equal to 50.') end if !@order_no.nil? && @order_no.to_s.length > 50 invalid_properties.push('invalid value for "order_no", the character length must be smaller than or equal to 50.') end if !@trade_no.nil? && @trade_no.to_s.length > 50 invalid_properties.push('invalid value for "trade_no", the character length must be smaller than or equal to 50.') end if !@status.nil? && @status.to_s.length > 50 invalid_properties.push('invalid value for "status", the character length must be smaller than or equal to 50.') end if !@product_type.nil? && @product_type.to_s.length > 50 invalid_properties.push('invalid value for "product_type", the character length must be smaller than or equal to 50.') end if !@product_id.nil? && @product_id.to_s.length > 50 invalid_properties.push('invalid value for "product_id", the character length must be smaller than or equal to 50.') end if !@product_name.nil? && @product_name.to_s.length > 255 invalid_properties.push('invalid value for "product_name", the character length must be smaller than or equal to 255.') end if !.nil? && .to_s.length > 255 invalid_properties.push('invalid value for "tags", the character length must be smaller than or equal to 255.') end if !@remark.nil? && @remark.to_s.length > 255 invalid_properties.push('invalid value for "remark", the character length must be smaller than or equal to 255.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
507 508 509 |
# File 'lib/zsgf_client/models/order.rb', line 507 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/zsgf_client/models/order.rb', line 513 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 |
#to_s ⇒ String
Returns the string representation of the object
501 502 503 |
# File 'lib/zsgf_client/models/order.rb', line 501 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/zsgf_client/models/order.rb', line 291 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@pay_type.nil? && @pay_type.to_s.length > 50 return false if !@order_no.nil? && @order_no.to_s.length > 50 return false if !@trade_no.nil? && @trade_no.to_s.length > 50 return false if !@status.nil? && @status.to_s.length > 50 return false if !@product_type.nil? && @product_type.to_s.length > 50 return false if !@product_id.nil? && @product_id.to_s.length > 50 return false if !@product_name.nil? && @product_name.to_s.length > 255 return false if !.nil? && .to_s.length > 255 return false if !@remark.nil? && @remark.to_s.length > 255 true end |