Module: Drip::Client::Orders

Included in:
Drip::Client
Defined in:
lib/drip/client/orders.rb

Instance Method Summary collapse

Instance Method Details

#create_or_update_order(email, options = {}) ⇒ Object

Public: Create or update an order.

email - Required. The String email address of the subscriber. options - Required. A Hash of additional order options. Refer to the

Drip API docs for the required schema.

Returns a Drip::Response. See developer.drip.com/#orders



14
15
16
17
# File 'lib/drip/client/orders.rb', line 14

def create_or_update_order(email, options = {})
  data = options.merge(email: email)
  make_json_api_request :post, "v2/#{}/orders", private_generate_resource("orders", data)
end

#create_or_update_orders(orders) ⇒ Object

Public: Create or update a batch of orders.

orders - Required. An Array with between 1 and 1000 objects containing order data

Returns a Drip::Response. See developer.drip.com/#create-or-update-a-batch-of-orders



25
26
27
# File 'lib/drip/client/orders.rb', line 25

def create_or_update_orders(orders)
  make_json_api_request :post, "v2/#{}/orders/batches", private_generate_resource("batches", { "orders" => orders })
end

#create_or_update_refund(options) ⇒ Object

Public: Create or update a refund.

options - Required. A Hash of refund properties

amount              - Required. The amount of the refund.
provider            - Required. The provider for the Order being refunded.
order_upstream_id   - Required. The upstream_id for the Order being refunded.
upstream_id         - The unique id of refund in the order management system.
note                - A note about the refund.
processed_at        - The String time at which the refund was processed in
                      ISO-8601 format.

Returns a Drip::Response. See developer.drip.com/#create-or-update-a-refund



42
43
44
# File 'lib/drip/client/orders.rb', line 42

def create_or_update_refund(options)
  make_json_api_request :post, "v2/#{}/refunds", private_generate_resource("refunds", options)
end