{"id":16296221,"url":"https://github.com/nijicha/stock_shaker","last_synced_at":"2025-04-09T13:39:10.850Z","repository":{"id":182930563,"uuid":"138129253","full_name":"nijicha/stock_shaker","owner":"nijicha","description":"Unofficial Rubygems for Thailand eCommerce Marketplace","archived":false,"fork":false,"pushed_at":"2019-10-11T05:19:42.000Z","size":725,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-04-25T12:43:10.927Z","etag":null,"topics":["e-commerce","jd-central","lazada","lazop-api-client","rubygem","shopee"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/stock_shaker","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nijicha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-21T06:33:51.000Z","updated_at":"2023-06-07T09:58:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6b46999-c65e-40c5-98db-927193c260d4","html_url":"https://github.com/nijicha/stock_shaker","commit_stats":null,"previous_names":["nijicha/stock_shaker"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijicha%2Fstock_shaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijicha%2Fstock_shaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijicha%2Fstock_shaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nijicha%2Fstock_shaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nijicha","download_url":"https://codeload.github.com/nijicha/stock_shaker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248050669,"owners_count":21039431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["e-commerce","jd-central","lazada","lazop-api-client","rubygem","shopee"],"created_at":"2024-10-10T20:21:43.918Z","updated_at":"2025-04-09T13:39:10.833Z","avatar_url":"https://github.com/nijicha.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://rubygems.org/gems/stock_shaker\"\u003e\u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/icon.png?raw=true\" height=\"240\" alt=\"Stock Shaker Logo\" /\u003e\u003c/a\u003e\n  \u003ch3 align=\"center\"\u003eStock Shaker\u003c/h3\u003e\n  \u003cp align=\"center\"\u003eUnofficial Rubygems for Thailand eCommerce Marketplace\u003c/p\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/nijicha/stock_shaker.svg?style=for-the-badge\u0026label=Stars\" alt=\"Github Stars\" \u003e\n    \u003ca href=\"https://rubygems.org/gems/stock_shaker\"\u003e\u003cimg src=\"https://img.shields.io/gem/v/stock_shaker.svg?style=for-the-badge\" alt=\"Gem Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/nijicha/stock_shaker\"\u003e\u003cimg src=\"https://img.shields.io/travis/nijicha/stock_shaker/master.svg?style=for-the-badge\" alt=\"Branch master Travis-ci Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/nijicha/stock_shaker/blob/master/LICENSE.txt\"\u003e\u003cimg src=\"https://img.shields.io/github/license/nijicha/stock_shaker.svg?style=for-the-badge\" alt=\"License\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://forthebadge.com\"\u003e\u003cimg src=\"https://forthebadge.com/images/badges/built-with-love.svg\" alt=\"For The Badge Built with Love\" height=\"28\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://forthebadge.com\"\u003e\u003cimg src=\"https://forthebadge.com/images/badges/made-with-ruby.svg\" alt=\"For The Badge Made with Ruby\" height=\"28\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://shields.io/\"\u003e\u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/made_with-shield_io-green.svg\" alt=\"Shield.io Made with shield.io\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.lazada.co.th/\"\u003e\u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/market_place_support/love-lazada-sky-blue.svg\" alt=\"Love Lazada\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.shopee.co.th/\"\u003e\u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/market_place_support/love-shopee-orange.svg\" alt=\"Love Shopee\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\nA gems used to kick off API of eCommerce in Thailand. This gems inspired from [Official Lazada Open Platform Gems](https://rubygems.org/gems/lazop_api_client/versions/1.2.5)\n\n## Installation\n\n**StockShaker**'s installation is Easy! Add this line to your application's `Gemfile`\n\n```ruby\ngem 'stock_shaker', '~\u003e 0.3.5'\n```\n\nIf you'd rather install **StockShaker** with ruby-versions below than `2.4`.\n\nYou need to add `openssl` as dependencies in `Gemfile`\n\n```ruby\n# Gemfile\n \ngem 'stock_shaker', '~\u003e 0.3.5'\ngem 'openssl'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install stock_shaker\n\n## Usage\n\n### Configurable\n\n- Create `stock_shaker_config.rb` in `config/initializer`\n- Please ensure you already configured it.\n\n```ruby\n# config/initializer/stock_shaker_config.rb\nStockShaker.configure do |config|\n  # Lazada Configuration\n  config.lazada_config.app_key = ENV['YOUR_LAZADA_APP_KEY']\n  config.lazada_config.app_secret_key = ENV['YOUR_LAZADA_APP_SECRET_KEY']\n  config.lazada_config.redirect_url = ENV['YOUR_LAZADA_REDIRECT_URL']\n\n  # Shopee Configuration\n  config.shopee_config.partner_id = ENV['YOUR_SHOPEE_PARTNER_ID']\n  config.shopee_config.secret_key = ENV['YOUR_SHOPEE_SECRET_KEY']\n  config.shopee_config.redirect_url = ENV['YOUR_SHOPEE_REDIRECT_URL']\nend\n```\n### Do Authorization Link\n\n\u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/stock_shaker-new-orange.svg\" alt=\"NEW API\" /\u003e\n\n\u003cb\u003e* You should be define the `StockShaker.configure` before typing this command.\u003c/b\u003e\n\n#### Lazada\n```ruby\nStockShaker::Client::LazadaOP.do_authorization_link\n\n=\u003e \"https://auth.lazada.com/oauth/authorize?client_id=YOUR_LAZADA_APP_KEY\u0026force_auth=true\u0026redirect_uri=YOUR_LAZADA_REDIRECT_URL\u0026response_type=code\"\n```\n\n#### Shopee\n```ruby\nStockShaker::Client::ShopeeOP.do_authorization_link\n\n=\u003e \"https://partner.shopeemobile.com/api/v1/shop/auth_partner?id=YOUR_SHOPEE_PARTNER_ID\u0026redirect=YOUR_SHOPEE_REDIRECT_URL\u0026token=AUTHORIZATION_TOKEN\"\n```\n\n### Lazada Open Platform\n\n- \u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/lazada/lazada_api-system--api-yellow.svg\" alt=\"SystemAPI\" /\u003e\n\n    - \u003ca href=\"https://open.lazada.com/doc/api.htm?spm=a2o9m.11193487.0.0.3ac413feha8qCs#/api?cid=11\u0026path=/auth/token/create\"\u003e\n        \u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/lazada/generate_access_token.svg\" alt=\"Generate Access Token\" /\u003e\n      \u003c/a\u003e\n\n    ```ruby\n    server_url = StockShaker::Client::LAZADA_API_GATEWAY_URL_TH\n    lazada_client = StockShaker::Client::LazadaOP.new(server_url)\n    lazada_request = StockShaker::Request::LazadaOP.new('/auth/token/create', :post)\n    lazada_request_params = { code: 'YOUR_AUTHORIZATION_CODE' }\n    lazada_request_params.each { |key, value| request.add_lazada_api_params(key.to_s, value.to_s) }\n    response = lazada_client.execute(lazada_request)\n    response.success?\n    response.body\n    ```\n    \n    - \u003ca href=\"https://open.lazada.com/doc/api.htm?spm=a2o9m.11193487.0.0.3ac413feha8qCs#/api?cid=11\u0026path=/auth/token/refresh\"\u003e\n        \u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/lazada/refresh_access_token.svg\" alt=\"Refresh Access Token\" /\u003e\n      \u003c/a\u003e\n\n    ```ruby\n    server_url = StockShaker::Client::LAZADA_API_GATEWAY_URL_TH\n    lazada_client = StockShaker::Client::LazadaOP.new(server_url)\n    lazada_request = StockShaker::Request::LazadaOP.new('/auth/token/refresh', :post)\n    lazada_request_params = { refresh_token: 'YOUR_REFRESH_TOKEN' }\n    lazada_request_params.each { |key, value| request.add_lazada_api_params(key.to_s, value.to_s) }\n    response = lazada_client.execute(lazada_request)\n    response.success?\n    response.body\n    ```\n\n- \u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/lazada/lazada_api-order--api-yellow.svg\" alt=\"Lazada OrderAPI\" /\u003e\n\n    - \u003ca href=\"https://open.lazada.com/doc/api.htm?spm=a2o9m.11193535.0.0.62a738e4DBO8DQ#/api?cid=8\u0026path=/orders/get\"\u003e\n        \u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/lazada/get_orders-get-green.svg\" alt=\"OrderAPI GetOrders\" /\u003e\n      \u003c/a\u003e\n    \n    ```ruby\n    server_url = StockShaker::Client::LAZADA_API_GATEWAY_URL_TH\n    access_token = ENV['YOUR_ACCESS_TOKEN']\n    lazada_client = StockShaker::Client::LazadaOP.new(server_url)\n    lazada_request = StockShaker::Request::LazadaOP.new('/orders/get', :get)\n\n    # Get orders since last two days by update_after\n    days_backwards = 2 # Get backwards 2 days\n    update_after = StockShaker::DateUtil.datetime_to_iso8601(DateTime.now.beginning_of_day - days_backwards.days)\n  \n    lazada_request_params = { \n      created_before: '2018-02-10T16:00:00+07:00',\n      created_after: '2017-02-10T09:00:00+07:00',\n      status: 'shipped',\n      update_before: '2018-02-10T16:00:00+07:00',\n      sort_direction: 'DESC',\n      offset: 0,\n      limit: 100,\n      update_after: update_after,\n      sort_by: 'updated_at'\n    }\n\n    lazada_request_params.each { |key, value| request.add_lazada_api_params(key.to_s, value.to_s) }\n    response = lazada_client.execute(lazada_request, access_token)\n    puts response.success?\n    puts response.body\n    ```\n\n### Shopee Open Platform\n\n- \u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/shopee/shopee_api-order--api-yellow.svg\" alt=\"Shopee OrderAPI\" /\u003e\n\n    - \u003ca href=\"https://open.shopee.com/documents?module=4\u0026type=1\u0026id=399\"\u003e\n        \u003cimg src=\"https://github.com/nijicha/stock_shaker/blob/master/media/badge/shopee/get_orders_list-post-green.svg\" alt=\"OrderAPI GetOrdersList\" /\u003e\n      \u003c/a\u003e\n    \n    ```ruby\n    server_url = StockShaker::Client::SHOPEE_API_GATEWAY_URL_TH\n    shop_id = ENV['YOUR_SHOP_ID']\n    \n    update_time_from = StockShaker::DateUtil.datetime_to_timestamp(DateTime.now.beginning_of_day - 2.days)\n    update_time_to = StockShaker::DateUtil.datetime_to_timestamp(DateTime.now)\n    \n    client = StockShaker::Client::ShopeeOP.new(server_url, shop_id)\n    request = StockShaker::Request::ShopeeOP.new('/orders/basics', :post)\n    \n    request.add_shopee_api_params({\n      update_time_from: update_time_from,\n      update_time_to: update_time_to,\n      pagination_entries_per_page: 100,\n      pagination_offset: 0\n    })\n    \n    response = client.execute(request)\n    puts response.body\n    ```\n\n## Compatibility\nWe supported\n- Ruby MRI 2.2+\n- Rails 5.0+\n\n## Need helps!\n- Contributed this gems!\n- Write Test!\n\n## TODO\n\n### Core\n\n- [x] Configurable\n  - [ ] Validation\n- [ ] Generator\n- [ ] Write Rspec\n- [ ] Logger\n- [ ] Sentry.io Integration\n\n### Lazada\nSee more: [Lazada Open Platform Documentation](https://open.lazada.com/doc/api.htm?spm=a2o9m.11193535.0.0.62a738e4DBO8DQ#/api?cid=8\u0026path=/order/document/get)\n\n- [ ] Integrate with API reference\n- [ ] Order API\n    - [x] GetOrders\n    - [x] GetMultipleOrderItems\n- [ ] Product API\n    - [x] GetProducts\n    - [x] UpdatePriceQuantity\n- [ ] Finance API\n- [ ] Logistics API\n- [ ] Seller API\n- [x] System API\n    - [x] Generate Access Token\n    - [x] Refresh Access Token\n- [ ] DataMoat API\n\n### Shopee\nSee more: [Shopee Open Platform Documentation](https://open.shopee.com/documents)\n- [ ] Integrate with API reference\n- ItemAPI\n  - [x] GetItemsList (/items/get)\n  - [x] GetItemDetails (/item/get)\n  - [x] UpdateStock (/items/update_stock)\n  - [x] UpdateStockBatch (/items/update/items_stock)\n  - [x] UpdateVariationStock (/items/update_variation_stock)\n  - [x] UpdateVariationStockBatch (/items/update/vars_stock)\n  - [x] InsertItemImg (/item/img/insert)\n  - [x] DeleteItemImg (/item/img/delete)\n- OrderAPI\n  - [x] GetOrdersList (/orders/basics)\n  - [x] GetOrdersDetail (/orders/detail)\n  - [x] GetEscrowDetails (/orders/my_income)\n- ShopAPI\n  - [x] GetPerformance (/shop/performance)\n\n### JD Central\n\n- [ ] Integrate with API reference\n\n## Development\n1. `git clone https://github.com/nijicha/stock_shaker.git`\n2. `bundle install`\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [https://github.com/nijicha/stock_shaker](https://github.com/nijicha/stock_shaker).\n\nThis project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnijicha%2Fstock_shaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnijicha%2Fstock_shaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnijicha%2Fstock_shaker/lists"}