Class: Stripe::ShippingRate
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::ShippingRate
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/shipping_rate.rb
Overview
Shipping rates describe the price of shipping presented to your customers and applied to a purchase. For more information, see [Charge for shipping](stripe.com/docs/payments/during-payment/charge-shipping).
Defined Under Namespace
Classes: DeliveryEstimate, FixedAmount
Constant Summary collapse
- OBJECT_NAME =
"shipping_rate"
Constants inherited from StripeObject
Stripe::StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Whether the shipping rate can be used for new purchases.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#delivery_estimate ⇒ Object
readonly
The estimated range for how long shipping will take, meant to be displayable to the customer.
-
#display_name ⇒ Object
readonly
The name of the shipping rate, meant to be displayable to the customer.
-
#fixed_amount ⇒ Object
readonly
Attribute for field fixed_amount.
-
#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.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#tax_behavior ⇒ Object
readonly
Specifies whether the rate is considered inclusive of taxes or exclusive of taxes.
-
#tax_code ⇒ Object
readonly
A [tax code](stripe.com/docs/tax/tax-categories) ID.
-
#type ⇒ Object
readonly
The type of calculation to use on the shipping rate.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
Creates a new shipping rate object.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your shipping rates.
- .object_name ⇒ Object
-
.update(shipping_rate_token, params = {}, opts = {}) ⇒ Object
Updates an existing shipping rate object.
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
#active ⇒ Object (readonly)
Whether the shipping rate can be used for new purchases. Defaults to ‘true`.
92 93 94 |
# File 'lib/stripe/resources/shipping_rate.rb', line 92 def active @active end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
94 95 96 |
# File 'lib/stripe/resources/shipping_rate.rb', line 94 def created @created end |
#delivery_estimate ⇒ Object (readonly)
The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
96 97 98 |
# File 'lib/stripe/resources/shipping_rate.rb', line 96 def delivery_estimate @delivery_estimate end |
#display_name ⇒ Object (readonly)
The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
98 99 100 |
# File 'lib/stripe/resources/shipping_rate.rb', line 98 def display_name @display_name end |
#fixed_amount ⇒ Object (readonly)
Attribute for field fixed_amount
100 101 102 |
# File 'lib/stripe/resources/shipping_rate.rb', line 100 def fixed_amount @fixed_amount end |
#id ⇒ Object (readonly)
Unique identifier for the object.
102 103 104 |
# File 'lib/stripe/resources/shipping_rate.rb', line 102 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.
104 105 106 |
# File 'lib/stripe/resources/shipping_rate.rb', line 104 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.
106 107 108 |
# File 'lib/stripe/resources/shipping_rate.rb', line 106 def end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
108 109 110 |
# File 'lib/stripe/resources/shipping_rate.rb', line 108 def object @object end |
#tax_behavior ⇒ Object (readonly)
Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of ‘inclusive`, `exclusive`, or `unspecified`.
110 111 112 |
# File 'lib/stripe/resources/shipping_rate.rb', line 110 def tax_behavior @tax_behavior end |
#tax_code ⇒ Object (readonly)
A [tax code](stripe.com/docs/tax/tax-categories) ID. The Shipping tax code is ‘txcd_92010001`.
112 113 114 |
# File 'lib/stripe/resources/shipping_rate.rb', line 112 def tax_code @tax_code end |
#type ⇒ Object (readonly)
The type of calculation to use on the shipping rate.
114 115 116 |
# File 'lib/stripe/resources/shipping_rate.rb', line 114 def type @type end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a new shipping rate object.
117 118 119 |
# File 'lib/stripe/resources/shipping_rate.rb', line 117 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/shipping_rates", params: params, opts: opts) end |
.field_remappings ⇒ Object
140 141 142 |
# File 'lib/stripe/resources/shipping_rate.rb', line 140 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
136 137 138 |
# File 'lib/stripe/resources/shipping_rate.rb', line 136 def self.inner_class_types @inner_class_types = { delivery_estimate: DeliveryEstimate, fixed_amount: FixedAmount } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your shipping rates.
122 123 124 |
# File 'lib/stripe/resources/shipping_rate.rb', line 122 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/shipping_rates", params: params, opts: opts) end |
.object_name ⇒ Object
13 14 15 |
# File 'lib/stripe/resources/shipping_rate.rb', line 13 def self.object_name "shipping_rate" end |
.update(shipping_rate_token, params = {}, opts = {}) ⇒ Object
Updates an existing shipping rate object.
127 128 129 130 131 132 133 134 |
# File 'lib/stripe/resources/shipping_rate.rb', line 127 def self.update(shipping_rate_token, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/shipping_rates/%<shipping_rate_token>s", { shipping_rate_token: CGI.escape(shipping_rate_token) }), params: params, opts: opts ) end |