Class: Onlyfans::Resources::Bundles
- Inherits:
-
Object
- Object
- Onlyfans::Resources::Bundles
- Defined in:
- lib/onlyfans/resources/bundles.rb
Instance Method Summary collapse
-
#create(account, discount:, duration:, request_options: {}) ⇒ Onlyfans::Models::BundleCreateResponse
Create a new bundle for the account.
-
#delete(bundle_id, account:, request_options: {}) ⇒ Onlyfans::Models::BundleDeleteResponse
Delete a bundle for the account.
-
#initialize(client:) ⇒ Bundles
constructor
private
A new instance of Bundles.
-
#list(account, request_options: {}) ⇒ Onlyfans::Models::BundleListResponse
List all bundles for the account.
Constructor Details
#initialize(client:) ⇒ Bundles
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Bundles.
83 84 85 |
# File 'lib/onlyfans/resources/bundles.rb', line 83 def initialize(client:) @client = client end |
Instance Method Details
#create(account, discount:, duration:, request_options: {}) ⇒ Onlyfans::Models::BundleCreateResponse
Create a new bundle for the account.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/onlyfans/resources/bundles.rb', line 21 def create(account, params) parsed, = Onlyfans::BundleCreateParams.dump_request(params) query = Onlyfans::Internal::Util.encode_query_params(parsed) @client.request( method: :post, path: ["api/%1$s/bundles", account], query: query, model: Onlyfans::Models::BundleCreateResponse, options: ) end |
#delete(bundle_id, account:, request_options: {}) ⇒ Onlyfans::Models::BundleDeleteResponse
Delete a bundle for the account.
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/onlyfans/resources/bundles.rb', line 66 def delete(bundle_id, params) parsed, = Onlyfans::BundleDeleteParams.dump_request(params) account = parsed.delete(:account) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/%1$s/bundles/%2$s", account, bundle_id], model: Onlyfans::Models::BundleDeleteResponse, options: ) end |
#list(account, request_options: {}) ⇒ Onlyfans::Models::BundleListResponse
List all bundles for the account.
44 45 46 47 48 49 50 51 |
# File 'lib/onlyfans/resources/bundles.rb', line 44 def list(account, params = {}) @client.request( method: :get, path: ["api/%1$s/bundles", account], model: Onlyfans::Models::BundleListResponse, options: params[:request_options] ) end |