Class: Amocrm::Resources::CustomerTransactions
- Inherits:
-
Object
- Object
- Amocrm::Resources::CustomerTransactions
- Defined in:
- lib/amocrm/resources/customer_transactions.rb
Instance Method Summary collapse
-
#create(customer_id, body:, accrue_bonus: nil, request_options: {}) ⇒ Amocrm::Models::CustomerTransactionCreateResponse::CustomerTransactionCreateResponse, Amocrm::Models::CustomerTransactionCreateResponse::Problem
Create transactions for a customer.
-
#delete_by_id(transaction_id, customer_id:, request_options: {}) ⇒ Object, Amocrm::Models::CustomerTransactionDeleteByIDResponse::Problem
Delete a transaction for a customer.
-
#initialize(client:) ⇒ CustomerTransactions
constructor
private
A new instance of CustomerTransactions.
-
#list(filter: nil, limit: nil, page: nil, request_options: {}) ⇒ Amocrm::Models::CustomerTransactionListResponse::CustomerTransactionListResponse, Amocrm::Models::CustomerTransactionListResponse::Problem
Get list of transactions.
-
#list_by_customer(customer_id, filter: nil, limit: nil, page: nil, request_options: {}) ⇒ Amocrm::Models::CustomerTransactionListByCustomerResponse::CustomerTransactionListResponse, Amocrm::Models::CustomerTransactionListByCustomerResponse::Problem
Get list of transactions for a customer.
Constructor Details
#initialize(client:) ⇒ CustomerTransactions
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 CustomerTransactions.
111 112 113 |
# File 'lib/amocrm/resources/customer_transactions.rb', line 111 def initialize(client:) @client = client end |
Instance Method Details
#create(customer_id, body:, accrue_bonus: nil, request_options: {}) ⇒ Amocrm::Models::CustomerTransactionCreateResponse::CustomerTransactionCreateResponse, Amocrm::Models::CustomerTransactionCreateResponse::Problem
Create transactions for a customer.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/amocrm/resources/customer_transactions.rb', line 21 def create(customer_id, params) parsed, = Amocrm::CustomerTransactionCreateParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed.except(:body)) @client.request( method: :post, path: ["api/v4/customers/%1$s/transactions", customer_id], query: query, body: parsed[:body], model: Amocrm::Models::CustomerTransactionCreateResponse, options: ) end |
#delete_by_id(transaction_id, customer_id:, request_options: {}) ⇒ Object, Amocrm::Models::CustomerTransactionDeleteByIDResponse::Problem
Delete a transaction for a customer.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/amocrm/resources/customer_transactions.rb', line 69 def delete_by_id(transaction_id, params) parsed, = Amocrm::CustomerTransactionDeleteByIDParams.dump_request(params) customer_id = parsed.delete(:customer_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/v4/customers/%1$s/transactions/%2$s", customer_id, transaction_id], model: Amocrm::Models::CustomerTransactionDeleteByIDResponse, options: ) end |
#list(filter: nil, limit: nil, page: nil, request_options: {}) ⇒ Amocrm::Models::CustomerTransactionListResponse::CustomerTransactionListResponse, Amocrm::Models::CustomerTransactionListResponse::Problem
Get list of transactions.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/amocrm/resources/customer_transactions.rb', line 46 def list(params = {}) parsed, = Amocrm::CustomerTransactionListParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/v4/customers/transactions", query: query, model: Amocrm::Models::CustomerTransactionListResponse, options: ) end |
#list_by_customer(customer_id, filter: nil, limit: nil, page: nil, request_options: {}) ⇒ Amocrm::Models::CustomerTransactionListByCustomerResponse::CustomerTransactionListResponse, Amocrm::Models::CustomerTransactionListByCustomerResponse::Problem
Get list of transactions for a customer.
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/amocrm/resources/customer_transactions.rb', line 96 def list_by_customer(customer_id, params = {}) parsed, = Amocrm::CustomerTransactionListByCustomerParams.dump_request(params) query = Amocrm::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v4/customers/%1$s/transactions", customer_id], query: query, model: Amocrm::Models::CustomerTransactionListByCustomerResponse, options: ) end |