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: CreateParams, DeliveryEstimate, FixedAmount, ListParams, UpdateParams
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.
-
.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
#==, #[], #[]=, 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`.
243 244 245 |
# File 'lib/stripe/resources/shipping_rate.rb', line 243 def active @active end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
245 246 247 |
# File 'lib/stripe/resources/shipping_rate.rb', line 245 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.
247 248 249 |
# File 'lib/stripe/resources/shipping_rate.rb', line 247 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.
249 250 251 |
# File 'lib/stripe/resources/shipping_rate.rb', line 249 def display_name @display_name end |
#fixed_amount ⇒ Object (readonly)
Attribute for field fixed_amount
251 252 253 |
# File 'lib/stripe/resources/shipping_rate.rb', line 251 def fixed_amount @fixed_amount end |
#id ⇒ Object (readonly)
Unique identifier for the object.
253 254 255 |
# File 'lib/stripe/resources/shipping_rate.rb', line 253 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.
255 256 257 |
# File 'lib/stripe/resources/shipping_rate.rb', line 255 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.
257 258 259 |
# File 'lib/stripe/resources/shipping_rate.rb', line 257 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
259 260 261 |
# File 'lib/stripe/resources/shipping_rate.rb', line 259 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`.
261 262 263 |
# File 'lib/stripe/resources/shipping_rate.rb', line 261 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`.
263 264 265 |
# File 'lib/stripe/resources/shipping_rate.rb', line 263 def tax_code @tax_code end |
#type ⇒ Object (readonly)
The type of calculation to use on the shipping rate.
265 266 267 |
# File 'lib/stripe/resources/shipping_rate.rb', line 265 def type @type end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a new shipping rate object.
268 269 270 |
# File 'lib/stripe/resources/shipping_rate.rb', line 268 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/shipping_rates", params: params, opts: opts) end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your shipping rates.
273 274 275 |
# File 'lib/stripe/resources/shipping_rate.rb', line 273 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.
278 279 280 281 282 283 284 285 |
# File 'lib/stripe/resources/shipping_rate.rb', line 278 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 |