Class: Stripe::Climate::Order
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Climate::Order
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/climate/order.rb
Overview
Orders represent your intent to purchase a particular Climate product. When you create an order, the payment is deducted from your merchant balance.
Defined Under Namespace
Classes: Beneficiary, DeliveryDetail
Constant Summary collapse
- OBJECT_NAME =
"climate.order"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount_fees ⇒ Object
readonly
Total amount of [Frontier](frontierclimate.com/)‘s service fees in the currency’s smallest unit.
-
#amount_subtotal ⇒ Object
readonly
Total amount of the carbon removal in the currency’s smallest unit.
-
#amount_total ⇒ Object
readonly
Total amount of the order including fees in the currency’s smallest unit.
-
#beneficiary ⇒ Object
readonly
Attribute for field beneficiary.
-
#canceled_at ⇒ Object
readonly
Time at which the order was canceled.
-
#cancellation_reason ⇒ Object
readonly
Reason for the cancellation of this order.
-
#certificate ⇒ Object
readonly
For delivered orders, a URL to a delivery certificate for the order.
-
#confirmed_at ⇒ Object
readonly
Time at which the order was confirmed.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.
-
#delayed_at ⇒ Object
readonly
Time at which the order’s expected_delivery_year was delayed.
-
#delivered_at ⇒ Object
readonly
Time at which the order was delivered.
-
#delivery_details ⇒ Object
readonly
Details about the delivery of carbon removal for this order.
-
#expected_delivery_year ⇒ Object
readonly
The year this order is expected to be delivered.
-
#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.
-
#metric_tons ⇒ Object
readonly
Quantity of carbon removal that is included in this order.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#product ⇒ Object
readonly
Unique ID for the Climate ‘Product` this order is purchasing.
-
#product_substituted_at ⇒ Object
readonly
Time at which the order’s product was substituted for a different product.
-
#status ⇒ Object
readonly
The current status of this order.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.cancel(order, params = {}, opts = {}) ⇒ Object
Cancels a Climate order.
-
.create(params = {}, opts = {}) ⇒ Object
Creates a Climate order object for a given Climate product.
-
.list(filters = {}, opts = {}) ⇒ Object
Lists all Climate order objects.
- .object_name ⇒ Object
-
.update(id, params = {}, opts = {}) ⇒ Object
Updates the specified order by setting the values of the parameters passed.
Instance Method Summary collapse
-
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a Climate order.
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
#amount_fees ⇒ Object (readonly)
Total amount of [Frontier](frontierclimate.com/)‘s service fees in the currency’s smallest unit.
29 30 31 |
# File 'lib/stripe/resources/climate/order.rb', line 29 def amount_fees @amount_fees end |
#amount_subtotal ⇒ Object (readonly)
Total amount of the carbon removal in the currency’s smallest unit.
31 32 33 |
# File 'lib/stripe/resources/climate/order.rb', line 31 def amount_subtotal @amount_subtotal end |
#amount_total ⇒ Object (readonly)
Total amount of the order including fees in the currency’s smallest unit.
33 34 35 |
# File 'lib/stripe/resources/climate/order.rb', line 33 def amount_total @amount_total end |
#beneficiary ⇒ Object (readonly)
Attribute for field beneficiary
35 36 37 |
# File 'lib/stripe/resources/climate/order.rb', line 35 def beneficiary @beneficiary end |
#canceled_at ⇒ Object (readonly)
Time at which the order was canceled. Measured in seconds since the Unix epoch.
37 38 39 |
# File 'lib/stripe/resources/climate/order.rb', line 37 def canceled_at @canceled_at end |
#cancellation_reason ⇒ Object (readonly)
Reason for the cancellation of this order.
39 40 41 |
# File 'lib/stripe/resources/climate/order.rb', line 39 def cancellation_reason @cancellation_reason end |
#certificate ⇒ Object (readonly)
For delivered orders, a URL to a delivery certificate for the order.
41 42 43 |
# File 'lib/stripe/resources/climate/order.rb', line 41 def certificate @certificate end |
#confirmed_at ⇒ Object (readonly)
Time at which the order was confirmed. Measured in seconds since the Unix epoch.
43 44 45 |
# File 'lib/stripe/resources/climate/order.rb', line 43 def confirmed_at @confirmed_at end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
45 46 47 |
# File 'lib/stripe/resources/climate/order.rb', line 45 def created @created end |
#currency ⇒ Object (readonly)
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.
47 48 49 |
# File 'lib/stripe/resources/climate/order.rb', line 47 def currency @currency end |
#delayed_at ⇒ Object (readonly)
Time at which the order’s expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
49 50 51 |
# File 'lib/stripe/resources/climate/order.rb', line 49 def delayed_at @delayed_at end |
#delivered_at ⇒ Object (readonly)
Time at which the order was delivered. Measured in seconds since the Unix epoch.
51 52 53 |
# File 'lib/stripe/resources/climate/order.rb', line 51 def delivered_at @delivered_at end |
#delivery_details ⇒ Object (readonly)
Details about the delivery of carbon removal for this order.
53 54 55 |
# File 'lib/stripe/resources/climate/order.rb', line 53 def delivery_details @delivery_details end |
#expected_delivery_year ⇒ Object (readonly)
The year this order is expected to be delivered.
55 56 57 |
# File 'lib/stripe/resources/climate/order.rb', line 55 def expected_delivery_year @expected_delivery_year end |
#id ⇒ Object (readonly)
Unique identifier for the object.
57 58 59 |
# File 'lib/stripe/resources/climate/order.rb', line 57 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.
59 60 61 |
# File 'lib/stripe/resources/climate/order.rb', line 59 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.
61 62 63 |
# File 'lib/stripe/resources/climate/order.rb', line 61 def @metadata end |
#metric_tons ⇒ Object (readonly)
Quantity of carbon removal that is included in this order.
63 64 65 |
# File 'lib/stripe/resources/climate/order.rb', line 63 def metric_tons @metric_tons end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
65 66 67 |
# File 'lib/stripe/resources/climate/order.rb', line 65 def object @object end |
#product ⇒ Object (readonly)
Unique ID for the Climate ‘Product` this order is purchasing.
67 68 69 |
# File 'lib/stripe/resources/climate/order.rb', line 67 def product @product end |
#product_substituted_at ⇒ Object (readonly)
Time at which the order’s product was substituted for a different product. Measured in seconds since the Unix epoch.
69 70 71 |
# File 'lib/stripe/resources/climate/order.rb', line 69 def product_substituted_at @product_substituted_at end |
#status ⇒ Object (readonly)
The current status of this order.
71 72 73 |
# File 'lib/stripe/resources/climate/order.rb', line 71 def status @status end |
Class Method Details
.cancel(order, params = {}, opts = {}) ⇒ Object
Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe provides 90 days advance notice and refunds the amount_total.
90 91 92 93 94 95 96 97 |
# File 'lib/stripe/resources/climate/order.rb', line 90 def self.cancel(order, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(order) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
Creates a Climate order object for a given Climate product. The order will be processed immediately after creation and payment will be deducted your Stripe balance.
101 102 103 |
# File 'lib/stripe/resources/climate/order.rb', line 101 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/climate/orders", params: params, opts: opts) end |
.list(filters = {}, opts = {}) ⇒ Object
Lists all Climate order objects. The orders are returned sorted by creation date, with the most recently created orders appearing first.
107 108 109 |
# File 'lib/stripe/resources/climate/order.rb', line 107 def self.list(filters = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/climate/orders", params: filters, opts: opts) end |
.object_name ⇒ Object
14 15 16 |
# File 'lib/stripe/resources/climate/order.rb', line 14 def self.object_name "climate.order" end |
.update(id, params = {}, opts = {}) ⇒ Object
Updates the specified order by setting the values of the parameters passed.
112 113 114 115 116 117 118 119 |
# File 'lib/stripe/resources/climate/order.rb', line 112 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/climate/orders/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
Instance Method Details
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe provides 90 days advance notice and refunds the amount_total.
77 78 79 80 81 82 83 84 |
# File 'lib/stripe/resources/climate/order.rb', line 77 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(self["id"]) }), params: params, opts: opts ) end |