Class: Paddle::Classic::PlansResource
- Inherits:
-
Resource
- Object
- Resource
- Paddle::Classic::PlansResource
show all
- Defined in:
- lib/paddle/classic/resources/plans.rb
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#initialize
Instance Method Details
#create(name:, type:, **params) ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/paddle/classic/resources/plans.rb', line 9
def create(name:, type:, **params)
attrs = { plan_name: name, plan_type: type }
create_response = post_request("2.0/subscription/plans_create", body: attrs.merge(params))
response = post_request("2.0/subscription/plans", body: { plan: create_response.body["response"]["product_id"] })
Plan.new(response.body.dig("response")[0]) if response.success?
end
|
4
5
6
7
|
# File 'lib/paddle/classic/resources/plans.rb', line 4
def list
response = post_request("2.0/subscription/plans")
Collection.from_response(response, type: Plan)
end
|