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.

Constant Summary collapse

OBJECT_NAME =
"climate.order"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary

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

Class Method Details

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

Cancels a Climate order. You can cancel an order within 30 days 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.



35
36
37
38
39
40
41
42
# File 'lib/stripe/resources/climate/order.rb', line 35

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.



46
47
48
# File 'lib/stripe/resources/climate/order.rb', line 46

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.



52
53
54
# File 'lib/stripe/resources/climate/order.rb', line 52

def self.list(filters = {}, opts = {})
  request_stripe_object(method: :get, path: "/v1/climate/orders", params: filters, 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(id, params = {}, opts = {}) ⇒ Object

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



57
58
59
60
61
62
63
64
# File 'lib/stripe/resources/climate/order.rb', line 57

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 30 days 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.



22
23
24
25
26
27
28
29
# File 'lib/stripe/resources/climate/order.rb', line 22

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