Class: Repull::BillingApi
- Inherits:
-
Object
- Object
- Repull::BillingApi
- Defined in:
- lib/repull/api/billing_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_billing_checkout(opts = {}) ⇒ nil
Create checkout session Redirect user to Stripe checkout.
-
#create_billing_checkout_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create checkout session Redirect user to Stripe checkout.
-
#get_usage_logs(opts = {}) ⇒ GetUsageLogs200Response
List API request logs Cursor-paginated raw API request log for the authenticated workspace, newest first.
-
#get_usage_logs_with_http_info(opts = {}) ⇒ Array<(GetUsageLogs200Response, Integer, Hash)>
List API request logs Cursor-paginated raw API request log for the authenticated workspace, newest first.
-
#get_usage_summary(opts = {}) ⇒ GetUsageSummary200Response
Get usage summary Aggregated usage over the requested
range— tier + plan limits, quota used/remaining, next reset, a per-operation breakdown (request/error counts, error rate, avg latency), a daily timeline, status-class distribution, and range totals. -
#get_usage_summary_with_http_info(opts = {}) ⇒ Array<(GetUsageSummary200Response, Integer, Hash)>
Get usage summary Aggregated usage over the requested `range` — tier + plan limits, quota used/remaining, next reset, a per-operation breakdown (request/error counts, error rate, avg latency), a daily timeline, status-class distribution, and range totals.
-
#get_usage_tier(opts = {}) ⇒ GetUsageTier200Response
Get tier and quota Lightweight current-tier snapshot for status badges and quota meters — plan limits (monthly requests, daily AI requests, dynamic-pricing listings), the amount used, the amount remaining, and the next reset.
-
#get_usage_tier_with_http_info(opts = {}) ⇒ Array<(GetUsageTier200Response, Integer, Hash)>
Get tier and quota Lightweight current-tier snapshot for status badges and quota meters — plan limits (monthly requests, daily AI requests, dynamic-pricing listings), the amount used, the amount remaining, and the next reset.
-
#initialize(api_client = ApiClient.default) ⇒ BillingApi
constructor
A new instance of BillingApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ BillingApi
Returns a new instance of BillingApi.
19 20 21 |
# File 'lib/repull/api/billing_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/repull/api/billing_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_billing_checkout(opts = {}) ⇒ nil
Create checkout session Redirect user to Stripe checkout.
27 28 29 30 |
# File 'lib/repull/api/billing_api.rb', line 27 def create_billing_checkout(opts = {}) create_billing_checkout_with_http_info(opts) nil end |
#create_billing_checkout_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create checkout session Redirect user to Stripe checkout.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/repull/api/billing_api.rb', line 37 def create_billing_checkout_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.create_billing_checkout ...' end # resource path local_var_path = '/v1/billing' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_billing_checkout_request']) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"BillingApi.create_billing_checkout", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#create_billing_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_usage_logs(opts = {}) ⇒ GetUsageLogs200Response
List API request logs
Cursor-paginated raw API request log for the authenticated workspace, newest first. Filter by time range, operation id(s), status class, or free-text q. Walk pages with cursor from pagination.next_cursor until pagination.has_more is false; offset is accepted as a shallow alias (deep walks must use cursor).
96 97 98 99 |
# File 'lib/repull/api/billing_api.rb', line 96 def get_usage_logs(opts = {}) data, _status_code, _headers = get_usage_logs_with_http_info(opts) data end |
#get_usage_logs_with_http_info(opts = {}) ⇒ Array<(GetUsageLogs200Response, Integer, Hash)>
List API request logs Cursor-paginated raw API request log for the authenticated workspace, newest first. Filter by time `range`, `operation` id(s), status class, or free-text `q`. Walk pages with `cursor` from `pagination.next_cursor` until `pagination.has_more` is `false`; `offset` is accepted as a shallow alias (deep walks must use `cursor`).
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/repull/api/billing_api.rb', line 113 def get_usage_logs_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_usage_logs ...' end allowable_values = ["1h", "24h", "7d", "30d"] if @api_client.config.client_side_validation && opts[:'range'] && !allowable_values.include?(opts[:'range']) fail ArgumentError, "invalid value for \"range\", must be one of #{allowable_values}" end allowable_values = ["2xx", "3xx", "4xx", "5xx"] if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status']) fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BillingApi.get_usage_logs, must be smaller than or equal to 200.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BillingApi.get_usage_logs, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] > 10000 fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling BillingApi.get_usage_logs, must be smaller than or equal to 10000.' end if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0 fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling BillingApi.get_usage_logs, must be greater than or equal to 0.' end # resource path local_var_path = '/v1/usage/logs' # query parameters query_params = opts[:query_params] || {} query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil? query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'include_total'] = opts[:'include_total'] if !opts[:'include_total'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetUsageLogs200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"BillingApi.get_usage_logs", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_usage_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_usage_summary(opts = {}) ⇒ GetUsageSummary200Response
Get usage summary
Aggregated usage over the requested range — tier + plan limits, quota used/remaining, next reset, a per-operation breakdown (request/error counts, error rate, avg latency), a daily timeline, status-class distribution, and range totals.
194 195 196 197 |
# File 'lib/repull/api/billing_api.rb', line 194 def get_usage_summary(opts = {}) data, _status_code, _headers = get_usage_summary_with_http_info(opts) data end |
#get_usage_summary_with_http_info(opts = {}) ⇒ Array<(GetUsageSummary200Response, Integer, Hash)>
Get usage summary Aggregated usage over the requested `range` — tier + plan limits, quota used/remaining, next reset, a per-operation breakdown (request/error counts, error rate, avg latency), a daily timeline, status-class distribution, and range totals.
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/repull/api/billing_api.rb', line 204 def get_usage_summary_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_usage_summary ...' end allowable_values = ["7d", "30d", "90d"] if @api_client.config.client_side_validation && opts[:'range'] && !allowable_values.include?(opts[:'range']) fail ArgumentError, "invalid value for \"range\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/usage/summary' # query parameters query_params = opts[:query_params] || {} query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetUsageSummary200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"BillingApi.get_usage_summary", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_usage_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_usage_tier(opts = {}) ⇒ GetUsageTier200Response
Get tier and quota
Lightweight current-tier snapshot for status badges and quota meters — plan limits (monthly requests, daily AI requests, dynamic-pricing listings), the amount used, the amount remaining, and the next reset. null limits mean unlimited on that dimension.
257 258 259 260 |
# File 'lib/repull/api/billing_api.rb', line 257 def get_usage_tier(opts = {}) data, _status_code, _headers = get_usage_tier_with_http_info(opts) data end |
#get_usage_tier_with_http_info(opts = {}) ⇒ Array<(GetUsageTier200Response, Integer, Hash)>
Get tier and quota Lightweight current-tier snapshot for status badges and quota meters — plan limits (monthly requests, daily AI requests, dynamic-pricing listings), the amount used, the amount remaining, and the next reset. `null` limits mean unlimited on that dimension.
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/repull/api/billing_api.rb', line 266 def get_usage_tier_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_usage_tier ...' end # resource path local_var_path = '/v1/usage/tier' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetUsageTier200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"BillingApi.get_usage_tier", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_usage_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |