Spree Wishlist 项目技术文档
1. 安装指南
在开始使用Spree Wishlist扩展之前,您需要按照以下步骤进行安装:
-
将以下内容添加到您的
Gemfile
文件中:gem 'spree_wishlist', github: 'spree-contrib/spree_wishlist', branch: 'master'
-
运行以下命令来安装依赖项并进行必要的设置:
bundle install bundle exec rails g spree_wishlist:install
请确保您的环境已经安装了Spree,并且所有的依赖项都已正确配置。
2. 项目使用说明
Spree Wishlist扩展允许用户创建和管理多个心愿单,这些心愿单可以是公开的(可共享)或私有的。此外,用户还可以通过电子邮件向朋友推荐产品。
3. 项目API使用文档
在使用API前,请先阅读Spree API v1 summary。
以下是可用的API端点:
心愿单管理
-
GET /api/v1/wishlists
- 返回当前登录用户的心愿单列表。 -
GET /api/v1/wishlists/:id
- 返回指定ID的心愿单及其产品列表。 -
POST /api/v1/wishlists
- 创建一个新的心愿单。请求内容:
{ "wishlist": { "name": "父亲节礼物" } }
-
PATCH /api/v1/wishlists/:id
- 更新指定ID的心愿单。请求内容:
{ "wishlist": { "name": "新名称" } }
-
DELETE /api/v1/wishlists/:id
- 删除指定ID的心愿单。
心愿单产品管理
-
POST /api/v1/wished_products
- 将产品(变体)添加到心愿单。请求内容:
{ "wished_product": { "variant_id": 2, "wishlist_id": 1 } }
-
PATCH /api/v1/wished_products/:id
- 更新指定ID的心愿单中的产品。请求内容:
{ "wished_product": { "variant_id": 3, "wishlist_id": 2 } }
-
DELETE /api/v1/wished_products/:id
- 从心愿单中删除指定ID的产品。
心愿单V2
心愿单管理
-
GET /api/v2/storefront/wishlists
- 返回当前登录用户的心愿单列表。 -
GET /api/v2/storefront/wishlists/:access_hash
- 返回具有特定访问哈希的心愿单及其产品列表。请求参数:
{ "include": "wished_products.variant" }
-
PATCH /api/v2/storefront/wishlists/:access_hash
- 更新具有特定访问哈希的心愿单。请求内容:
{ "wishlist": { "name": "心愿单名称", "is_default": true, "is_private": true } }
-
POST /api/v2/storefront/wishlists
- 创建一个新的心愿单。请求内容:
{ "wishlist": { "name": "心愿单名称", "is_default": true, "is_private": true } }
-
DELETE /api/v2/storefront/wishlists/:access_hash
- 删除具有特定访问哈希的心愿单。
心愿单产品管理
-
POST /api/v2/storefront/wishlists/:access_hash/wished_products
- 将产品(变体)添加到具有特定访问哈希的心愿单。请求内容:
{ "wished_product": { "variant_id": 2, "remark": "我想要这个", "quantity": 3 } }
-
PATCH /api/v2/storefront/wishlists/:access_hash/wished_products/:id
- 更新具有特定访问哈希的心愿单中的产品。请求内容:
{ "wished_product": { "variant_id": 2, "remark": "我想要这个", "quantity": 4 } }
-
DELETE /api/v2/storefront/wishlists/:access_hash/wished_products/:id
- 从具有特定访问哈希的心愿单中删除产品。
4. 项目安装方式
项目的安装方式已在“安装指南”部分详细说明,请参照执行以下步骤:
- 修改
Gemfile
,添加Spree Wishlist扩展。 - 运行
bundle install
安装依赖项。 - 执行
bundle exec rails g spree_wishlist:install
进行必要的设置。
以上步骤将帮助您成功安装Spree Wishlist扩展,并开始使用其功能。
鸿蒙开发工具大赶集
本仓将收集和展示鸿蒙开发工具,欢迎大家踊跃投稿。通过pr附上您的工具介绍和使用指南,并加上工具对应的链接,通过的工具将会成功上架到我们社区。012hertz
Go 微服务 HTTP 框架,具有高易用性、高性能、高扩展性等特点。Go01每日精选项目
🔥🔥 每日精选已经升级为:【行业动态】,快去首页看看吧,后续都在【首页 - 行业动态】内更新,多条更新哦~🔥🔥 每日推荐行业内最新、增长最快的项目,快速了解行业最新热门项目动态~~029kitex
Go 微服务 RPC 框架,具有高性能、强可扩展的特点。Go00Cangjie-Examples
本仓将收集和展示高质量的仓颉示例代码,欢迎大家投稿,让全世界看到您的妙趣设计,也让更多人通过您的编码理解和喜爱仓颉语言。Cangjie057毕方Talon工具
本工具是一个端到端的工具,用于项目的生成IR并自动进行缺陷检测。Python040PDFMathTranslate
PDF scientific paper translation with preserved formats - 基于 AI 完整保留排版的 PDF 文档全文双语翻译,支持 Google/DeepL/Ollama/OpenAI 等服务,提供 CLI/GUI/DockerPython06mybatis-plus
mybatis 增强工具包,简化 CRUD 操作。 文档 http://baomidou.com 低代码组件库 http://aizuda.comJava03国产编程语言蓝皮书
《国产编程语言蓝皮书》-编委会工作区018- DDeepSeek-R1探索新一代推理模型,DeepSeek-R1系列以大规模强化学习为基础,实现自主推理,表现卓越,推理行为强大且独特。开源共享,助力研究社区深入探索LLM推理能力,推动行业发展。【此简介由AI生成】。Python00
热门内容推荐
最新内容推荐
项目优选









