Class: Stripe::Climate::Order

Inherits:
APIResource show all
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, CancelParams, CreateParams, DeliveryDetail, ListParams, UpdateParams

Constant Summary collapse

OBJECT_NAME =
"climate.order"

Constants inherited from StripeObject

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

Instance 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

#amount_feesObject (readonly)

Total amount of [Frontier](frontierclimate.com/)‘s service fees in the currency’s smallest unit.



141
142
143
# File 'lib/stripe/resources/climate/order.rb', line 141

def amount_fees
  @amount_fees
end

#amount_subtotalObject (readonly)

Total amount of the carbon removal in the currency’s smallest unit.



143
144
145
# File 'lib/stripe/resources/climate/order.rb', line 143

def amount_subtotal
  @amount_subtotal
end

#amount_totalObject (readonly)

Total amount of the order including fees in the currency’s smallest unit.



145
146
147
# File 'lib/stripe/resources/climate/order.rb', line 145

def amount_total
  @amount_total
end

#beneficiaryObject (readonly)

Attribute for field beneficiary



147
148
149
# File 'lib/stripe/resources/climate/order.rb', line 147

def beneficiary
  @beneficiary
end

#canceled_atObject (readonly)

Time at which the order was canceled. Measured in seconds since the Unix epoch.



149
150
151
# File 'lib/stripe/resources/climate/order.rb', line 149

def canceled_at
  @canceled_at
end

#cancellation_reasonObject (readonly)

Reason for the cancellation of this order.



151
152
153
# File 'lib/stripe/resources/climate/order.rb', line 151

def cancellation_reason
  @cancellation_reason
end

#certificateObject (readonly)

For delivered orders, a URL to a delivery certificate for the order.



153
154
155
# File 'lib/stripe/resources/climate/order.rb', line 153

def certificate
  @certificate
end

#confirmed_atObject (readonly)

Time at which the order was confirmed. Measured in seconds since the Unix epoch.



155
156
157
# File 'lib/stripe/resources/climate/order.rb', line 155

def confirmed_at
  @confirmed_at
end

#createdObject (readonly)

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



157
158
159
# File 'lib/stripe/resources/climate/order.rb', line 157

def created
  @created
end

#currencyObject (readonly)

Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.



159
160
161
# File 'lib/stripe/resources/climate/order.rb', line 159

def currency
  @currency
end

#delayed_atObject (readonly)

Time at which the order’s expected_delivery_year was delayed. Measured in seconds since the Unix epoch.



161
162
163
# File 'lib/stripe/resources/climate/order.rb', line 161

def delayed_at
  @delayed_at
end

#delivered_atObject (readonly)

Time at which the order was delivered. Measured in seconds since the Unix epoch.



163
164
165
# File 'lib/stripe/resources/climate/order.rb', line 163

def delivered_at
  @delivered_at
end

#delivery_detailsObject (readonly)

Details about the delivery of carbon removal for this order.



165
166
167
# File 'lib/stripe/resources/climate/order.rb', line 165

def delivery_details
  @delivery_details
end

#expected_delivery_yearObject (readonly)

The year this order is expected to be delivered.



167
168
169
# File 'lib/stripe/resources/climate/order.rb', line 167

def expected_delivery_year
  @expected_delivery_year
end

#idObject (readonly)

Unique identifier for the object.



169
170
171
# File 'lib/stripe/resources/climate/order.rb', line 169

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.



171
172
173
# File 'lib/stripe/resources/climate/order.rb', line 171

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.



173
174
175
# File 'lib/stripe/resources/climate/order.rb', line 173

def 
  @metadata
end

#metric_tonsObject (readonly)

Quantity of carbon removal that is included in this order.



175
176
177
# File 'lib/stripe/resources/climate/order.rb', line 175

def metric_tons
  @metric_tons
end

#objectObject (readonly)

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



177
178
179
# File 'lib/stripe/resources/climate/order.rb', line 177

def object
  @object
end

#productObject (readonly)

Unique ID for the Climate ‘Product` this order is purchasing.



179
180
181
# File 'lib/stripe/resources/climate/order.rb', line 179

def product
  @product
end

#product_substituted_atObject (readonly)

Time at which the order’s product was substituted for a different product. Measured in seconds since the Unix epoch.



181
182
183
# File 'lib/stripe/resources/climate/order.rb', line 181

def product_substituted_at
  @product_substituted_at
end

#statusObject (readonly)

The current status of this order.



183
184
185
# File 'lib/stripe/resources/climate/order.rb', line 183

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.



202
203
204
205
206
207
208
209
# File 'lib/stripe/resources/climate/order.rb', line 202

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.



213
214
215
# File 'lib/stripe/resources/climate/order.rb', line 213

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

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

Lists all Climate order objects. The orders are returned sorted by creation date, with the most recently created orders appearing first.



219
220
221
# File 'lib/stripe/resources/climate/order.rb', line 219

def self.list(params = {}, opts = {})
  request_stripe_object(method: :get, path: "/v1/climate/orders", params: params, opts: opts)
end

.object_nameObject



14
15
16
# File 'lib/stripe/resources/climate/order.rb', line 14

def self.object_name
  "climate.order"
end

.update(order, params = {}, opts = {}) ⇒ Object

Updates the specified order by setting the values of the parameters passed.



224
225
226
227
228
229
230
231
# File 'lib/stripe/resources/climate/order.rb', line 224

def self.update(order, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/climate/orders/%<order>s", { order: CGI.escape(order) }),
    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.



189
190
191
192
193
194
195
196
# File 'lib/stripe/resources/climate/order.rb', line 189

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