Class: WebPay::Customer
- Inherits:
-
ApiResource
- Object
- ApiResource
- WebPay::Customer
- Defined in:
- lib/webpay/customer.rb
Instance Method Summary collapse
-
#all(params = {}) ⇒ CustomerResponseList
List customers filtered by params.
-
#create(params = {}) ⇒ CustomerResponse
Create a customer object with given parameters.
-
#delete(params = {}) ⇒ CustomerResponse
Delete an existing customer.
-
#delete_active_card(params = {}) ⇒ CustomerResponse
Delete a card data of a customer.
-
#retrieve(params = {}) ⇒ CustomerResponse
Retrieve a customer object by customer id.
-
#update(params = {}) ⇒ CustomerResponse
Update an existing customer with specified parameters.
Methods inherited from ApiResource
Constructor Details
This class inherits a constructor from WebPay::ApiResource
Instance Method Details
#all(params = {}) ⇒ CustomerResponseList
List customers filtered by params.
47 48 49 50 51 |
# File 'lib/webpay/customer.rb', line 47 def all(params = {}) req = WebPay::BasicListRequest.create(params) raw_response = @client._request(:get, 'customers', req) WebPay::CustomerResponseList.new(raw_response) end |
#create(params = {}) ⇒ CustomerResponse
Create a customer object with given parameters.
6 7 8 9 10 |
# File 'lib/webpay/customer.rb', line 6 def create(params = {}) req = WebPay::CustomerRequestCreate.create(params) raw_response = @client._request(:post, 'customers', req) WebPay::CustomerResponse.new(raw_response) end |
#delete(params = {}) ⇒ CustomerResponse
Delete an existing customer.
37 38 39 40 41 |
# File 'lib/webpay/customer.rb', line 37 def delete(params = {}) req = WebPay::CustomerIdRequest.create(params) raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s, req) WebPay::CustomerResponse.new(raw_response) end |
#delete_active_card(params = {}) ⇒ CustomerResponse
Delete a card data of a customer.
57 58 59 60 61 |
# File 'lib/webpay/customer.rb', line 57 def delete_active_card(params = {}) req = WebPay::CustomerIdRequest.create(params) raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s + '/' + 'active_card', req) WebPay::CustomerResponse.new(raw_response) end |
#retrieve(params = {}) ⇒ CustomerResponse
Retrieve a customer object by customer id. If the customer is already deleted, “deleted” attribute becomes true.
17 18 19 20 21 |
# File 'lib/webpay/customer.rb', line 17 def retrieve(params = {}) req = WebPay::CustomerIdRequest.create(params) raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req) WebPay::CustomerResponse.new(raw_response) end |
#update(params = {}) ⇒ CustomerResponse
Update an existing customer with specified parameters.
27 28 29 30 31 |
# File 'lib/webpay/customer.rb', line 27 def update(params = {}) req = WebPay::CustomerRequestUpdate.create(params) raw_response = @client._request(:post, 'customers' + '/' + req.id.to_s, req) WebPay::CustomerResponse.new(raw_response) end |