Class: Dodopayments::Resources::Blocklist::Customers

Inherits:
Object
  • Object
show all
Defined in:
lib/dodopayments/resources/blocklist/customers.rb,
lib/dodopayments/resources/blocklist/customers/notes.rb,
sig/dodopayments/resources/blocklist/customers.rbs,
sig/dodopayments/resources/blocklist/customers/notes.rbs

Defined Under Namespace

Classes: Notes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Customers

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



100
101
102
103
# File 'lib/dodopayments/resources/blocklist/customers.rb', line 100

def initialize(client:)
  @client = client
  @notes = Dodopayments::Resources::Blocklist::Customers::Notes.new(client: client)
end

Instance Attribute Details

#notesDodopayments::Resources::Blocklist::Customers::Notes (readonly)



8
9
10
# File 'lib/dodopayments/resources/blocklist/customers.rb', line 8

def notes
  @notes
end

Instance Method Details

#create(create_blocked_customer_request:, request_options: {}) ⇒ Dodopayments::Models::Blocklist::BlockedCustomer



18
19
20
21
22
23
24
25
26
27
# File 'lib/dodopayments/resources/blocklist/customers.rb', line 18

def create(params)
  parsed, options = Dodopayments::Blocklist::CustomerCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "blocklist/customers",
    body: parsed[:create_blocked_customer_request],
    model: Dodopayments::Blocklist::BlockedCustomer,
    options: options
  )
end

#delete(entry_id, request_options: {}) ⇒ nil



88
89
90
91
92
93
94
95
# File 'lib/dodopayments/resources/blocklist/customers.rb', line 88

def delete(entry_id, params = {})
  @client.request(
    method: :delete,
    path: ["blocklist/customers/%1$s", entry_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(blocked_by_email: nil, created_at_gte: nil, created_at_lte: nil, identifier: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Blocklist::BlockedCustomer>



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/dodopayments/resources/blocklist/customers.rb', line 66

def list(params = {})
  parsed, options = Dodopayments::Blocklist::CustomerListParams.dump_request(params)
  query = Dodopayments::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "blocklist/customers",
    query: query,
    page: Dodopayments::Internal::DefaultPageNumberPagination,
    model: Dodopayments::Blocklist::BlockedCustomer,
    options: options
  )
end

#retrieve(entry_id, request_options: {}) ⇒ Dodopayments::Models::Blocklist::BlockedCustomer



38
39
40
41
42
43
44
45
# File 'lib/dodopayments/resources/blocklist/customers.rb', line 38

def retrieve(entry_id, params = {})
  @client.request(
    method: :get,
    path: ["blocklist/customers/%1$s", entry_id],
    model: Dodopayments::Blocklist::BlockedCustomer,
    options: params[:request_options]
  )
end