Class: TerminalShop::Models::CartAPI

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/terminal_shop/models/cart.rb

Defined Under Namespace

Classes: Amount, Item, Shipping

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id: , product_variant_id: , quantity: , subtotal: ) ⇒ Object

Some parameter documentations has been truncated, see Item for more details.

An item in the current Terminal shop user’s cart.

Parameters:

  • id (String) (defaults to: )

    Unique object identifier.

  • product_variant_id (String) (defaults to: )

    ID of the product variant for this item in the current user’s cart.

  • quantity (Integer) (defaults to: )

    Quantity of the item in the current user’s cart.

  • subtotal (Integer) (defaults to: )

    Subtotal of the item in the current user’s cart, in cents (USD).



# File 'lib/terminal_shop/models/cart.rb', line 42

Instance Attribute Details

#address_idString?

ID of the shipping address selected on the current user’s cart.

Returns:

  • (String, nil)


28
# File 'lib/terminal_shop/models/cart.rb', line 28

optional :address_id, String, api_name: :addressID

#amountTerminalShop::Models::CartAPI::Amount

The subtotal and shipping amounts for the current user’s cart.



10
# File 'lib/terminal_shop/models/cart.rb', line 10

required :amount, -> { TerminalShop::CartAPI::Amount }

#card_idString?

ID of the card selected on the current user’s cart.

Returns:

  • (String, nil)


34
# File 'lib/terminal_shop/models/cart.rb', line 34

optional :card_id, String, api_name: :cardID

#itemsArray<TerminalShop::Models::CartAPI::Item>

An array of items in the current user’s cart.



16
# File 'lib/terminal_shop/models/cart.rb', line 16

required :items, -> { TerminalShop::Internal::Type::ArrayOf[TerminalShop::CartAPI::Item] }

#shippingTerminalShop::Models::CartAPI::Shipping?

Shipping information for the current user’s cart.



40
# File 'lib/terminal_shop/models/cart.rb', line 40

optional :shipping, -> { TerminalShop::CartAPI::Shipping }

#subtotalInteger

The subtotal of all items in the current user’s cart, in cents (USD).

Returns:

  • (Integer)


22
# File 'lib/terminal_shop/models/cart.rb', line 22

required :subtotal, Integer