ark-email 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +3 -3
  4. data/lib/ark_email/client.rb +4 -0
  5. data/lib/ark_email/models/dns_record.rb +49 -19
  6. data/lib/ark_email/models/domain_create_response.rb +117 -25
  7. data/lib/ark_email/models/domain_list_response.rb +12 -13
  8. data/lib/ark_email/models/domain_retrieve_response.rb +117 -25
  9. data/lib/ark_email/models/domain_verify_response.rb +117 -25
  10. data/lib/ark_email/models/track_domain.rb +6 -2
  11. data/lib/ark_email/models/usage_retrieve_params.rb +14 -0
  12. data/lib/ark_email/models/usage_retrieve_response.rb +270 -0
  13. data/lib/ark_email/models/webhook_create_params.rb +0 -2
  14. data/lib/ark_email/models/webhook_create_response.rb +0 -2
  15. data/lib/ark_email/models/webhook_list_deliveries_params.rb +0 -2
  16. data/lib/ark_email/models/webhook_list_deliveries_response.rb +0 -2
  17. data/lib/ark_email/models/webhook_retrieve_delivery_response.rb +0 -2
  18. data/lib/ark_email/models/webhook_retrieve_response.rb +0 -2
  19. data/lib/ark_email/models/webhook_test_params.rb +0 -2
  20. data/lib/ark_email/models/webhook_update_response.rb +0 -2
  21. data/lib/ark_email/models.rb +2 -0
  22. data/lib/ark_email/resources/usage.rb +51 -0
  23. data/lib/ark_email/version.rb +1 -1
  24. data/lib/ark_email.rb +3 -0
  25. data/rbi/ark_email/client.rbi +3 -0
  26. data/rbi/ark_email/models/dns_record.rbi +57 -22
  27. data/rbi/ark_email/models/domain_create_response.rbi +189 -28
  28. data/rbi/ark_email/models/domain_list_response.rbi +13 -19
  29. data/rbi/ark_email/models/domain_retrieve_response.rbi +191 -28
  30. data/rbi/ark_email/models/domain_verify_response.rbi +189 -28
  31. data/rbi/ark_email/models/track_domain.rbi +4 -2
  32. data/rbi/ark_email/models/usage_retrieve_params.rbi +27 -0
  33. data/rbi/ark_email/models/usage_retrieve_response.rbi +511 -0
  34. data/rbi/ark_email/models/webhook_create_params.rbi +0 -10
  35. data/rbi/ark_email/models/webhook_create_response.rbi +0 -10
  36. data/rbi/ark_email/models/webhook_list_deliveries_params.rbi +0 -10
  37. data/rbi/ark_email/models/webhook_list_deliveries_response.rbi +0 -10
  38. data/rbi/ark_email/models/webhook_retrieve_delivery_response.rbi +0 -10
  39. data/rbi/ark_email/models/webhook_retrieve_response.rbi +0 -10
  40. data/rbi/ark_email/models/webhook_test_params.rbi +0 -10
  41. data/rbi/ark_email/models/webhook_update_response.rbi +0 -10
  42. data/rbi/ark_email/models.rbi +2 -0
  43. data/rbi/ark_email/resources/usage.rbi +40 -0
  44. data/sig/ark_email/client.rbs +2 -0
  45. data/sig/ark_email/models/dns_record.rbs +5 -0
  46. data/sig/ark_email/models/domain_create_response.rbs +27 -20
  47. data/sig/ark_email/models/domain_list_response.rbs +4 -16
  48. data/sig/ark_email/models/domain_retrieve_response.rbs +27 -20
  49. data/sig/ark_email/models/domain_verify_response.rbs +27 -20
  50. data/sig/ark_email/models/usage_retrieve_params.rbs +15 -0
  51. data/sig/ark_email/models/usage_retrieve_response.rbs +212 -0
  52. data/sig/ark_email/models/webhook_create_params.rbs +0 -4
  53. data/sig/ark_email/models/webhook_create_response.rbs +0 -4
  54. data/sig/ark_email/models/webhook_list_deliveries_params.rbs +0 -4
  55. data/sig/ark_email/models/webhook_list_deliveries_response.rbs +0 -4
  56. data/sig/ark_email/models/webhook_retrieve_delivery_response.rbs +0 -4
  57. data/sig/ark_email/models/webhook_retrieve_response.rbs +0 -4
  58. data/sig/ark_email/models/webhook_test_params.rbs +0 -4
  59. data/sig/ark_email/models/webhook_update_response.rbs +0 -4
  60. data/sig/ark_email/models.rbs +2 -0
  61. data/sig/ark_email/resources/usage.rbs +11 -0
  62. metadata +11 -2
