Class: Stripe::PriceService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::PriceService
- Defined in:
- lib/stripe/services/price_service.rb
Defined Under Namespace
Classes: CreateParams, ListParams, RetrieveParams, SearchParams, UpdateParams
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Creates a new price for an existing product.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your active prices, excluding [inline prices](stripe.com/docs/products-prices/pricing-models#inline-pricing).
-
#retrieve(price, params = {}, opts = {}) ⇒ Object
Retrieves the price with the given ID.
-
#search(params = {}, opts = {}) ⇒ Object
Search for prices you’ve previously created using Stripe’s [Search Query Language](stripe.com/docs/search#search-query-language).
-
#update(price, params = {}, opts = {}) ⇒ Object
Updates the specified price by setting the values of the parameters passed.
Methods inherited from StripeService
#initialize, #request, #request_stream
Constructor Details
This class inherits a constructor from Stripe::StripeService
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Creates a new price for an existing product. The price can be recurring or one-time.
610 611 612 |
# File 'lib/stripe/services/price_service.rb', line 610 def create(params = {}, opts = {}) request(method: :post, path: "/v1/prices", params: params, opts: opts, base_address: :api) end |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your active prices, excluding [inline prices](stripe.com/docs/products-prices/pricing-models#inline-pricing). For the list of inactive prices, set active to false.
615 616 617 |
# File 'lib/stripe/services/price_service.rb', line 615 def list(params = {}, opts = {}) request(method: :get, path: "/v1/prices", params: params, opts: opts, base_address: :api) end |
#retrieve(price, params = {}, opts = {}) ⇒ Object
Retrieves the price with the given ID.
620 621 622 623 624 625 626 627 628 |
# File 'lib/stripe/services/price_service.rb', line 620 def retrieve(price, params = {}, opts = {}) request( method: :get, path: format("/v1/prices/%<price>s", { price: CGI.escape(price) }), params: params, opts: opts, base_address: :api ) end |
#search(params = {}, opts = {}) ⇒ Object
Search for prices you’ve previously created using Stripe’s [Search Query Language](stripe.com/docs/search#search-query-language). Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
634 635 636 637 638 639 640 641 642 |
# File 'lib/stripe/services/price_service.rb', line 634 def search(params = {}, opts = {}) request( method: :get, path: "/v1/prices/search", params: params, opts: opts, base_address: :api ) end |
#update(price, params = {}, opts = {}) ⇒ Object
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
645 646 647 648 649 650 651 652 653 |
# File 'lib/stripe/services/price_service.rb', line 645 def update(price, params = {}, opts = {}) request( method: :post, path: format("/v1/prices/%<price>s", { price: CGI.escape(price) }), params: params, opts: opts, base_address: :api ) end |