Class: BaremetricsAPI::Endpoint::Customers

Inherits:
Object
  • Object
show all
Defined in:
lib/baremetrics_api/endpoint/customers.rb

Constant Summary collapse

PATH =
'customers'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Customers

Returns a new instance of Customers.



6
7
8
# File 'lib/baremetrics_api/endpoint/customers.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#create_customer(source_id:, customer_params:) ⇒ Object



26
27
28
# File 'lib/baremetrics_api/endpoint/customers.rb', line 26

def create_customer(source_id:, customer_params:)
  JSON.parse(create_customer_request(source_id, customer_params).body).with_indifferent_access
end

#delete_customer(oid:, source_id:) ⇒ Object



30
31
32
# File 'lib/baremetrics_api/endpoint/customers.rb', line 30

def delete_customer(oid:, source_id:)
  JSON.parse(delete_customer_request(oid, source_id).body).with_indifferent_access
end

#list_customer_events(source_id:, oid:, page: nil) ⇒ Object



18
19
20
# File 'lib/baremetrics_api/endpoint/customers.rb', line 18

def list_customer_events(source_id:, oid:, page: nil)
  JSON.parse(list_customer_events_request(source_id, oid, page).body).with_indifferent_access
end

#list_customers(source_id: nil, search: nil, page: nil) ⇒ Object



10
11
12
# File 'lib/baremetrics_api/endpoint/customers.rb', line 10

def list_customers(source_id: nil, search: nil, page: nil)
  JSON.parse(list_customers_request(source_id, search, page).body).with_indifferent_access
end

#show_customer(source_id:, oid:) ⇒ Object



14
15
16
# File 'lib/baremetrics_api/endpoint/customers.rb', line 14

def show_customer(source_id:, oid:)
  JSON.parse(show_customer_request(source_id, oid).body).with_indifferent_access
end

#update_customer(customer_oid:, source_id:, customer_params:) ⇒ Object



22
23
24
# File 'lib/baremetrics_api/endpoint/customers.rb', line 22

def update_customer(customer_oid:, source_id:, customer_params:)
  JSON.parse(update_customer_request(customer_oid, source_id, customer_params).body).with_indifferent_access
end