Giter Site home page Giter Site logo

aliexpress-ruby-sdk's Introduction

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.

aliexpress-ruby-sdk's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.