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

#==, #[], #[]=, #_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

#activeObject (readonly)

Whether the shipping rate can be used for new purchases. Defaults to ‘true`.



283
284
285
# File 'lib/stripe/resources/shipping_rate.rb', line 283

def active
  @active
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



285
286
287
# File 'lib/stripe/resources/shipping_rate.rb', line 285

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.



287
288
289
# File 'lib/stripe/resources/shipping_rate.rb', line 287

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.



289
290
291
# File 'lib/stripe/resources/shipping_rate.rb', line 289

def display_name
  @display_name
end

#fixed_amountObject (readonly)

Attribute for field fixed_amount



291
292
293
# File 'lib/stripe/resources/shipping_rate.rb', line 291

def fixed_amount
  @fixed_amount
end

#idObject (readonly)

Unique identifier for the object.



293
294
295
# File 'lib/stripe/resources/shipping_rate.rb', line 293

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.



295
296
297
# File 'lib/stripe/resources/shipping_rate.rb', line 295

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.



297
298
299
# File 'lib/stripe/resources/shipping_rate.rb', line 297

def 
  @metadata
end

#objectObject (readonly)

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



299
300
301
# File 'lib/stripe/resources/shipping_rate.rb', line 299

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`.



301
302
303
# File 'lib/stripe/resources/shipping_rate.rb', line 301

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`.



303
304
305
# File 'lib/stripe/resources/shipping_rate.rb', line 303

def tax_code
  @tax_code
end

#typeObject (readonly)

The type of calculation to use on the shipping rate.



305
306
307
# File 'lib/stripe/resources/shipping_rate.rb', line 305

def type
  @type
end

Class Method Details

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

Creates a new shipping rate object.



308
309
310
# File 'lib/stripe/resources/shipping_rate.rb', line 308

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

.field_remappingsObject



331
332
333
# File 'lib/stripe/resources/shipping_rate.rb', line 331

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



327
328
329
# File 'lib/stripe/resources/shipping_rate.rb', line 327

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.



313
314
315
# File 'lib/stripe/resources/shipping_rate.rb', line 313

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.



318
319
320
321
322
323
324
325
# File 'lib/stripe/resources/shipping_rate.rb', line 318

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