Class: Stripe::QuoteService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::QuoteService
- Defined in:
- lib/stripe/services/quote_service.rb
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.
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.
-
#pdf(quote, params = {}, opts = {}, &read_body_chunk_block) ⇒ Object
Download the PDF for a finalized 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 |
# File 'lib/stripe/services/quote_service.rb', line 8 def initialize(requestor) super(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 |
Instance Method Details
#accept(quote, params = {}, opts = {}) ⇒ Object
Accepts the specified quote.
15 16 17 18 19 20 21 22 23 |
# File 'lib/stripe/services/quote_service.rb', line 15 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.
26 27 28 29 30 31 32 33 34 |
# File 'lib/stripe/services/quote_service.rb', line 26 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).
37 38 39 |
# File 'lib/stripe/services/quote_service.rb', line 37 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.
42 43 44 45 46 47 48 49 50 |
# File 'lib/stripe/services/quote_service.rb', line 42 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.
53 54 55 |
# File 'lib/stripe/services/quote_service.rb', line 53 def list(params = {}, opts = {}) request(method: :get, path: "/v1/quotes", 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)
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/stripe/services/quote_service.rb', line 58 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 |
#retrieve(quote, params = {}, opts = {}) ⇒ Object
Retrieves the quote with the given ID.
71 72 73 74 75 76 77 78 79 |
# File 'lib/stripe/services/quote_service.rb', line 71 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.
82 83 84 85 86 87 88 89 90 |
# File 'lib/stripe/services/quote_service.rb', line 82 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 |