Project

youzan_api

0.0
No commit activity in last 3 years
No release in over 3 years
An easy way to call the youzan API's gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 10.0.2, ~> 10.0
>= 2.3.0, ~> 2.3
~> 0.15.2
>= 4.0.2, ~> 4.0
 Project Readme

有赞API集成Gem包(youzan_api gem

redis作为缓存,需要先启动redis-server

redis-server

配置环境变量

  • 复制.env.example文件为.env文件
  • 修改.env里面环境变量的值,根据具体情况进行配置
YOUZAN_CLIENT_ID="67cf2d831381d67ab8"
YOUZAN_CLIENT_SECRET="13172520585f3341c857ffb52e99b71a"
KDT_ID="41442241"
REDIS_HOST="127.0.0.1"

获取access_token

YouZan::TokenClient.new.access_token

获取单笔交易的信息(API name: youzan.trade.get)

YouZan::Api.new.get_youzan_trade(tid)

使用购买虚拟商品获得的码 (API name: youzan.trade.virtualcode.apply)

YouZan::Api.new.apply_virtual_code(code)