Class: Tradenity::ShoppingCart
- Inherits:
-
Object
- Object
- Tradenity::ShoppingCart
- Defined in:
- lib/tradenity/resources/shopping_cart.rb
Instance Attribute Summary collapse
-
#__meta ⇒ Object
Returns the value of attribute __meta.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#items ⇒ Object
Returns the value of attribute items.
-
#items_tax_amount ⇒ Object
Returns the value of attribute items_tax_amount.
-
#promotions ⇒ Object
Returns the value of attribute promotions.
-
#shipping_cost ⇒ Object
Returns the value of attribute shipping_cost.
-
#subtotal ⇒ Object
Returns the value of attribute subtotal.
-
#total ⇒ Object
Returns the value of attribute total.
-
#total_items_discount ⇒ Object
Returns the value of attribute total_items_discount.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
-
.add_item(item, opts = {}) ⇒ ShoppingCart
Add item.
-
.add_item_with_http_info(item, opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Add item.
- .api_client ⇒ Object
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.checkout(order, opts = {}) ⇒ Order
Checkout cart.
-
.checkout_with_http_info(order, opts = {}) ⇒ Array<(Order, Fixnum, Hash)>
Checkout cart.
-
.delete_item(item_id, opts = {}) ⇒ ShoppingCart
Remove item.
-
.delete_item_with_http_info(item_id, opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Remove item.
-
.empty(opts = {}) ⇒ ShoppingCart
Empty cart.
-
.empty_with_http_info(opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Empty cart.
-
.get(opts = {}) ⇒ ShoppingCart
Get cart.
-
.get_with_http_info(opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Get cart.
-
.swagger_types ⇒ Object
Attribute type mapping.
-
.update_item(item_id, item, opts = {}) ⇒ ShoppingCart
Update cart.
-
.update_item_with_http_info(item_id, item, opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Update cart.
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.
- #id ⇒ Object
- #id=(id) ⇒ Object
-
#initialize(attributes = {}) ⇒ ShoppingCart
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 = {}) ⇒ ShoppingCart
Initializes the object
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 131 132 133 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 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 88 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?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'__meta') self. = attributes[:'__meta'] end if attributes.has_key?(:'createdAt') self.created_at = attributes[:'createdAt'] end if attributes.has_key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.has_key?(:'updatedAt') self.updated_at = attributes[:'updatedAt'] end if attributes.has_key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end if attributes.has_key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end if attributes.has_key?(:'subtotal') self.subtotal = attributes[:'subtotal'] end if attributes.has_key?(:'total') self.total = attributes[:'total'] end if attributes.has_key?(:'shippingCost') self.shipping_cost = attributes[:'shippingCost'] end if attributes.has_key?(:'shipping_cost') self.shipping_cost = attributes[:'shipping_cost'] end if attributes.has_key?(:'itemsTaxAmount') self.items_tax_amount = attributes[:'itemsTaxAmount'] end if attributes.has_key?(:'items_tax_amount') self.items_tax_amount = attributes[:'items_tax_amount'] end if attributes.has_key?(:'totalItemsDiscount') self.total_items_discount = attributes[:'totalItemsDiscount'] end if attributes.has_key?(:'total_items_discount') self.total_items_discount = attributes[:'total_items_discount'] end if attributes.has_key?(:'promotions') if (value = attributes[:'promotions']).is_a?(Array) self.promotions = value end end end |
Instance Attribute Details
#__meta ⇒ Object
Returns the value of attribute __meta.
32 33 34 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 32 def @__meta end |
#created_at ⇒ Object
Returns the value of attribute created_at.
34 35 36 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 34 def created_at @created_at end |
#items ⇒ Object
Returns the value of attribute items.
38 39 40 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 38 def items @items end |
#items_tax_amount ⇒ Object
Returns the value of attribute items_tax_amount.
46 47 48 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 46 def items_tax_amount @items_tax_amount end |
#promotions ⇒ Object
Returns the value of attribute promotions.
50 51 52 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 50 def promotions @promotions end |
#shipping_cost ⇒ Object
Returns the value of attribute shipping_cost.
44 45 46 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 44 def shipping_cost @shipping_cost end |
#subtotal ⇒ Object
Returns the value of attribute subtotal.
40 41 42 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 40 def subtotal @subtotal end |
#total ⇒ Object
Returns the value of attribute total.
42 43 44 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 42 def total @total end |
#total_items_discount ⇒ Object
Returns the value of attribute total_items_discount.
48 49 50 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 48 def total_items_discount @total_items_discount end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
36 37 38 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 36 def updated_at @updated_at end |
Class Method Details
.add_item(item, opts = {}) ⇒ ShoppingCart
Add item. Add new item to the shopping cart.
332 333 334 335 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 332 def add_item(item, opts = {}) data, _status_code, _headers = add_item_with_http_info(item, opts) data end |
.add_item_with_http_info(item, opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Add item. Add new item to the shopping cart.
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 342 def add_item_with_http_info(item, opts = {}) if api_client.config.debugging api_client.config.logger.debug 'Calling API: ShoppingCart.add_item ...' end # verify the required parameter 'item' is set if api_client.config.client_side_validation && item.nil? fail ArgumentError, "Missing the required parameter 'item' when calling ShoppingCart.add_item" end # resource path local_var_path = '/shoppingCarts' # query parameters query_params = opts # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = api_client.object_to_http_body(item) auth_names = [] data, status_code, headers = api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ShoppingCart') if api_client.config.debugging api_client.config.logger.debug "API called: ShoppingCart#add_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
.api_client ⇒ Object
319 320 321 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 319 def self.api_client ApiClient.default end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 53 def self.attribute_map { :'id' => :'id', :'__meta' => :'__meta', :'created_at' => :'createdAt', :'updated_at' => :'updatedAt', :'items' => :'items', :'subtotal' => :'subtotal', :'total' => :'total', :'shipping_cost' => :'shippingCost', :'items_tax_amount' => :'itemsTaxAmount', :'total_items_discount' => :'totalItemsDiscount', :'promotions' => :'promotions' } end |
.checkout(order, opts = {}) ⇒ Order
Checkout cart. Checkout cart, Making an order.
386 387 388 389 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 386 def checkout(order, opts = {}) data, _status_code, _headers = checkout_with_http_info(order, opts) data end |
.checkout_with_http_info(order, opts = {}) ⇒ Array<(Order, Fixnum, Hash)>
Checkout cart. Checkout cart, Making an order.
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 396 def checkout_with_http_info(order, opts = {}) if api_client.config.debugging api_client.config.logger.debug 'Calling API: ShoppingCart.checkout ...' end # verify the required parameter 'order' is set if api_client.config.client_side_validation && order.nil? fail ArgumentError, "Missing the required parameter 'order' when calling ShoppingCart.checkout" end # resource path local_var_path = '/shoppingCarts/checkout' # query parameters query_params = opts # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = api_client.object_to_http_body(order) auth_names = [] data, status_code, headers = api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Order') if api_client.config.debugging api_client.config.logger.debug "API called: ShoppingCart#checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
.delete_item(item_id, opts = {}) ⇒ ShoppingCart
Remove item. Remove item from shopping cart
440 441 442 443 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 440 def delete_item(item_id, opts = {}) data, _status_code, _headers = delete_item_with_http_info(item_id, opts) data end |
.delete_item_with_http_info(item_id, opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Remove item. Remove item from shopping cart
450 451 452 453 454 455 456 457 458 459 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 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 450 def delete_item_with_http_info(item_id, opts = {}) if api_client.config.debugging api_client.config.logger.debug 'Calling API: ShoppingCart.delete_item ...' end # verify the required parameter 'item_id' is set if api_client.config.client_side_validation && item_id.nil? fail ArgumentError, "Missing the required parameter 'item_id' when calling ShoppingCart.delete_item" end # resource path local_var_path = '/shoppingCarts/{itemId}'.sub('{' + 'itemId' + '}', item_id.to_s) # query parameters query_params = opts # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ShoppingCart') if api_client.config.debugging api_client.config.logger.debug "API called: ShoppingCart#delete_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
.empty(opts = {}) ⇒ ShoppingCart
Empty cart. Empty the shopping cart.
493 494 495 496 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 493 def empty(opts = {}) data, _status_code, _headers = empty_with_http_info(opts) data end |
.empty_with_http_info(opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Empty cart. Empty the shopping cart.
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 502 def empty_with_http_info(opts = {}) if api_client.config.debugging api_client.config.logger.debug 'Calling API: ShoppingCart.empty ...' end # resource path local_var_path = '/shoppingCarts' # query parameters query_params = opts # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ShoppingCart') if api_client.config.debugging api_client.config.logger.debug "API called: ShoppingCart#empty\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
.get(opts = {}) ⇒ ShoppingCart
Get cart. Retrieve the shopping cart of the current session.
541 542 543 544 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 541 def get(opts = {}) data, _status_code, _headers = get_with_http_info(opts) data end |
.get_with_http_info(opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Get cart. Retrieve the shopping cart of the current session.
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 550 def get_with_http_info(opts = {}) if api_client.config.debugging api_client.config.logger.debug 'Calling API: ShoppingCart.get ...' end # resource path local_var_path = '/shoppingCarts' # query parameters query_params = opts # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ShoppingCart') if api_client.config.debugging api_client.config.logger.debug "API called: ShoppingCart#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
.swagger_types ⇒ Object
Attribute type mapping.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 70 def self.swagger_types { :'id' => :'String', :'__meta' => :'InstanceMeta', :'created_at' => :'DateTime', :'updated_at' => :'DateTime', :'items' => :'Array<LineItem>', :'subtotal' => :'Integer', :'total' => :'Integer', :'shipping_cost' => :'Integer', :'items_tax_amount' => :'Integer', :'total_items_discount' => :'Integer', :'promotions' => :'Array<Promotion>' } end |
.update_item(item_id, item, opts = {}) ⇒ ShoppingCart
Update cart. Update cart item.
591 592 593 594 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 591 def update_item(item_id, item, opts = {}) data, _status_code, _headers = update_item_with_http_info(item_id, item, opts) data end |
.update_item_with_http_info(item_id, item, opts = {}) ⇒ Array<(ShoppingCart, Fixnum, Hash)>
Update cart. Update cart item.
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 602 def update_item_with_http_info(item_id, item, opts = {}) if api_client.config.debugging api_client.config.logger.debug 'Calling API: ShoppingCart.update_item ...' end # verify the required parameter 'item_id' is set if api_client.config.client_side_validation && item_id.nil? fail ArgumentError, "Missing the required parameter 'item_id' when calling ShoppingCart.update_item" end # verify the required parameter 'item' is set if api_client.config.client_side_validation && item.nil? fail ArgumentError, "Missing the required parameter 'item' when calling ShoppingCart.update_item" end # resource path local_var_path = '/shoppingCarts/{itemId}'.sub('{' + 'itemId' + '}', item_id.to_s) # query parameters query_params = opts # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = api_client.object_to_http_body(item) auth_names = [] data, status_code, headers = api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ShoppingCart') if api_client.config.debugging api_client.config.logger.debug "API called: ShoppingCart#update_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 187 def ==(o) return true if self.equal?(o) self.class == o.class && == o. && created_at == o.created_at && updated_at == o.updated_at && items == o.items && subtotal == o.subtotal && total == o.total && shipping_cost == o.shipping_cost && items_tax_amount == o.items_tax_amount && total_items_discount == o.total_items_discount && promotions == o.promotions end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
238 239 240 241 242 243 244 245 246 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 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 238 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 = Tradenity.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
304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 304 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
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 217 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 |
#eql?(o) ⇒ Boolean
204 205 206 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 204 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
210 211 212 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 210 def hash [, created_at, updated_at, items, subtotal, total, shipping_cost, items_tax_amount, total_items_discount, promotions].hash end |
#id ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 21 def id if instance_variable_defined?('@id') && @id != nil @id elsif && .href != nil @id = .href.split('/')[-1] @id else nil end end |
#id=(id) ⇒ Object
17 18 19 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 17 def id=(id) @id = id end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 164 def list_invalid_properties invalid_properties = Array.new if @subtotal.nil? invalid_properties.push('invalid value for "subtotal", subtotal cannot be nil.') end if @total.nil? invalid_properties.push('invalid value for "total", total cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
284 285 286 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 284 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
290 291 292 293 294 295 296 297 298 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 290 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
278 279 280 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 278 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
179 180 181 182 183 |
# File 'lib/tradenity/resources/shopping_cart.rb', line 179 def valid? return false if @subtotal.nil? return false if @total.nil? true end |