Module: Voxbone::Ordering
- Included in:
- Voxbone
- Defined in:
- lib/voxbone/ordering.rb
Instance Method Summary collapse
-
#add_to_cart(**options) ⇒ Object
Add to Cart.
-
#checkout_cart(**options) ⇒ Object
Checkout Cart.
-
#create_cart(**options) ⇒ Object
Create Cart.
Instance Method Details
#add_to_cart(**options) ⇒ Object
Add to Cart
‘add_to_cart` allows you to add items (order_products) to a specific cart before checking out the cart. Different product types (DID, CAPACITY or CREDIT_PACKAGE) can be added into one single cart.
Parameters:
options - Type: Hash. Parameters used to add an item to a cart.
- :cart_identifier - Type: String. Identifies the cart and is returned
by the createCart method or can be retrieved with the list_cart
method. (Required)
- :did_cart_item - Type: Hash. Corresponds to DIDs (VoxDID or Vox800).
Note that you can specify multiple DID groups by repeating the query
parameter.
- :did_group_ids - Type: Integer (multiple). To add one or multiple
DIDs to your cart, you need to specify a valid ID for the DID group
of the DIDs.
- :quantity - Type: Integer. Amount of DIDs from that DID group.
- :capacity_cart_item - Type: Hash. Corresponds to capacity (VoxTRUNK
channels).
- :zone - To add channels to your cart, you need to specify a valid
zone (A, B, C or WORLDWIDE). Only one capacity_cart_item can be
added per request and capacity must be ordered in multiple of 10.
- :quantity - Amount of channels required.
- :credit_package_cart_item - Type: Hash. Corresponds to prepaid
credits.
- :credit_package_id - Type: String. To add prepaid credits to your
cart, you need to specify a valid ID for the credit_package
- :quantity - Type: Integer. The amount of prepaid credits required.
51 52 53 54 |
# File 'lib/voxbone/ordering.rb', line 51 def add_to_cart(**) cart_id = .delete(:cart_id) send_post "/ordering/cart/#{cart_id}/product", ** end |
#checkout_cart(**options) ⇒ Object
Checkout Cart
‘checkout_cart` allows you to checkout a cart and place an order for all the products contained in the cart. You can then retrieve your orders using the list_order method.
Parameters: options - Type: Hash. Parameters used to checkout a cart.
- :cart_identifier - The identifier of your cart which is formed of a
fixed string such as “apiv3:60677:” and an ID which is incremented
each time a new cart is created.
67 68 69 70 71 72 73 74 |
# File 'lib/voxbone/ordering.rb', line 67 def checkout_cart(**) # For some reason the API docs indicate that "cartIdentifier" should be # given as a dynamic segment AND a query string. cart_id = .delete(:cart_id) send_get( "/ordering/cart/#{cart_id}/checkout", **, cart_identifier: cart_id) end |
#create_cart(**options) ⇒ Object
Create Cart
‘create_cart` is a method that allows you to create a cart. Note: The creation of a cart depends on your own business logic, but you’ll always need to create at least one cart to place an order (‘checkout_cart`). You can place multiple orders per cart or you can create separate carts for each order. Note that different product types (DID, Capacity or prepaid credits) can be added into a single cart.
options - Type: Hash. Parameters used to create the cart.
customer_reference - A parameter that can be used for your own
reference.
description - The description or name you want to give
the cart.
17 18 19 |
# File 'lib/voxbone/ordering.rb', line 17 def create_cart(**) send_put '/ordering/cart', ** end |