Class: WhopSDK::Resources::Experiences
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Experiences
- Defined in:
- lib/whop_sdk/resources/experiences.rb
Instance Method Summary collapse
-
#attach(id, product_id: , request_options: {}) ⇒ WhopSDK::Models::Experience
Adds an experience to an product, making it accessible to the product’s customers.
-
#create(app_id: , company_id: , name: nil, section_id: nil, request_options: {}) ⇒ WhopSDK::Models::Experience
Required permissions:.
-
#delete(id, request_options: {}) ⇒ Boolean
Required permissions:.
-
#detach(id, product_id: , request_options: {}) ⇒ WhopSDK::Models::Experience
Removes an experience from an product, making it inaccessible to the product’s customers.
-
#duplicate(id, name: nil, request_options: {}) ⇒ WhopSDK::Models::Experience
Duplicates an existing experience.
-
#initialize(client:) ⇒ Experiences
constructor
private
A new instance of Experiences.
-
#list(company_id: , after: nil, app_id: nil, before: nil, created_after: nil, created_before: nil, first: nil, last: nil, product_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::ExperienceListResponse>
Lists experiences for a company.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Experience
Retrieves an experience by ID.
-
#update(id, access_level: nil, logo: nil, name: nil, order: nil, section_id: nil, request_options: {}) ⇒ WhopSDK::Models::Experience
Required permissions:.
Constructor Details
#initialize(client:) ⇒ Experiences
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 Experiences.
249 250 251 |
# File 'lib/whop_sdk/resources/experiences.rb', line 249 def initialize(client:) @client = client end |
Instance Method Details
#attach(id, product_id: , request_options: {}) ⇒ WhopSDK::Models::Experience
Adds an experience to an product, making it accessible to the product’s customers.
Required permissions:
-
‘experience:attach`
173 174 175 176 177 178 179 180 181 182 |
# File 'lib/whop_sdk/resources/experiences.rb', line 173 def attach(id, params) parsed, = WhopSDK::ExperienceAttachParams.dump_request(params) @client.request( method: :post, path: ["experiences/%1$s/attach", id], body: parsed, model: WhopSDK::Experience, options: ) end |
#create(app_id: , company_id: , name: nil, section_id: nil, request_options: {}) ⇒ WhopSDK::Models::Experience
Required permissions:
-
‘experience:create`
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/whop_sdk/resources/experiences.rb', line 25 def create(params) parsed, = WhopSDK::ExperienceCreateParams.dump_request(params) @client.request( method: :post, path: "experiences", body: parsed, model: WhopSDK::Experience, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Required permissions:
-
‘experience:delete`
146 147 148 149 150 151 152 153 |
# File 'lib/whop_sdk/resources/experiences.rb', line 146 def delete(id, params = {}) @client.request( method: :delete, path: ["experiences/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#detach(id, product_id: , request_options: {}) ⇒ WhopSDK::Models::Experience
Removes an experience from an product, making it inaccessible to the product’s customers.
Required permissions:
-
‘experience:detach`
202 203 204 205 206 207 208 209 210 211 |
# File 'lib/whop_sdk/resources/experiences.rb', line 202 def detach(id, params) parsed, = WhopSDK::ExperienceDetachParams.dump_request(params) @client.request( method: :post, path: ["experiences/%1$s/detach", id], body: parsed, model: WhopSDK::Experience, options: ) end |
#duplicate(id, name: nil, request_options: {}) ⇒ WhopSDK::Models::Experience
Duplicates an existing experience. The name will be copied, unless provided. The new experience will be attached to the same products as the original experience. If duplicating a Forum or Chat experience, the new experience will have the same settings as the original experience, e.g. who can post, who can comment, etc. No content, e.g. posts, messages, lessons from within the original experience will be copied.
Required permissions:
-
‘experience:create`
235 236 237 238 239 240 241 242 243 244 |
# File 'lib/whop_sdk/resources/experiences.rb', line 235 def duplicate(id, params = {}) parsed, = WhopSDK::ExperienceDuplicateParams.dump_request(params) @client.request( method: :post, path: ["experiences/%1$s/duplicate", id], body: parsed, model: WhopSDK::Experience, options: ) end |
#list(company_id: , after: nil, app_id: nil, before: nil, created_after: nil, created_before: nil, first: nil, last: nil, product_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::ExperienceListResponse>
Lists experiences for a company
Required permissions:
-
‘experience:hidden_experience:read`
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/whop_sdk/resources/experiences.rb', line 121 def list(params) parsed, = WhopSDK::ExperienceListParams.dump_request(params) @client.request( method: :get, path: "experiences", query: parsed, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::ExperienceListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Experience
Retrieves an experience by ID
47 48 49 50 51 52 53 54 |
# File 'lib/whop_sdk/resources/experiences.rb', line 47 def retrieve(id, params = {}) @client.request( method: :get, path: ["experiences/%1$s", id], model: WhopSDK::Experience, options: params[:request_options] ) end |
#update(id, access_level: nil, logo: nil, name: nil, order: nil, section_id: nil, request_options: {}) ⇒ WhopSDK::Models::Experience
Required permissions:
-
‘experience:update`
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/whop_sdk/resources/experiences.rb', line 79 def update(id, params = {}) parsed, = WhopSDK::ExperienceUpdateParams.dump_request(params) @client.request( method: :patch, path: ["experiences/%1$s", id], body: parsed, model: WhopSDK::Experience, options: ) end |