Class: ModernTreasury::Resources::Holds

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/resources/holds.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Holds

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Holds.

Parameters:



121
122
123
# File 'lib/modern_treasury/resources/holds.rb', line 121

def initialize(client:)
  @client = client
end

Instance Method Details

#create(status: , target_id: , target_type: , metadata: nil, reason: nil, request_options: {}) ⇒ ModernTreasury::Models::HoldCreateResponse

Create a new hold

Parameters:

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/modern_treasury/resources/holds.rb', line 25

def create(params)
  parsed, options = ModernTreasury::HoldCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/holds",
    body: parsed,
    model: ModernTreasury::Models::HoldCreateResponse,
    options: options
  )
end

#list(after_cursor: nil, metadata: nil, per_page: nil, status: nil, target_id: nil, target_type: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::HoldListResponse>

Some parameter documentations has been truncated, see Models::HoldListParams for more details.

Get a list of holds.

Parameters:

  • after_cursor (String, nil)
  • metadata (Hash{Symbol=>String})

    For example, if you want to query for records with metadata key ‘Type` and value

  • per_page (Integer)
  • status (Symbol, ModernTreasury::Models::HoldListParams::Status, nil)

    Translation missing: en.openapi.descriptions.payment_order.query_params.status

  • target_id (String, nil)

    Translation missing: en.openapi.descriptions.payment_order.query_params.target_i

  • target_type (Symbol, ModernTreasury::Models::HoldListParams::TargetType, nil)

    Translation missing: en.openapi.descriptions.payment_order.query_params.target_t

  • request_options (ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/modern_treasury/resources/holds.rb', line 106

def list(params = {})
  parsed, options = ModernTreasury::HoldListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "api/holds",
    query: parsed,
    page: ModernTreasury::Internal::Page,
    model: ModernTreasury::Models::HoldListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ ModernTreasury::Models::HoldRetrieveResponse

Get a specific hold

Parameters:

Returns:

See Also:



47
48
49
50
51
52
53
54
# File 'lib/modern_treasury/resources/holds.rb', line 47

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["api/holds/%1$s", id],
    model: ModernTreasury::Models::HoldRetrieveResponse,
    options: params[:request_options]
  )
end

#update(id, status: , resolution: nil, request_options: {}) ⇒ ModernTreasury::Models::HoldUpdateResponse

Update a hold

Parameters:

Returns:

See Also:



71
72
73
74
75
76
77
78
79
80
# File 'lib/modern_treasury/resources/holds.rb', line 71

def update(id, params)
  parsed, options = ModernTreasury::HoldUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/holds/%1$s", id],
    body: parsed,
    model: ModernTreasury::Models::HoldUpdateResponse,
    options: options
  )
end