Class: Stripe::ProductCatalog::TrialOffer
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::ProductCatalog::TrialOffer
- Extended by:
- APIOperations::Create, APIOperations::List
- Defined in:
- lib/stripe/resources/product_catalog/trial_offer.rb
Overview
Trial offers let you define free or paid introductory pricing for a subscription item.
A TrialOffer specifies the price to charge during the trial, how long the trial lasts
(a fixed end timestamp or a number of billing intervals), and what price the subscription
item transitions to when the trial ends. You attach a TrialOffer to a subscription item
using items[current_trial][trial_offer] when creating or updating a subscription.
Defined Under Namespace
Classes: Duration, EndBehavior
Constant Summary collapse
- OBJECT_NAME =
"product_catalog.trial_offer"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Attribute for field duration.
-
#end_behavior ⇒ Object
readonly
Attribute for field end_behavior.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#livemode ⇒ Object
readonly
If the object exists in live mode, the value is
true. -
#name ⇒ Object
readonly
A brief, user-friendly name for the trial offer-for identification purposes.
-
#object ⇒ Object
readonly
String representing the object's type.
-
#price ⇒ Object
readonly
The price during the trial offer.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
Creates a trial offer.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of trial offers.
- .object_name ⇒ Object
Methods included from APIOperations::Create
Methods included from APIOperations::List
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?, field_encodings, #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
#duration ⇒ Object (readonly)
Attribute for field duration
74 75 76 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 74 def duration @duration end |
#end_behavior ⇒ Object (readonly)
Attribute for field end_behavior
76 77 78 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 76 def end_behavior @end_behavior end |
#id ⇒ Object (readonly)
Unique identifier for the object.
78 79 80 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 78 def id @id end |
#livemode ⇒ Object (readonly)
If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
80 81 82 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 80 def livemode @livemode end |
#name ⇒ Object (readonly)
A brief, user-friendly name for the trial offer-for identification purposes.
82 83 84 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 82 def name @name end |
#object ⇒ Object (readonly)
String representing the object's type. Objects of the same type share the same value.
84 85 86 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 84 def object @object end |
#price ⇒ Object (readonly)
The price during the trial offer.
86 87 88 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 86 def price @price end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a trial offer.
89 90 91 92 93 94 95 96 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 89 def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/product_catalog/trial_offers", params: params, opts: opts ) end |
.field_remappings ⇒ Object
112 113 114 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 112 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
108 109 110 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 108 def self.inner_class_types @inner_class_types = { duration: Duration, end_behavior: EndBehavior } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of trial offers.
99 100 101 102 103 104 105 106 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 99 def self.list(params = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/product_catalog/trial_offers", params: params, opts: opts ) end |
.object_name ⇒ Object
16 17 18 |
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 16 def self.object_name "product_catalog.trial_offer" end |