Class: Dodopayments::Resources::Webhooks::Headers

Inherits:
Object
  • Object
show all
Defined in:
lib/dodopayments/resources/webhooks/headers.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Headers

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 Headers.

Parameters:



53
54
55
# File 'lib/dodopayments/resources/webhooks/headers.rb', line 53

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(webhook_id, request_options: {}) ⇒ Dodopayments::Models::Webhooks::HeaderRetrieveResponse

Get a webhook by id

Parameters:

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/dodopayments/resources/webhooks/headers.rb', line 17

def retrieve(webhook_id, params = {})
  @client.request(
    method: :get,
    path: ["webhooks/%1$s/headers", webhook_id],
    model: Dodopayments::Models::Webhooks::HeaderRetrieveResponse,
    options: params[:request_options]
  )
end

#update(webhook_id, headers:, request_options: {}) ⇒ nil

Patch a webhook by id

Parameters:

  • webhook_id (String)
  • headers (Hash{Symbol=>String})

    Object of header-value pair to update or add

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

Returns:

  • (nil)

See Also:



39
40
41
42
43
44
45
46
47
48
# File 'lib/dodopayments/resources/webhooks/headers.rb', line 39

def update(webhook_id, params)
  parsed, options = Dodopayments::Webhooks::HeaderUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["webhooks/%1$s/headers", webhook_id],
    body: parsed,
    model: NilClass,
    options: options
  )
end