Class: Stripe::Billing::CreditGrant
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Billing::CreditGrant
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/billing/credit_grant.rb
Overview
A credit grant is an API resource that documents the allocation of some billing credits to a customer.
Related guide: [Billing credits](docs.stripe.com/billing/subscriptions/usage-based/billing-credits)
Defined Under Namespace
Classes: Amount, ApplicabilityConfig, CreateParams, ExpireParams, ListParams, UpdateParams, VoidGrantParams
Constant Summary collapse
- OBJECT_NAME =
"billing.credit_grant"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Attribute for field amount.
-
#applicability_config ⇒ Object
readonly
Attribute for field applicability_config.
-
#category ⇒ Object
readonly
The category of this credit grant.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#customer ⇒ Object
readonly
ID of the customer receiving the billing credits.
-
#customer_account ⇒ Object
readonly
ID of the account receiving the billing credits.
-
#effective_at ⇒ Object
readonly
The time when the billing credits become effective-when they’re eligible for use.
-
#expires_at ⇒ Object
readonly
The time when the billing credits expire.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#name ⇒ Object
readonly
A descriptive name shown in dashboard.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#priority ⇒ Object
readonly
The priority for applying this credit grant.
-
#test_clock ⇒ Object
readonly
ID of the test clock this credit grant belongs to.
-
#updated ⇒ Object
readonly
Time at which the object was last updated.
-
#voided_at ⇒ Object
readonly
The time when this credit grant was voided.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
Creates a credit grant.
-
.expire(id, params = {}, opts = {}) ⇒ Object
Expires a credit grant.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Retrieve a list of credit grants.
- .object_name ⇒ Object
-
.update(id, params = {}, opts = {}) ⇒ Object
Updates a credit grant.
-
.void_grant(id, params = {}, opts = {}) ⇒ Object
Voids a credit grant.
Instance Method Summary collapse
-
#expire(params = {}, opts = {}) ⇒ Object
Expires a credit grant.
-
#void_grant(params = {}, opts = {}) ⇒ Object
Voids a credit grant.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#amount ⇒ Object (readonly)
Attribute for field amount
335 336 337 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 335 def amount @amount end |
#applicability_config ⇒ Object (readonly)
Attribute for field applicability_config
337 338 339 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 337 def applicability_config @applicability_config end |
#category ⇒ Object (readonly)
The category of this credit grant. This is for tracking purposes and isn’t displayed to the customer.
339 340 341 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 339 def category @category end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
341 342 343 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 341 def created @created end |
#customer ⇒ Object (readonly)
ID of the customer receiving the billing credits.
343 344 345 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 343 def customer @customer end |
#customer_account ⇒ Object (readonly)
ID of the account receiving the billing credits
345 346 347 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 345 def customer_account @customer_account end |
#effective_at ⇒ Object (readonly)
The time when the billing credits become effective-when they’re eligible for use.
347 348 349 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 347 def effective_at @effective_at end |
#expires_at ⇒ Object (readonly)
The time when the billing credits expire. If not present, the billing credits don’t expire.
349 350 351 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 349 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Unique identifier for the object.
351 352 353 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 351 def id @id end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
353 354 355 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 353 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
355 356 357 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 355 def @metadata end |
#name ⇒ Object (readonly)
A descriptive name shown in dashboard.
357 358 359 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 357 def name @name end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
359 360 361 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 359 def object @object end |
#priority ⇒ Object (readonly)
The priority for applying this credit grant. The highest priority is 0 and the lowest is 100.
361 362 363 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 361 def priority @priority end |
#test_clock ⇒ Object (readonly)
ID of the test clock this credit grant belongs to.
363 364 365 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 363 def test_clock @test_clock end |
#updated ⇒ Object (readonly)
Time at which the object was last updated. Measured in seconds since the Unix epoch.
365 366 367 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 365 def updated @updated end |
#voided_at ⇒ Object (readonly)
The time when this credit grant was voided. If not present, the credit grant hasn’t been voided.
367 368 369 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 367 def voided_at @voided_at end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a credit grant.
370 371 372 373 374 375 376 377 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 370 def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/billing/credit_grants", params: params, opts: opts ) end |
.expire(id, params = {}, opts = {}) ⇒ Object
Expires a credit grant.
390 391 392 393 394 395 396 397 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 390 def self.expire(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.field_remappings ⇒ Object
443 444 445 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 443 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
439 440 441 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 439 def self.inner_class_types @inner_class_types = { amount: Amount, applicability_config: ApplicabilityConfig } end |
.list(params = {}, opts = {}) ⇒ Object
Retrieve a list of credit grants.
400 401 402 403 404 405 406 407 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 400 def self.list(params = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/billing/credit_grants", params: params, opts: opts ) end |
.object_name ⇒ Object
15 16 17 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 15 def self.object_name "billing.credit_grant" end |
.update(id, params = {}, opts = {}) ⇒ Object
Updates a credit grant.
410 411 412 413 414 415 416 417 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 410 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/credit_grants/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.void_grant(id, params = {}, opts = {}) ⇒ Object
Voids a credit grant.
430 431 432 433 434 435 436 437 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 430 def self.void_grant(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(id) }), params: params, opts: opts ) end |
Instance Method Details
#expire(params = {}, opts = {}) ⇒ Object
Expires a credit grant.
380 381 382 383 384 385 386 387 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 380 def expire(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#void_grant(params = {}, opts = {}) ⇒ Object
Voids a credit grant.
420 421 422 423 424 425 426 427 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 420 def void_grant(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end |