Class: SesDashboard::Client
- Inherits:
-
Object
- Object
- SesDashboard::Client
- Defined in:
- lib/ses_dashboard/client.rb
Instance Method Summary collapse
- #get_identity_dkim_attributes(identities) ⇒ Object
- #get_identity_verification_attributes(identities) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #list_identities ⇒ Object
-
#send_email(from:, to:, subject:, body:, configuration_set: nil) ⇒ Object
Sends a plain-text email via SES SendEmail API.
-
#send_quota ⇒ Object
── SES monitoring API calls ─────────────────────────────────────────.
-
#send_statistics ⇒ Object
Returns send data points from the last 14 days.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 |
# File 'lib/ses_dashboard/client.rb', line 5 def initialize( = {}) @options = .dup @ses_client = build_ses_client @cache = {} end |
Instance Method Details
#get_identity_dkim_attributes(identities) ⇒ Object
33 34 35 36 37 |
# File 'lib/ses_dashboard/client.rb', line 33 def get_identity_dkim_attributes(identities) cached(:dkim_attributes, identities.sort.join(",")) do ses_client.get_identity_dkim_attributes(identities: Array(identities)) end end |
#get_identity_verification_attributes(identities) ⇒ Object
27 28 29 30 31 |
# File 'lib/ses_dashboard/client.rb', line 27 def get_identity_verification_attributes(identities) cached(:verification_attributes, identities.sort.join(",")) do ses_client.get_identity_verification_attributes(identities: Array(identities)) end end |
#list_identities ⇒ Object
23 24 25 |
# File 'lib/ses_dashboard/client.rb', line 23 def list_identities cached(:identities) { ses_client.list_identities(types: ["EmailAddress", "Domain"]) } end |
#send_email(from:, to:, subject:, body:, configuration_set: nil) ⇒ Object
Sends a plain-text email via SES SendEmail API. Options: from:, to:, subject:, body:, configuration_set: (optional)
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ses_dashboard/client.rb', line 43 def send_email(from:, to:, subject:, body:, configuration_set: nil) params = { source: from, destination: { to_addresses: [to] }, message: { subject: { data: subject, charset: "UTF-8" }, body: { text: { data: body, charset: "UTF-8" } } } } params[:configuration_set_name] = configuration_set if configuration_set ses_client.send_email(params) end |
#send_quota ⇒ Object
── SES monitoring API calls ─────────────────────────────────────────
13 14 15 |
# File 'lib/ses_dashboard/client.rb', line 13 def send_quota cached(:send_quota) { ses_client.get_send_quota } end |
#send_statistics ⇒ Object
Returns send data points from the last 14 days. The SES v1 API accepts no date parameters — it always returns the last 14 days.
19 20 21 |
# File 'lib/ses_dashboard/client.rb', line 19 def send_statistics cached(:send_statistics) { ses_client.get_send_statistics } end |