@@ -27,82 +27,174 @@ module ArkEmail
27
27
  # @see ArkEmail::Models::DomainVerifyResponse#data
28
28
  class Data < ArkEmail::Internal::Type::BaseModel
29
29
  # @!attribute id
30
- # Domain ID
30
+ # Unique domain identifier
31
31
  #
32
- # @return [String]
33
- required :id, String
32
+ # @return [Integer]
33
+ required :id, Integer
34
34
 
35
35
  # @!attribute created_at
36
+ # Timestamp when the domain was added
36
37
  #
37
38
  # @return [Time]
38
39
  required :created_at, Time, api_name: :createdAt
39
40
 
40
41
  # @!attribute dns_records
42
+ # DNS records that must be added to your domain's DNS settings. Null if records
43
+ # are not yet generated.
44
+ #
45
+ # **Important:** The `name` field contains the relative hostname that you should
46
+ # enter in your DNS provider. Most DNS providers auto-append the zone name, so you
47
+ # only need to enter the relative part.
48
+ #
49
+ # For subdomains like `mail.example.com`, the zone is `example.com`, so:
50
+ #
51
+ # - SPF `name` would be `mail` (not `@`)
52
+ # - DKIM `name` would be `ark-xyz._domainkey.mail`
53
+ # - Return Path `name` would be `psrp.mail`
41
54
  #
42
- # @return [ArkEmail::Models::DomainVerifyResponse::Data::DNSRecords]
55
+ # @return [ArkEmail::Models::DomainVerifyResponse::Data::DNSRecords, nil]
43
56
  required :dns_records,
44
57
  -> { ArkEmail::Models::DomainVerifyResponse::Data::DNSRecords },
45
- api_name: :dnsRecords
58
+ api_name: :dnsRecords,
59
+ nil?: true
46
60
 
47
61
  # @!attribute name
48
- # Domain name
62
+ # The domain name used for sending emails
49
63
  #
50
64
  # @return [String]
51
65
  required :name, String
52
66
 
53
67
  # @!attribute uuid
68
+ # UUID of the domain
54
69
  #
55
70
  # @return [String]
56
71
  required :uuid, String
57
72
 
58
73
  # @!attribute verified
59
- # Whether DNS is verified
74
+ # Whether all DNS records (SPF, DKIM, Return Path) are correctly configured.
75
+ # Domain must be verified before sending emails.
60
76
  #
61
77
  # @return [Boolean]
62
78
  required :verified, ArkEmail::Internal::Type::Boolean
63
79
 
64
80
  # @!attribute verified_at
65
- # When the domain was verified (null if not verified)
81
+ # Timestamp when the domain ownership was verified, or null if not yet verified
66
82
  #
67
83
  # @return [Time, nil]
68
84
  optional :verified_at, Time, api_name: :verifiedAt, nil?: true
69
85
 
70
86
  # @!method initialize(id:, created_at:, dns_records:, name:, uuid:, verified:, verified_at: nil)
71
- # @param id [String] Domain ID
87
+ # Some parameter documentations has been truncated, see
88
+ # {ArkEmail::Models::DomainVerifyResponse::Data} for more details.
72
89
  #
73
- # @param created_at [Time]
90
+ # @param id [Integer] Unique domain identifier
74
91
  #
75
- # @param dns_records [ArkEmail::Models::DomainVerifyResponse::Data::DNSRecords]
92
+ # @param created_at [Time] Timestamp when the domain was added
76
93
  #
77
- # @param name [String] Domain name
94
+ # @param dns_records [ArkEmail::Models::DomainVerifyResponse::Data::DNSRecords, nil] DNS records that must be added to your domain's DNS settings. Null if records ar
78
95
  #
