Class: Stripe::ProductCatalog::TrialOffer

Inherits:
APIResource show all
Extended by:
APIOperations::Create
Defined in:
lib/stripe/resources/product_catalog/trial_offer.rb

Overview

Resource for the TrialOffer API, used to describe a subscription item’s trial period settings. Renders a TrialOffer object that describes the price, duration, end_behavior of a trial offer.

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

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Methods included from APIOperations::Create

create

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

included

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

#durationObject (readonly)

Attribute for field duration



70
71
72
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 70

def duration
  @duration
end

#end_behaviorObject (readonly)

Attribute for field end_behavior



72
73
74
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 72

def end_behavior
  @end_behavior
end

#idObject (readonly)

Unique identifier for the object.



74
75
76
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 74

def id
  @id
end

#livemodeObject (readonly)

If the object exists in live mode, the value is ‘true`. If the object exists in test mode, the value is `false`.



76
77
78
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 76

def livemode
  @livemode
end

#nameObject (readonly)

A brief, user-friendly name for the trial offer-for identification purposes.



78
79
80
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 78

def name
  @name
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



80
81
82
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 80

def object
  @object
end

#priceObject (readonly)

The price during the trial offer.



82
83
84
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 82

def price
  @price
end

Class Method Details

.create(params = {}, opts = {}) ⇒ Object

Creates a trial offer.



85
86
87
88
89
90
91
92
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 85

def self.create(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/product_catalog/trial_offers",
    params: params,
    opts: opts
  )
end

.field_remappingsObject



98
99
100
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 98

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



94
95
96
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 94

def self.inner_class_types
  @inner_class_types = { duration: Duration, end_behavior: EndBehavior }
end

.object_nameObject



12
13
14
# File 'lib/stripe/resources/product_catalog/trial_offer.rb', line 12

def self.object_name
  "product_catalog.trial_offer"
end