Class: Stripe::QuoteService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::QuoteService
- Defined in:
- lib/stripe/services/quote_service.rb
Defined Under Namespace
Classes: AcceptParams, CancelParams, CreateParams, FinalizeQuoteParams, ListParams, ListPreviewInvoiceLinesParams, MarkDraftParams, MarkStaleParams, PdfParams, ReestimateParams, RetrieveParams, UpdateParams
Instance Attribute Summary collapse
-
#computed_upfront_line_items ⇒ Object
readonly
Returns the value of attribute computed_upfront_line_items.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#preview_invoices ⇒ Object
readonly
Returns the value of attribute preview_invoices.
-
#preview_subscription_schedules ⇒ Object
readonly
Returns the value of attribute preview_subscription_schedules.
Instance 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.
-
#initialize(requestor) ⇒ QuoteService
constructor
A new instance of QuoteService.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your quotes.
-
#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.
-
#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.
-
#retrieve(quote, params = {}, opts = {}) ⇒ Object
Retrieves the quote with the given ID.
-
#update(quote, params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
Methods inherited from StripeService
Constructor Details
#initialize(requestor) ⇒ QuoteService
Returns a new instance of QuoteService.
8 9 10 11 12 13 14 15 16 |
# File 'lib/stripe/services/quote_service.rb', line 8 def initialize(requestor) super(requestor) @preview_invoices = Stripe::QuotePreviewInvoiceService.new(@requestor) @preview_subscription_schedules = Stripe::QuotePreviewSubscriptionScheduleService .new(@requestor) @lines = Stripe::QuoteLineService.new(@requestor) @line_items = Stripe::QuoteLineItemService.new(@requestor) @computed_upfront_line_items = Stripe::QuoteComputedUpfrontLineItemsService.new(@requestor) end |
Instance Attribute Details
#computed_upfront_line_items ⇒ Object (readonly)
Returns the value of attribute computed_upfront_line_items.
6 7 8 |
# File 'lib/stripe/services/quote_service.rb', line 6 def computed_upfront_line_items @computed_upfront_line_items end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
6 7 8 |
# File 'lib/stripe/services/quote_service.rb', line 6 def line_items @line_items end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
6 7 8 |
# File 'lib/stripe/services/quote_service.rb', line 6 def lines @lines end |
#preview_invoices ⇒ Object (readonly)
Returns the value of attribute preview_invoices.
6 7 8 |
# File 'lib/stripe/services/quote_service.rb', line 6 def preview_invoices @preview_invoices end |
#preview_subscription_schedules ⇒ Object (readonly)
Returns the value of attribute preview_subscription_schedules.
6 7 8 |
# File 'lib/stripe/services/quote_service.rb', line 6 def preview_subscription_schedules @preview_subscription_schedules end |
Instance Method Details
#accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
2598 2599 2600 2601 2602 2603 2604 2605 2606 |
# File 'lib/stripe/services/quote_service.rb', line 2598 def accept(quote, params = {}, opts = {}) request( method: :post, path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) end |
#cancel(quote, params = {}, opts = {}) ⇒ Object
Cancels the quote.
2609 2610 2611 2612 2613 2614 2615 2616 2617 |
# File 'lib/stripe/services/quote_service.rb', line 2609 def cancel(quote, params = {}, opts = {}) request( method: :post, path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) 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).
2620 2621 2622 |
# File 'lib/stripe/services/quote_service.rb', line 2620 def create(params = {}, opts = {}) request(method: :post, path: "/v1/quotes", params: params, opts: opts, base_address: :api) end |
#finalize_quote(quote, params = {}, opts = {}) ⇒ Object
Finalizes the quote.
2625 2626 2627 2628 2629 2630 2631 2632 2633 |
# File 'lib/stripe/services/quote_service.rb', line 2625 def finalize_quote(quote, params = {}, opts = {}) request( method: :post, path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) end |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your quotes.
2636 2637 2638 |
# File 'lib/stripe/services/quote_service.rb', line 2636 def list(params = {}, opts = {}) request(method: :get, path: "/v1/quotes", params: params, opts: opts, base_address: :api) end |
#list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {}) ⇒ Object
Preview the invoice line items that would be generated by accepting the quote.
2641 2642 2643 2644 2645 2646 2647 2648 2649 |
# File 'lib/stripe/services/quote_service.rb', line 2641 def list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {}) request( 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, base_address: :api ) end |
#mark_draft(quote, params = {}, opts = {}) ⇒ Object
Converts a stale quote to draft.
2652 2653 2654 2655 2656 2657 2658 2659 2660 |
# File 'lib/stripe/services/quote_service.rb', line 2652 def mark_draft(quote, params = {}, opts = {}) request( method: :post, path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) end |
#mark_stale(quote, params = {}, opts = {}) ⇒ Object
Converts a draft or open quote to stale.
2663 2664 2665 2666 2667 2668 2669 2670 2671 |
# File 'lib/stripe/services/quote_service.rb', line 2663 def mark_stale(quote, params = {}, opts = {}) request( method: :post, path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) 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)
2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 |
# File 'lib/stripe/services/quote_service.rb', line 2674 def pdf(quote, 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(quote) }), params: params, opts: opts, base_address: :files, &read_body_chunk_block ) end |
#reestimate(quote, params = {}, opts = {}) ⇒ Object
Recompute the upcoming invoice estimate for the quote.
2687 2688 2689 2690 2691 2692 2693 2694 2695 |
# File 'lib/stripe/services/quote_service.rb', line 2687 def reestimate(quote, params = {}, opts = {}) request( method: :post, path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) end |
#retrieve(quote, params = {}, opts = {}) ⇒ Object
Retrieves the quote with the given ID.
2698 2699 2700 2701 2702 2703 2704 2705 2706 |
# File 'lib/stripe/services/quote_service.rb', line 2698 def retrieve(quote, params = {}, opts = {}) request( method: :get, path: format("/v1/quotes/%<quote>s", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) end |
#update(quote, params = {}, opts = {}) ⇒ Object
A quote models prices and services for a customer.
2709 2710 2711 2712 2713 2714 2715 2716 2717 |
# File 'lib/stripe/services/quote_service.rb', line 2709 def update(quote, params = {}, opts = {}) request( method: :post, path: format("/v1/quotes/%<quote>s", { quote: CGI.escape(quote) }), params: params, opts: opts, base_address: :api ) end |