Class: PayPal::SDK::Subscriptions::Plan
- Inherits:
-
RequestBase
- Object
- Core::API::DataTypes::Base
- RequestAPIBase
- RequestBase
- PayPal::SDK::Subscriptions::Plan
- Defined in:
- lib/paypal-sdk/subscriptions/plan.rb
Overview
v1/billing/plans
Defined Under Namespace
Classes: BillingCycle, Page, PaymentPreferences, Taxes
Instance Attribute Summary
Attributes inherited from RequestAPIBase
Class Method Summary collapse
-
.all(options = {}) ⇒ Object
options include ‘page’, ‘page_size’, and ‘total_required’.
- .path(resource_id = nil) ⇒ Object
Instance Method Summary collapse
- #activate ⇒ Object
- #deactivate ⇒ Object
- #reload ⇒ Object
-
#update(patch) ⇒ Object
developer.paypal.com/docs/api/subscriptions/v1/#plans_patch patch [Hash] { op: ‘replace’, path: , value: } path = [description|payment_preferences.auto_bill_outstanding|taxes.percentage|payment_preferences.payment_failure_threshold].
- #update_pricing(*schemes) ⇒ Object
Methods inherited from RequestBase
#commit, #create, create!, find, #path
Methods inherited from RequestAPIBase
#http_header, #merge!, #raise_error!, raise_on_api_error, #success?
Methods included from RequestDataType
Class Method Details
.all(options = {}) ⇒ Object
options include ‘page’, ‘page_size’, and ‘total_required’
85 86 87 |
# File 'lib/paypal-sdk/subscriptions/plan.rb', line 85 def all( = {}) Page.new(api.get(path, )) end |
.path(resource_id = nil) ⇒ Object
80 81 82 |
# File 'lib/paypal-sdk/subscriptions/plan.rb', line 80 def path(resource_id = nil) "v1/billing/plans/#{resource_id}" end |
Instance Method Details
#activate ⇒ Object
51 52 53 |
# File 'lib/paypal-sdk/subscriptions/plan.rb', line 51 def activate commit("#{path(id)}/activate") end |
#deactivate ⇒ Object
56 57 58 |
# File 'lib/paypal-sdk/subscriptions/plan.rb', line 56 def deactivate commit("#{path(id)}/deactivate") end |
#reload ⇒ Object
90 91 92 93 |
# File 'lib/paypal-sdk/subscriptions/plan.rb', line 90 def reload merge! api.get(self.class.path id) success? end |
#update(patch) ⇒ Object
developer.paypal.com/docs/api/subscriptions/v1/#plans_patch patch [Hash] { op: ‘replace’, path: , value: } path = [description|payment_preferences.auto_bill_outstanding|taxes.percentage|payment_preferences.payment_failure_threshold]
41 42 43 |
# File 'lib/paypal-sdk/subscriptions/plan.rb', line 41 def update(patch) super end |
#update_pricing(*schemes) ⇒ Object
45 46 47 48 |
# File 'lib/paypal-sdk/subscriptions/plan.rb', line 45 def update_pricing(*schemes) payload = { pricing_schemes: schemes.map(&:to_hash) } commit("#{path(id)}/update-pricing-schemes", payload) end |