tracyloisel / aliexpress-ruby-sdk

Aliexpress SDK for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AliexpressAPI

Aliexpress SDK for Ruby. 了解更多信息请访问 Aliexpress API 文档.

安装

添加 aliexpress-ruby-sdk 到你的 Gemfile:

gem 'aliexpress-ruby-sdk'

或通过gem安装 gem install aliexpress-ruby-sdk

require 'aliexpress_api'

Usage

1) 设置 App key 和 App secret

在 Rails initializer 中创建文件:config/initializers/omniauth.rb, 并加入以下代码

AliexpressAPI.configure do |config|
  config.app_key = "your App key"
  config.app_secret = "your App secret"

  # eg: config.service_endpoint = https://eco.taobao.com/router/rest
  config.service_endpoint = "SERVICE_ENDPOINT"
end

2) 向 Aliexpress 发送请求

调用 API 之前必须先激活 session:

# 成功授权后拿到的 token
AliexpressAPI::Base.activate_session "token"

调用 API

# 创建订单
AliexpressAPI::DsOrder.create!(
    logistics_address: {
      address: "china"
    },
    product_items: {
      product_count: 1,
      product_id: "4000518642376",
      sku_attr: "N",
      logistics_service_name: "EMS"
    }
)

# 获取订单信息
AliexpressAPI::DsOrder.find(300518642)

# 获取物流信息
AliexpressAPI::DsLogistic.tracking_info(
  logistics_no: "330211",
  out_ref: "300518642",
  service_name: "EMS",
  to_area: "US"
) 

3) API List

  • 功能实现
  • 功能未实现

-> Dropshipping

  • Dropshipping get product info
  • Dropshipping place order
  • Dropshipping obtain shipping info
  • Dropshipping get order info
  • Query simple information of product for dropshipper
  • Dropshipping get tracking info
  • Dropshipping sync sales data

-> other

  • all

License

The gem is available as open source under the terms of the MIT License.

About

Aliexpress SDK for Ruby

License:MIT License


Languages

Language:Ruby 99.2%Language:Shell 0.8%