Class: Stripe::Quote
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Quote
- Extended by:
- APIOperations::Create, APIOperations::List
- 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.
- .object_name ⇒ Object
-
.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized 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.
-
#pdf(params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote.
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
Class Method Details
.accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
28 29 30 31 32 33 34 35 |
# File 'lib/stripe/resources/quote.rb', line 28 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.
48 49 50 51 52 53 54 55 |
# File 'lib/stripe/resources/quote.rb', line 48 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).
58 59 60 |
# File 'lib/stripe/resources/quote.rb', line 58 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.
73 74 75 76 77 78 79 80 |
# File 'lib/stripe/resources/quote.rb', line 73 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.
83 84 85 |
# File 'lib/stripe/resources/quote.rb', line 83 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.
98 99 100 101 102 103 104 105 |
# File 'lib/stripe/resources/quote.rb', line 98 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.
118 119 120 121 122 123 124 125 |
# File 'lib/stripe/resources/quote.rb', line 118 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 |
.object_name ⇒ Object
13 14 15 |
# File 'lib/stripe/resources/quote.rb', line 13 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.stripe.com/quotes/overview#quote_pdf)
141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/stripe/resources/quote.rb', line 141 def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts) execute_resource_request_stream( :get, format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(quote) }), :files, params, opts, &read_body_chunk_block ) end |
.update(id, params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
154 155 156 157 158 159 160 161 |
# File 'lib/stripe/resources/quote.rb', line 154 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.
18 19 20 21 22 23 24 25 |
# File 'lib/stripe/resources/quote.rb', line 18 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.
38 39 40 41 42 43 44 45 |
# File 'lib/stripe/resources/quote.rb', line 38 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.
63 64 65 66 67 68 69 70 |
# File 'lib/stripe/resources/quote.rb', line 63 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.
88 89 90 91 92 93 94 95 |
# File 'lib/stripe/resources/quote.rb', line 88 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.
108 109 110 111 112 113 114 115 |
# File 'lib/stripe/resources/quote.rb', line 108 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 |
#pdf(params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized quote. Explanation for special handling can be found [here](docs.stripe.com/quotes/overview#quote_pdf)
128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/stripe/resources/quote.rb', line 128 def pdf(params = {}, opts = {}, &read_body_chunk_block) opts = { api_base: APIRequestor.active_requestor.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, base_address: :files, &read_body_chunk_block ) end |