Class: Dodopayments::Resources::Customers::Emails
- Inherits:
-
Object
- Object
- Dodopayments::Resources::Customers::Emails
- Defined in:
- lib/dodopayments/resources/customers/emails.rb,
sig/dodopayments/resources/customers/emails.rbs
Instance Method Summary collapse
-
#initialize(client:) ⇒ Emails
constructor
private
A new instance of Emails.
-
#list(customer_id, page_number: nil, page_size: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Customers::EmailLogItem>
Returns every transactional email sent to this customer in the last 180 days, newest first, with its delivery outcome.
-
#retrieve_body(email_log_id, customer_id:, request_options: {}) ⇒ Dodopayments::Models::Customers::EmailBody
Returns the email exactly as it was sent, plus the reason it failed when it did.
Constructor Details
#initialize(client:) ⇒ Emails
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 Emails.
70 71 72 |
# File 'lib/dodopayments/resources/customers/emails.rb', line 70 def initialize(client:) @client = client end |
Instance Method Details
#list(customer_id, page_number: nil, page_size: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Customers::EmailLogItem>
Returns every transactional email sent to this customer in the last 180 days, newest first, with its delivery outcome. Delivery status comes from the email provider and is as fresh as replication, typically seconds.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dodopayments/resources/customers/emails.rb', line 24 def list(customer_id, params = {}) parsed, = Dodopayments::Customers::EmailListParams.dump_request(params) query = Dodopayments::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/%1$s/emails", customer_id], query: query, page: Dodopayments::Internal::DefaultPageNumberPagination, model: Dodopayments::Customers::EmailLogItem, options: ) end |
#retrieve_body(email_log_id, customer_id:, request_options: {}) ⇒ Dodopayments::Models::Customers::EmailBody
Returns the email exactly as it was sent, plus the reason it failed when it did. Some emails have no body to show: an authentication email carries a live login token, a blocked email never reached the provider, and the provider clears bodies at 180 days.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/dodopayments/resources/customers/emails.rb', line 53 def retrieve_body(email_log_id, params) parsed, = Dodopayments::Customers::EmailRetrieveBodyParams.dump_request(params) customer_id = parsed.delete(:customer_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["customers/%1$s/emails/%2$s/body", customer_id, email_log_id], model: Dodopayments::Customers::EmailBody, options: ) end |