Class: Modulr::API::CustomersService
- Inherits:
-
Service
- Object
- Service
- Modulr::API::CustomersService
show all
- Defined in:
- lib/modulr/api/customers_service.rb
Instance Attribute Summary
Attributes inherited from Service
#client
Instance Method Summary
collapse
Methods inherited from Service
#format_datetime, #initialize
Instance Method Details
#create(type:, legal_entity:, **opts) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/modulr/api/customers_service.rb', line 15
def create(type:, legal_entity:, **opts)
payload = {
type: type,
legalEntity: legal_entity,
}
payload[:externalReference] = opts[:external_reference] if opts[:external_reference]
payload[:name] = opts[:name] if opts[:name]
payload[:companyRegNumber] = opts[:company_reg_number] if opts[:company_reg_number]
payload[:registeredAddress] = opts[:registered_address] if opts[:registered_address]
payload[:tradingAddress] = opts[:trading_address] if opts[:trading_address]
payload[:industryCode] = opts[:industry_code] if opts[:industry_code]
payload[:tcsVersion] = opts[:tcs_version] if opts[:tcs_version]
payload[:expectedMonthlySpend] = opts[:expected_monthly_spend] if opts[:expected_monthly_spend]
payload[:associates] = opts[:associates] if opts[:associates]
payload[:documentInfo] = opts[:document_info] if opts[:document_info]
payload[:provisionalCustomerId] = opts[:provisional_customer_id] if opts[:provisional_customer_id]
payload[:customerTrust] = opts[:customer_trust] if opts[:customer_trust]
payload[:taxProfile] = opts[:tax_profile] if opts[:tax_profile]
response = client.post("/customers", payload)
attributes = response.body
Resources::Customers::Customer.new(response, attributes)
end
|
#find(id:) ⇒ Object
8
9
10
11
12
13
|
# File 'lib/modulr/api/customers_service.rb', line 8
def find(id:)
response = client.get("/customers/#{id}")
attributes = response.body
Resources::Customers::Customer.new(response, attributes)
end
|