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, RetrieveParams, 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.
-
#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.
-
#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.
-
.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
#==, #[], #[]=, 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
209 210 211 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 209 def amount @amount end |
#applicability_config ⇒ Object (readonly)
Attribute for field applicability_config
211 212 213 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 211 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.
213 214 215 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 213 def category @category end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
215 216 217 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 215 def created @created end |
#customer ⇒ Object (readonly)
ID of the customer receiving the billing credits.
217 218 219 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 217 def customer @customer end |
#effective_at ⇒ Object (readonly)
The time when the billing credits become effective-when they’re eligible for use.
219 220 221 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 219 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.
221 222 223 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 221 def expires_at @expires_at end |
#id ⇒ Object (readonly)
Unique identifier for the object.
223 224 225 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 223 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.
225 226 227 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 225 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.
227 228 229 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 227 def @metadata end |
#name ⇒ Object (readonly)
A descriptive name shown in dashboard.
229 230 231 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 229 def name @name end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
231 232 233 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 231 def object @object end |
#test_clock ⇒ Object (readonly)
ID of the test clock this credit grant belongs to.
233 234 235 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 233 def test_clock @test_clock end |
#updated ⇒ Object (readonly)
Time at which the object was last updated. Measured in seconds since the Unix epoch.
235 236 237 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 235 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.
237 238 239 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 237 def voided_at @voided_at end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a credit grant.
240 241 242 243 244 245 246 247 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 240 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.
260 261 262 263 264 265 266 267 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 260 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 |
.list(params = {}, opts = {}) ⇒ Object
Retrieve a list of credit grants.
270 271 272 273 274 275 276 277 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 270 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.
280 281 282 283 284 285 286 287 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 280 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.
300 301 302 303 304 305 306 307 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 300 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.
250 251 252 253 254 255 256 257 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 250 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.
290 291 292 293 294 295 296 297 |
# File 'lib/stripe/resources/billing/credit_grant.rb', line 290 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 |