Class: Stripe::Quote
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Quote
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/quote.rb
Overview
A Quote is a way to model prices that you’d like to provide to a customer. Once accepted, it will automatically create an invoice, subscription or subscription schedule.
Constant Summary collapse
- OBJECT_NAME =
"quote"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
-
.cancel(quote, params = {}, opts = {}) ⇒ Object
Cancels the quote.
-
.create(params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
-
.finalize_quote(quote, params = {}, opts = {}) ⇒ Object
Finalizes the quote.
-
.list(filters = {}, opts = {}) ⇒ Object
Returns a list of your quotes.
-
.list_computed_upfront_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items.
-
.list_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable line_items property containing the first handful of those items.
-
.list_lines(quote, params = {}, opts = {}) ⇒ Object
Retrieves a paginated list of lines for a quote.
-
.list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {}) ⇒ Object
Preview the invoice line items that would be generated by accepting the quote.
-
.mark_draft(quote, params = {}, opts = {}) ⇒ Object
Converts a stale quote to draft.
-
.mark_stale(quote, params = {}, opts = {}) ⇒ Object
Converts a draft or open quote to stale.
- .object_name ⇒ Object
-
.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote.
-
.reestimate(quote, params = {}, opts = {}) ⇒ Object
Recompute the upcoming invoice estimate for the quote.
-
.update(id, params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
Instance Method Summary collapse
-
#accept(params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
-
#cancel(params = {}, opts = {}) ⇒ Object
Cancels the quote.
-
#finalize_quote(params = {}, opts = {}) ⇒ Object
Finalizes the quote.
-
#list_computed_upfront_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items.
-
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable line_items property containing the first handful of those items.
-
#list_lines(params = {}, opts = {}) ⇒ Object
Retrieves a paginated list of lines for a quote.
-
#list_preview_invoice_lines(preview_invoice, params = {}, opts = {}) ⇒ Object
Preview the invoice line items that would be generated by accepting the quote.
-
#mark_draft(params = {}, opts = {}) ⇒ Object
Converts a stale quote to draft.
-
#mark_stale(params = {}, opts = {}) ⇒ Object
Converts a draft or open quote to stale.
-
#pdf(params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote.
-
#reestimate(params = {}, opts = {}) ⇒ Object
Recompute the upcoming invoice estimate for the quote.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::NestedResource
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
Class Method Details
.accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
32 33 34 35 36 37 38 39 |
# File 'lib/stripe/resources/quote.rb', line 32 def self.accept(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.cancel(quote, params = {}, opts = {}) ⇒ Object
Cancels the quote.
52 53 54 55 56 57 58 59 |
# File 'lib/stripe/resources/quote.rb', line 52 def self.cancel(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](dashboard.stripe.com/settings/billing/quote).
62 63 64 |
# File 'lib/stripe/resources/quote.rb', line 62 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/quotes", params: params, opts: opts) end |
.finalize_quote(quote, params = {}, opts = {}) ⇒ Object
Finalizes the quote.
77 78 79 80 81 82 83 84 |
# File 'lib/stripe/resources/quote.rb', line 77 def self.finalize_quote(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.list(filters = {}, opts = {}) ⇒ Object
Returns a list of your quotes.
87 88 89 |
# File 'lib/stripe/resources/quote.rb', line 87 def self.list(filters = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/quotes", params: filters, opts: opts) end |
.list_computed_upfront_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
102 103 104 105 106 107 108 109 |
# File 'lib/stripe/resources/quote.rb', line 102 def self.list_computed_upfront_line_items(quote, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.list_line_items(quote, params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
122 123 124 125 126 127 128 129 |
# File 'lib/stripe/resources/quote.rb', line 122 def self.list_line_items(quote, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.list_lines(quote, params = {}, opts = {}) ⇒ Object
Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
142 143 144 145 146 147 148 149 |
# File 'lib/stripe/resources/quote.rb', line 142 def self.list_lines(quote, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {}) ⇒ Object
Preview the invoice line items that would be generated by accepting the quote.
162 163 164 165 166 167 168 169 |
# File 'lib/stripe/resources/quote.rb', line 162 def self.list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(quote), preview_invoice: CGI.escape(preview_invoice) }), params: params, opts: opts ) end |
.mark_draft(quote, params = {}, opts = {}) ⇒ Object
Converts a stale quote to draft.
182 183 184 185 186 187 188 189 |
# File 'lib/stripe/resources/quote.rb', line 182 def self.mark_draft(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.mark_stale(quote, params = {}, opts = {}) ⇒ Object
Converts a draft or open quote to stale.
202 203 204 205 206 207 208 209 |
# File 'lib/stripe/resources/quote.rb', line 202 def self.mark_stale(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.object_name ⇒ Object
14 15 16 |
# File 'lib/stripe/resources/quote.rb', line 14 def self.object_name "quote" end |
.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote. Explanation for special handling can be found [here](docs.corp.stripe.com/quotes/overview#quote_pdf)
225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/stripe/resources/quote.rb', line 225 def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) config = opts[:client]&.config || Stripe.config opts = { api_base: config.uploads_base }.merge(opts) execute_resource_request_stream( :get, format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(quote) }), params, opts, &read_body_chunk_block ) end |
.reestimate(quote, params = {}, opts = {}) ⇒ Object
Recompute the upcoming invoice estimate for the quote.
248 249 250 251 252 253 254 255 |
# File 'lib/stripe/resources/quote.rb', line 248 def self.reestimate(quote, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(quote) }), params: params, opts: opts ) end |
.update(id, params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
258 259 260 261 262 263 264 265 |
# File 'lib/stripe/resources/quote.rb', line 258 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
Instance Method Details
#accept(params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
22 23 24 25 26 27 28 29 |
# File 'lib/stripe/resources/quote.rb', line 22 def accept(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#cancel(params = {}, opts = {}) ⇒ Object
Cancels the quote.
42 43 44 45 46 47 48 49 |
# File 'lib/stripe/resources/quote.rb', line 42 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#finalize_quote(params = {}, opts = {}) ⇒ Object
Finalizes the quote.
67 68 69 70 71 72 73 74 |
# File 'lib/stripe/resources/quote.rb', line 67 def finalize_quote(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#list_computed_upfront_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable [computed.upfront.line_items](stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items.
92 93 94 95 96 97 98 99 |
# File 'lib/stripe/resources/quote.rb', line 92 def list_computed_upfront_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
112 113 114 115 116 117 118 119 |
# File 'lib/stripe/resources/quote.rb', line 112 def list_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#list_lines(params = {}, opts = {}) ⇒ Object
Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
132 133 134 135 136 137 138 139 |
# File 'lib/stripe/resources/quote.rb', line 132 def list_lines(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#list_preview_invoice_lines(preview_invoice, params = {}, opts = {}) ⇒ Object
Preview the invoice line items that would be generated by accepting the quote.
152 153 154 155 156 157 158 159 |
# File 'lib/stripe/resources/quote.rb', line 152 def list_preview_invoice_lines(preview_invoice, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(self["id"]), preview_invoice: CGI.escape(preview_invoice) }), params: params, opts: opts ) end |
#mark_draft(params = {}, opts = {}) ⇒ Object
Converts a stale quote to draft.
172 173 174 175 176 177 178 179 |
# File 'lib/stripe/resources/quote.rb', line 172 def mark_draft(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#mark_stale(params = {}, opts = {}) ⇒ Object
Converts a draft or open quote to stale.
192 193 194 195 196 197 198 199 |
# File 'lib/stripe/resources/quote.rb', line 192 def mark_stale(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#pdf(params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote. Explanation for special handling can be found [here](docs.corp.stripe.com/quotes/overview#quote_pdf)
212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/stripe/resources/quote.rb', line 212 def pdf(params = {}, opts = {}, &read_body_chunk_block) config = opts[:client]&.config || Stripe.config opts = { api_base: config.uploads_base }.merge(opts) request_stream( method: :get, path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }), params: params, opts: opts, &read_body_chunk_block ) end |
#reestimate(params = {}, opts = {}) ⇒ Object
Recompute the upcoming invoice estimate for the quote.
238 239 240 241 242 243 244 245 |
# File 'lib/stripe/resources/quote.rb', line 238 def reestimate(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(self["id"]) }), params: params, opts: opts ) end |