79
- # @param uuid [String]
96
+ # @param name [String] The domain name used for sending emails
80
97
  #
81
- # @param verified [Boolean] Whether DNS is verified
98
+ # @param uuid [String] UUID of the domain
82
99
  #
83
- # @param verified_at [Time, nil] When the domain was verified (null if not verified)
100
+ # @param verified [Boolean] Whether all DNS records (SPF, DKIM, Return Path) are correctly configured. Domai
101
+ #
102
+ # @param verified_at [Time, nil] Timestamp when the domain ownership was verified, or null if not yet verified
84
103
 
85
104
  # @see ArkEmail::Models::DomainVerifyResponse::Data#dns_records
86
105
  class DNSRecords < ArkEmail::Internal::Type::BaseModel
87
106
  # @!attribute dkim
107
+ # A DNS record that needs to be configured in your domain's DNS settings.
108
+ #
109
+ # The `name` field contains the relative hostname to enter in your DNS provider
110
+ # (which auto-appends the zone). The `fullName` field contains the complete
111
+ # fully-qualified domain name (FQDN) for reference.
112
+ #
113
+ # **Example for subdomain `mail.example.com`:**
114
+ #
115
+ # - `name`: `"mail"` (what you enter in DNS provider)
116
+ # - `fullName`: `"mail.example.com"` (the complete hostname)
88
117
  #
89
- # @return [ArkEmail::Models::DNSRecord]
90
- required :dkim, -> { ArkEmail::DNSRecord }
118
+ # **Example for root domain `example.com`:**
119
+ #
120
+ # - `name`: `"@"` (DNS shorthand for apex/root)
121
+ # - `fullName`: `"example.com"`
122
+ #
123
+ # @return [ArkEmail::Models::DNSRecord, nil]
124
+ optional :dkim, -> { ArkEmail::DNSRecord }, nil?: true
91
125
 
92
126
  # @!attribute return_path
127
+ # A DNS record that needs to be configured in your domain's DNS settings.
128
+ #
129
+ # The `name` field contains the relative hostname to enter in your DNS provider
130
+ # (which auto-appends the zone). The `fullName` field contains the complete
131
+ # fully-qualified domain name (FQDN) for reference.
132
+ #
133
+ # **Example for subdomain `mail.example.com`:**
134
+ #
135
+ # - `name`: `"mail"` (what you enter in DNS provider)
136
+ # - `fullName`: `"mail.example.com"` (the complete hostname)
137
+ #
138
+ # **Example for root domain `example.com`:**
139
+ #
140
+ # - `name`: `"@"` (DNS shorthand for apex/root)
141
+ # - `fullName`: `"example.com"`
93
142
  #
94
- # @return [ArkEmail::Models::DNSRecord]
95
- required :return_path, -> { ArkEmail::DNSRecord }, api_name: :returnPath
143
+ # @return [ArkEmail::Models::DNSRecord, nil]
144
+ optional :return_path, -> { ArkEmail::DNSRecord }, api_name: :returnPath, nil?: true
96
145
 
97
146
  # @!attribute spf
147
+ # A DNS record that needs to be configured in your domain's DNS settings.
98
148
  #
99
- # @return [ArkEmail::Models::DNSRecord]
100
- required :spf, -> { ArkEmail::DNSRecord }
149
+ # The `name` field contains the relative hostname to enter in your DNS provider
150
+ # (which auto-appends the zone). The `fullName` field contains the complete
151
+ # fully-qualified domain name (FQDN) for reference.
152
+ #
153
+ # **Example for subdomain `mail.example.com`:**
154
+ #
155
+ # - `name`: `"mail"` (what you enter in DNS provider)
156
+ # - `fullName`: `"mail.example.com"` (the complete hostname)
157
+ #
158
+ # **Example for root domain `example.com`:**
159
+ #
160
+ # - `name`: `"@"` (DNS shorthand for apex/root)
161
+ # - `fullName`: `"example.com"`
162
+ #
163
+ # @return [ArkEmail::Models::DNSRecord, nil]
164
+ optional :spf, -> { ArkEmail::DNSRecord }, nil?: true
165
+
166
+ # @!attribute zone
167
+ # The DNS zone (registrable domain) where records should be added. This is the
168
+ # root domain that your DNS provider manages. For `mail.example.com`, the zone is
169
+ # `example.com`. For `example.co.uk`, the zone is `example.co.uk`.
170
+ #
171
+ # @return [String, nil]
172
+ optional :zone, String
101
173
 
