Class: TrueTrial::Resources::Cancellations

Inherits:
Object
  • Object
show all
Defined in:
lib/truetrial/resources/cancellations.rb

Overview

Provides access to cancellation-related API endpoints.

Instance Method Summary collapse

Constructor Details

#initialize(http_client) ⇒ Cancellations

Returns a new instance of Cancellations.



7
8
9
# File 'lib/truetrial/resources/cancellations.rb', line 7

def initialize(http_client)
  @http = http_client
end

Instance Method Details

#create(order_id, data) ⇒ Hash

Creates a cancellation for an order.

Parameters:

  • order_id (String)

    the order ULID

  • data (Hash)

    cancellation attributes (reason, etc.)

Returns:

  • (Hash)

    the created cancellation



16
17
18
# File 'lib/truetrial/resources/cancellations.rb', line 16

def create(order_id, data)
  @http.post("/orders/#{order_id}/cancellations", body: data)
end

#get(order_id) ⇒ Hash

Retrieves the cancellation for an order.

Parameters:

  • order_id (String)

    the order ULID

Returns:

  • (Hash)

    the cancellation



24
25
26
# File 'lib/truetrial/resources/cancellations.rb', line 24

def get(order_id)
  @http.get("/orders/#{order_id}/cancellations")
end