Sha256: f471dd873154b2075be0f422da64c7aa9d3ab434e348eb4f7491c61d1f8f59b0
Contents?: true
Size: 736 Bytes
Versions: 10
Compression:
Stored size: 736 Bytes
Contents
module Paddle module Classic class PlansResource < Resource def list response = post_request("2.0/subscription/plans") Collection.from_response(response, type: Plan) end 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)) # After creating the Plan, because it doesn't return the whole record, grab it from the API and return that 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 end end end
Version data entries
10 entries across 10 versions & 1 rubygems