102
- # @!method initialize(dkim:, return_path:, spf:)
103
- # @param dkim [ArkEmail::Models::DNSRecord]
104
- # @param return_path [ArkEmail::Models::DNSRecord]
105
- # @param spf [ArkEmail::Models::DNSRecord]
174
+ # @!method initialize(dkim: nil, return_path: nil, spf: nil, zone: nil)
175
+ # Some parameter documentations has been truncated, see
176
+ # {ArkEmail::Models::DomainVerifyResponse::Data::DNSRecords} for more details.
177
+ #
178
+ # DNS records that must be added to your domain's DNS settings. Null if records
179
+ # are not yet generated.
180
+ #
181
+ # **Important:** The `name` field contains the relative hostname that you should
182
+ # enter in your DNS provider. Most DNS providers auto-append the zone name, so you
183
+ # only need to enter the relative part.
184
+ #
185
+ # For subdomains like `mail.example.com`, the zone is `example.com`, so:
186
+ #
187
+ # - SPF `name` would be `mail` (not `@`)
188
+ # - DKIM `name` would be `ark-xyz._domainkey.mail`
189
+ # - Return Path `name` would be `psrp.mail`
190
+ #
191
+ # @param dkim [ArkEmail::Models::DNSRecord, nil] A DNS record that needs to be configured in your domain's DNS settings.
192
+ #
193
+ # @param return_path [ArkEmail::Models::DNSRecord, nil] A DNS record that needs to be configured in your domain's DNS settings.
194
+ #
195
+ # @param spf [ArkEmail::Models::DNSRecord, nil] A DNS record that needs to be configured in your domain's DNS settings.
196
+ #
197
+ # @param zone [String] The DNS zone (registrable domain) where records should be added.
106
198
  end
107
199
  end
108
200
  end
@@ -16,7 +16,8 @@ module ArkEmail
16
16
  required :created_at, Time, api_name: :createdAt
17
17
 
18
18
  # @!attribute dns_ok
19
- # Whether DNS is correctly configured
19
+ # Whether the tracking CNAME record is correctly configured. Must be true to use
20
+ # tracking features.
20
21
  #
21
22
  # @return [Boolean]
22
23
  required :dns_ok, ArkEmail::Internal::Type::Boolean, api_name: :dnsOk
@@ -94,11 +95,14 @@ module ArkEmail
94
95
  optional :updated_at, Time, api_name: :updatedAt, nil?: true
95
96
 
96
97
  # @!method initialize(id:, created_at:, dns_ok:, domain_id:, full_name:, name:, ssl_enabled:, track_clicks:, track_opens:, dns_checked_at: nil, dns_error: nil, dns_record: nil, dns_status: nil, excluded_click_domains: nil, updated_at: nil)
98
+ # Some parameter documentations has been truncated, see
99
+ # {ArkEmail::Models::TrackDomain} for more details.
100
+ #
97
101
  # @param id [String] Track domain ID
98
102
  #
99
103
  # @param created_at [Time] When the track domain was created
100
104
  #
101
- # @param dns_ok [Boolean] Whether DNS is correctly configured
105
+ # @param dns_ok [Boolean] Whether the tracking CNAME record is correctly configured. Must be true to use t
102
106
  #
103
107
  # @param domain_id [String] ID of the parent sending domain
