Class: PaypalServerSdk::CartInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::CartInformation
- Defined in:
- lib/paypal_server_sdk/models/cart_information.rb
Overview
The cart information.
Instance Attribute Summary collapse
-
#item_details ⇒ Array[ItemDetails]
An array of item details.
-
#paypal_invoice_id ⇒ String
The ID of the invoice.
-
#tax_inclusive ⇒ TrueClass | FalseClass
Indicates whether the item amount or the shipping amount already includes tax.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(item_details: SKIP, tax_inclusive: false, paypal_invoice_id: SKIP) ⇒ CartInformation
constructor
A new instance of CartInformation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(item_details: SKIP, tax_inclusive: false, paypal_invoice_id: SKIP) ⇒ CartInformation
Returns a new instance of CartInformation.
48 49 50 51 52 53 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 48 def initialize(item_details: SKIP, tax_inclusive: false, paypal_invoice_id: SKIP) @item_details = item_details unless item_details == SKIP @tax_inclusive = tax_inclusive unless tax_inclusive == SKIP @paypal_invoice_id = paypal_invoice_id unless paypal_invoice_id == SKIP end |
Instance Attribute Details
#item_details ⇒ Array[ItemDetails]
An array of item details.
14 15 16 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 14 def item_details @item_details end |
#paypal_invoice_id ⇒ String
The ID of the invoice. Appears for only PayPal-generated invoices.
23 24 25 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 23 def paypal_invoice_id @paypal_invoice_id end |
#tax_inclusive ⇒ TrueClass | FalseClass
Indicates whether the item amount or the shipping amount already includes tax.
19 20 21 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 19 def tax_inclusive @tax_inclusive end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it item_details = nil unless hash['item_details'].nil? item_details = [] hash['item_details'].each do |structure| item_details << (ItemDetails.from_hash(structure) if structure) end end item_details = SKIP unless hash.key?('item_details') tax_inclusive = hash['tax_inclusive'] ||= false paypal_invoice_id = hash.key?('paypal_invoice_id') ? hash['paypal_invoice_id'] : SKIP # Create object from extracted values. CartInformation.new(item_details: item_details, tax_inclusive: tax_inclusive, paypal_invoice_id: paypal_invoice_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['item_details'] = 'item_details' @_hash['tax_inclusive'] = 'tax_inclusive' @_hash['paypal_invoice_id'] = 'paypal_invoice_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 41 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 35 def self.optionals %w[ item_details tax_inclusive paypal_invoice_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
88 89 90 91 92 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 88 def inspect class_name = self.class.name.split('::').last "<#{class_name} item_details: #{@item_details.inspect}, tax_inclusive:"\ " #{@tax_inclusive.inspect}, paypal_invoice_id: #{@paypal_invoice_id.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
81 82 83 84 85 |
# File 'lib/paypal_server_sdk/models/cart_information.rb', line 81 def to_s class_name = self.class.name.split('::').last "<#{class_name} item_details: #{@item_details}, tax_inclusive: #{@tax_inclusive},"\ " paypal_invoice_id: #{@paypal_invoice_id}>" end |