Class: Stripe::ShippingRate

Inherits:
APIResource show all
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

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #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

included

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

#activeObject (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

#createdObject (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_estimateObject (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_nameObject (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_amountObject (readonly)

Attribute for field fixed_amount



251
252
253
# File 'lib/stripe/resources/shipping_rate.rb', line 251

def fixed_amount
  @fixed_amount
end

#idObject (readonly)

Unique identifier for the object.



253
254
255
# File 'lib/stripe/resources/shipping_rate.rb', line 253

def id
  @id
end

#livemodeObject (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

#metadataObject (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

#objectObject (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_behaviorObject (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_codeObject (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

#typeObject (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_nameObject



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