Module: Unit::Customer
- Defined in:
- lib/unit/models/customer/customer.rb,
lib/unit/models/customer/list_customer_params.rb,
lib/unit/models/customer/archive_customer_request.rb,
lib/unit/models/customer/add_authorized_users_request.rb,
lib/unit/models/customer/patch_business_customer_request.rb,
lib/unit/models/customer/remove_authorized_users_request.rb,
lib/unit/models/customer/patch_individual_customer_request.rb
Defined Under Namespace
Classes: AddAuthorizedUsersRequest, ArchiveCustomerRequest, ListCustomerParams, PatchBusinessCustomerRequest, PatchIndividualCustomerRequest, RemoveAuthorizedUsersRequest
Constant Summary collapse
- CUSTOMER_LIST_LIMIT =
100
- CUSTOMER_LIST_OFFSET =
0
Class Method Summary collapse
-
.add_authorized_users(customer_id:, authorized_users:) ⇒ Object
Add authorized users by calling Unit’s API.
-
.archive_customer(customer_id:, reason: nil) ⇒ Object
Archive customer by calling Unit’s API.
-
.get_customer(customer_id) ⇒ UnitResponse, UnitError
Get customer by calling Unit’s API.
-
.list_customers(offset: CUSTOMER_LIST_OFFSET, limit: CUSTOMER_LIST_LIMIT, email: nil, tags: nil, status: nil, query: nil, sort: nil) ⇒ Object
List customers by calling Unit’s API.
-
.remove_authorized_users(customer_id:, authorized_users:) ⇒ Object
Remove authorized users by calling Unit’s API.
-
.update_business_customer(customer_id:, address: nil, phone: nil, contact: nil, authorized_users: nil, dba: nil, tags: nil) ⇒ UnitResponse, UnitError
Update business customer by calling Unit’s API.
-
.update_individual_customer(customer_id:, address: nil, phone: nil, email: nil, dba: nil, authorized_users: nil, tags: nil, jwt_subject: nil) ⇒ Object
Update individual customer by calling Unit’s API.
Class Method Details
.add_authorized_users(customer_id:, authorized_users:) ⇒ Object
Add authorized users by calling Unit’s API
81 82 83 84 |
# File 'lib/unit/models/customer/customer.rb', line 81 def (customer_id:, authorized_users:) request = AddAuthorizedUsersRequest.new(customer_id, ) Unit::Resource::CustomerResource.(request) end |
.archive_customer(customer_id:, reason: nil) ⇒ Object
Archive customer by calling Unit’s API
72 73 74 75 |
# File 'lib/unit/models/customer/customer.rb', line 72 def archive_customer(customer_id:, reason: nil) request = ArchiveCustomerRequest.new(customer_id, reason) Unit::Resource::CustomerResource.archive(request) end |
.get_customer(customer_id) ⇒ UnitResponse, UnitError
Get customer by calling Unit’s API
50 51 52 |
# File 'lib/unit/models/customer/customer.rb', line 50 def get_customer(customer_id) Unit::Resource::CustomerResource.get(customer_id) end |
.list_customers(offset: CUSTOMER_LIST_OFFSET, limit: CUSTOMER_LIST_LIMIT, email: nil, tags: nil, status: nil, query: nil, sort: nil) ⇒ Object
List customers by calling Unit’s API
63 64 65 66 |
# File 'lib/unit/models/customer/customer.rb', line 63 def list_customers(offset: CUSTOMER_LIST_OFFSET, limit: CUSTOMER_LIST_LIMIT, email: nil, tags: nil, status: nil, query: nil, sort: nil) request = ListCustomerParams.new(offset, limit, email, , status, query, sort) Unit::Resource::CustomerResource.list(request) end |
.remove_authorized_users(customer_id:, authorized_users:) ⇒ Object
Remove authorized users by calling Unit’s API
90 91 92 93 |
# File 'lib/unit/models/customer/customer.rb', line 90 def (customer_id:, authorized_users:) request = RemoveAuthorizedUsersRequest.new(customer_id, ) Unit::Resource::CustomerResource.(request) end |
.update_business_customer(customer_id:, address: nil, phone: nil, contact: nil, authorized_users: nil, dba: nil, tags: nil) ⇒ UnitResponse, UnitError
Update business customer by calling Unit’s API
41 42 43 44 |
# File 'lib/unit/models/customer/customer.rb', line 41 def update_business_customer(customer_id:, address: nil, phone: nil, contact: nil, authorized_users: nil, dba: nil, tags: nil) request = PatchBusinessCustomerRequest.new(customer_id, address, phone, contact, , dba, ) Unit::Resource::CustomerResource.update(request) end |
.update_individual_customer(customer_id:, address: nil, phone: nil, email: nil, dba: nil, authorized_users: nil, tags: nil, jwt_subject: nil) ⇒ Object
Update individual customer by calling Unit’s API
26 27 28 29 |
# File 'lib/unit/models/customer/customer.rb', line 26 def update_individual_customer(customer_id:, address: nil, phone: nil, email: nil, dba: nil, authorized_users: nil, tags: nil, jwt_subject: nil) request = PatchIndividualCustomerRequest.new(customer_id, address, phone, email, dba, , , jwt_subject) Unit::Resource::CustomerResource.update(request) end |