104
108
  #
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ArkEmail
4
+ module Models
5
+ # @see ArkEmail::Resources::Usage#retrieve
6
+ class UsageRetrieveParams < ArkEmail::Internal::Type::BaseModel
7
+ extend ArkEmail::Internal::Type::RequestParameters::Converter
8
+ include ArkEmail::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [ArkEmail::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,270 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ArkEmail
4
+ module Models
5
+ # @see ArkEmail::Resources::Usage#retrieve
6
+ class UsageRetrieveResponse < ArkEmail::Internal::Type::BaseModel
7
+ # @!attribute data
8
+ # Current usage and limit information
9
+ #
10
+ # @return [ArkEmail::Models::UsageRetrieveResponse::Data]
11
+ required :data, -> { ArkEmail::Models::UsageRetrieveResponse::Data }
12
+
13
+ # @!attribute meta
14
+ #
15
+ # @return [ArkEmail::Models::APIMeta]
16
+ required :meta, -> { ArkEmail::APIMeta }
17
+
18
+ # @!attribute success
19
+ #
20
+ # @return [Boolean, true]
21
+ required :success, const: true
22
+
23
+ # @!method initialize(data:, meta:, success: true)
24
+ # Account usage and limits response
25
+ #
26
+ # @param data [ArkEmail::Models::UsageRetrieveResponse::Data] Current usage and limit information
27
+ #
28
+ # @param meta [ArkEmail::Models::APIMeta]
29
+ #
30
+ # @param success [Boolean, true]
31
+
32
+ # @see ArkEmail::Models::UsageRetrieveResponse#data
33
+ class Data < ArkEmail::Internal::Type::BaseModel
34
+ # @!attribute billing
35
+ # Billing and credit information
36
+ #
37
+ # @return [ArkEmail::Models::UsageRetrieveResponse::Data::Billing, nil]
38
+ required :billing, -> { ArkEmail::Models::UsageRetrieveResponse::Data::Billing }, nil?: true
39
+
40
+ # @!attribute rate_limit
41
+ # API rate limit status
42
+ #
43
+ # @return [ArkEmail::Models::UsageRetrieveResponse::Data::RateLimit]
44
+ required :rate_limit,
45
+ -> { ArkEmail::Models::UsageRetrieveResponse::Data::RateLimit },
46
+ api_name: :rateLimit
47
+
48
+ # @!attribute send_limit
49
+ # Email send limit status (hourly cap)
50
+ #
51
+ # @return [ArkEmail::Models::UsageRetrieveResponse::Data::SendLimit, nil]
52
+ required :send_limit,
53
+ -> { ArkEmail::Models::UsageRetrieveResponse::Data::SendLimit },
54
+ api_name: :sendLimit,
55
+ nil?: true
56
+
57
+ # @!method initialize(billing:, rate_limit:, send_limit:)
58
+ # Current usage and limit information
59
+ #
60
+ # @param billing [ArkEmail::Models::UsageRetrieveResponse::Data::Billing, nil] Billing and credit information
61
+ #
62
+ # @param rate_limit [ArkEmail::Models::UsageRetrieveResponse::Data::RateLimit] API rate limit status
63
+ #
64
+ # @param send_limit [ArkEmail::Models::UsageRetrieveResponse::Data::SendLimit, nil] Email send limit status (hourly cap)
65
+
66
+ # @see ArkEmail::Models::UsageRetrieveResponse::Data#billing
67
+ class Billing < ArkEmail::Internal::Type::BaseModel
68
+ # @!attribute auto_recharge
69
+ # Auto-recharge configuration
70
+ #
71
+ # @return [ArkEmail::Models::UsageRetrieveResponse::Data::Billing::AutoRecharge]
72
+ required :auto_recharge,
73
+ -> { ArkEmail::Models::UsageRetrieveResponse::Data::Billing::AutoRecharge },
74
+ api_name: :autoRecharge
75
+
76
+ # @!attribute credit_balance
77
+ # Current credit balance as formatted string (e.g., "25.50")
78
+ #
79
+ # @return [String]
80
+ required :credit_balance, String, api_name: :creditBalance
81
+
82
+ # @!attribute credit_balance_cents
83
+ # Current credit balance in cents for precise calculations
84
+ #
85
+ # @return [Integer]
86
+ required :credit_balance_cents, Integer, api_name: :creditBalanceCents
87
+
88
+ # @!attribute has_payment_method
89
+ # Whether a payment method is configured
90
+ #
91
+ # @return [Boolean]
92
+ required :has_payment_method, ArkEmail::Internal::Type::Boolean, api_name: :hasPaymentMethod
93
+
94
+ # @!method initialize(auto_recharge:, credit_balance:, credit_balance_cents:, has_payment_method:)
95
+ # Billing and credit information
96
+ #
97
+ # @param auto_recharge [ArkEmail::Models::UsageRetrieveResponse::Data::Billing::AutoRecharge] Auto-recharge configuration
98
+ #
99
+ # @param credit_balance [String] Current credit balance as formatted string (e.g., "25.50")
100
+ #
101
+ # @param credit_balance_cents [Integer] Current credit balance in cents for precise calculations
102
+ #
103
+ # @param has_payment_method [Boolean] Whether a payment method is configured
104
+
105
+ # @see ArkEmail::Models::UsageRetrieveResponse::Data::Billing#auto_recharge
106
+ class AutoRecharge < ArkEmail::Internal::Type::BaseModel
107
+ # @!attribute amount
108
+ # Amount to recharge when triggered
109
+ #
110
+ # @return [String]
111
+ required :amount, String
112
+
113
+ # @!attribute enabled
114
+ # Whether auto-recharge is enabled
115
+ #
116
+ # @return [Boolean]
117
+ required :enabled, ArkEmail::Internal::Type::Boolean
118
+
119
+ # @!attribute threshold
120
+ # Balance threshold that triggers recharge
121
+ #
122
+ # @return [String]
123
+ required :threshold, String
124
+
125
+ # @!method initialize(amount:, enabled:, threshold:)
126
+ # Auto-recharge configuration
127
+ #
128
+ # @param amount [String] Amount to recharge when triggered
129
+ #
130
+ # @param enabled [Boolean] Whether auto-recharge is enabled
131
+ #
132
+ # @param threshold [String] Balance threshold that triggers recharge
133
+ end
134
+ end
135
+
136
+ # @see ArkEmail::Models::UsageRetrieveResponse::Data#rate_limit
137
+ class RateLimit < ArkEmail::Internal::Type::BaseModel
138
+ # @!attribute limit
139
+ # Maximum requests allowed per period
140
+ #
141
+ # @return [Integer]
142
+ required :limit, Integer
143
+
144
+ # @!attribute period
145
+ # Time period for the limit
146
+ #
147
+ # @return [Symbol, ArkEmail::Models::UsageRetrieveResponse::Data::RateLimit::Period]
148
+ required :period, enum: -> { ArkEmail::Models::UsageRetrieveResponse::Data::RateLimit::Period }
149
+
150
+ # @!attribute remaining
151
+ # Requests remaining in current window
152
+ #
153
+ # @return [Integer]
154
+ required :remaining, Integer
155
+
156
+ # @!attribute reset
157
+ # Unix timestamp when the limit resets
158
+ #
159
+ # @return [Integer]
160
+ required :reset, Integer
161
+
162
+ # @!method initialize(limit:, period:, remaining:, reset:)
163
+ # API rate limit status
164
+ #
165
+ # @param limit [Integer] Maximum requests allowed per period
166
+ #
167
+ # @param period [Symbol, ArkEmail::Models::UsageRetrieveResponse::Data::RateLimit::Period] Time period for the limit
168
+ #
169
+ # @param remaining [Integer] Requests remaining in current window
170
+ #
171
+ # @param reset [Integer] Unix timestamp when the limit resets
172
+
173
+ # Time period for the limit
174
+ #
175
+ # @see ArkEmail::Models::UsageRetrieveResponse::Data::RateLimit#period
176
+ module Period
177
+ extend ArkEmail::Internal::Type::Enum
178
+
179
+ SECOND = :second
180
+
181
+ # @!method self.values
182
+ # @return [Array<Symbol>]
183
+ end
184
+ end
185
+
186
+ # @see ArkEmail::Models::UsageRetrieveResponse::Data#send_limit
187
+ class SendLimit < ArkEmail::Internal::Type::BaseModel
188
+ # @!attribute approaching
189
+ # Whether approaching the limit (>90%)
190
+ #
191
+ # @return [Boolean]
192
+ required :approaching, ArkEmail::Internal::Type::Boolean
193
+
194
+ # @!attribute exceeded
195
+ # Whether the limit has been exceeded
196
+ #
197
+ # @return [Boolean]
198
+ required :exceeded, ArkEmail::Internal::Type::Boolean
199
+
200
+ # @!attribute limit
201
+ # Maximum emails allowed per hour (null = unlimited)
202
+ #
203
+ # @return [Integer, nil]
204
+ required :limit, Integer, nil?: true
205
+
206
+ # @!attribute period
207
+ # Time period for the limit
208
+ #
209
+ # @return [Symbol, ArkEmail::Models::UsageRetrieveResponse::Data::SendLimit::Period]
210
+ required :period, enum: -> { ArkEmail::Models::UsageRetrieveResponse::Data::SendLimit::Period }
211
+
212
+ # @!attribute remaining
213
+ # Emails remaining in current period (null if unlimited)
214
+ #
215
+ # @return [Integer, nil]
216
+ required :remaining, Integer, nil?: true
217
+
218
+ # @!attribute resets_at
219
+ # ISO timestamp when the limit window resets (top of next hour)
220
+ #
221
+ # @return [Time]
222
+ required :resets_at, Time, api_name: :resetsAt
223
+
224
+ # @!attribute usage_percent
225
+ # Usage as a percentage (null if unlimited)
226
+ #
227
+ # @return [Float, nil]
228
+ required :usage_percent, Float, api_name: :usagePercent, nil?: true
229
+
230
+ # @!attribute used
231
+ # Emails sent in current period
232
+ #
233
+ # @return [Integer]
234
+ required :used, Integer
235
+
236
+ # @!method initialize(approaching:, exceeded:, limit:, period:, remaining:, resets_at:, usage_percent:, used:)
237
+ # Email send limit status (hourly cap)
238
+ #
239
+ # @param approaching [Boolean] Whether approaching the limit (>90%)
240
+ #
241
+ # @param exceeded [Boolean] Whether the limit has been exceeded
242
+ #
243
+ # @param limit [Integer, nil] Maximum emails allowed per hour (null = unlimited)
244
+ #
245
+ # @param period [Symbol, ArkEmail::Models::UsageRetrieveResponse::Data::SendLimit::Period] Time period for the limit
246
+ #
247
+ # @param remaining [Integer, nil] Emails remaining in current period (null if unlimited)
248
+ #
249
+ # @param resets_at [Time] ISO timestamp when the limit window resets (top of next hour)
250
+ #
251
+ # @param usage_percent [Float, nil] Usage as a percentage (null if unlimited)
252
+ #
253
+ # @param used [Integer] Emails sent in current period
254
+
255
+ # Time period for the limit
256
+ #
257
+ # @see ArkEmail::Models::UsageRetrieveResponse::Data::SendLimit#period
258
+ module Period
259
+ extend ArkEmail::Internal::Type::Enum
260
+
261
+ HOUR = :hour
262
+
263
+ # @!method self.values
264
+ # @return [Array<Symbol>]
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
270
+ end
@@ -75,8 +75,6 @@ module ArkEmail
75
75
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
76
76
  MESSAGE_LOADED = :MessageLoaded
77
77
  DOMAIN_DNS_ERROR = :DomainDNSError
78
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
79
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
80
78
 
81
79
  # @!method self.values
82
80
  # @return [Array<Symbol>]
@@ -101,8 +101,6 @@ module ArkEmail
101
101
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
102
102
  MESSAGE_LOADED = :MessageLoaded
103
103
  DOMAIN_DNS_ERROR = :DomainDNSError
104
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
105
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
106
104
 
107
105
  # @!method self.values
108
106
  # @return [Array<Symbol>]
@@ -70,8 +70,6 @@ module ArkEmail
70
70
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
71
71
  MESSAGE_LOADED = :MessageLoaded
72
72
  DOMAIN_DNS_ERROR = :DomainDNSError
73
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
74
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
75
73
 
76
74
  # @!method self.values
77
75
  # @return [Array<Symbol>]
@@ -144,8 +144,6 @@ module ArkEmail
144
144
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
145
145
  MESSAGE_LOADED = :MessageLoaded
146
146
  DOMAIN_DNS_ERROR = :DomainDNSError
147
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
148
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
149
147
 
150
148
  # @!method self.values
151
149
  # @return [Array<Symbol>]
@@ -144,8 +144,6 @@ module ArkEmail
144
144
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
145
145
  MESSAGE_LOADED = :MessageLoaded
146
146
  DOMAIN_DNS_ERROR = :DomainDNSError
147
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
148
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
149
147
 
150
148
  # @!method self.values
151
149
  # @return [Array<Symbol>]
@@ -101,8 +101,6 @@ module ArkEmail
101
101
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
102
102
  MESSAGE_LOADED = :MessageLoaded
103
103
  DOMAIN_DNS_ERROR = :DomainDNSError
104
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
105
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
106
104
 
107
105
  # @!method self.values
108
106
  # @return [Array<Symbol>]
@@ -30,8 +30,6 @@ module ArkEmail
30
30
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
31
31
  MESSAGE_LOADED = :MessageLoaded
32
32
  DOMAIN_DNS_ERROR = :DomainDNSError
33
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
34
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
35
33
 
36
34
  # @!method self.values
37
35
  # @return [Array<Symbol>]
@@ -101,8 +101,6 @@ module ArkEmail
101
101
  MESSAGE_LINK_CLICKED = :MessageLinkClicked
102
102
  MESSAGE_LOADED = :MessageLoaded
103
103
  DOMAIN_DNS_ERROR = :DomainDNSError
104
- SEND_LIMIT_APPROACHING = :SendLimitApproaching
105
- SEND_LIMIT_EXCEEDED = :SendLimitExceeded
106
104
 
107
105
  # @!method self.values
108
106
  # @return [Array<Symbol>]
@@ -99,6 +99,8 @@ module ArkEmail
99
99
 
100
100
  TrackingVerifyParams = ArkEmail::Models::TrackingVerifyParams
101
101
 
102
+ UsageRetrieveParams = ArkEmail::Models::UsageRetrieveParams
103
+
102
104
  WebhookCreateParams = ArkEmail::Models::WebhookCreateParams
103
105
 
104
106
  WebhookDeleteParams = ArkEmail::Models::WebhookDeleteParams
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ArkEmail
4
+ module Resources
5
+ class Usage
6
+ # Returns current usage and limit information for your account.
7
+ #
8
+ # This endpoint is designed for:
9
+ #
10
+ # - **AI agents/MCP servers:** Check constraints before planning batch operations
11
+ # - **Monitoring dashboards:** Display current usage status
12
+ # - **Rate limit awareness:** Know remaining capacity before making requests
13
+ #
14
+ # **Response includes:**
15
+ #
16
+ # - `rateLimit` - API request rate limit (requests per second)
17
+ # - `sendLimit` - Email sending limit (emails per hour)
18
+ # - `billing` - Credit balance and auto-recharge configuration
19
+ #
20
+ # **Notes:**
21
+ #
22
+ # - This request counts against your rate limit
23
+ # - `sendLimit` may be null if Postal is temporarily unavailable
24
+ # - `billing` is null if billing is not configured
25
+ # - Send limit resets at the top of each hour
26
+ #
27
+ # @overload retrieve(request_options: {})
28
+ #
29
+ # @param request_options [ArkEmail::RequestOptions, Hash{Symbol=>Object}, nil]
30
+ #
31
+ # @return [ArkEmail::Models::UsageRetrieveResponse]
32
+ #
33
+ # @see ArkEmail::Models::UsageRetrieveParams
34
+ def retrieve(params = {})
35
+ @client.request(
36
+ method: :get,
37
+ path: "usage",
38
+ model: ArkEmail::Models::UsageRetrieveResponse,
39
+ options: params[:request_options]
40
+ )
41
+ end
42
+
43
+ # @api private
44
+ #
45
+ # @param client [ArkEmail::Client]
46
+ def initialize(client:)
47
+ @client = client
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ArkEmail
4
- VERSION = "0.14.0"
4
+ VERSION = "0.15.0"
5
5
  end