# base-api-ruby-client This library is in Beta, so don't expect too much. ## Demo [Demo](https://github.com/ysksn/base-api-ruby-client-samples) ## Requirements - Ruby 2.2.2 or higher - [BASE developer account](https://developers.thebase.in/apply) ## Installation Add this line to your application's Gemfile: ``` gem 'base-api-client' ``` And then execute: ``` $ bundle ``` ## Usage Don't forget to require those modules and classes. ```ruby require 'base/apis' require 'base/api_client/client_secret' ``` ### Create an instance of ClientSecret ```ruby # Read default from config/client_secret.json client_secret = Base::APIClient::ClientSecret.new ``` or ```ruby client_secret = Base::APIClient::ClientSecret.new( client_id: 'e0b20d3fbb62bb5db4ebbb4ebebd43fb', client_secret: 'bd4b3ebbdbbebb6b6fb1d1bbb100b66b', redirect_uri: 'http://localhost.local/oauth2callback', search_client_id: '623fb5000b21b16163eb5b0bb646b53b', search_client_secret: '214b4134022dfbbf0230f5b0bbbbb2db') ``` ### Generate URI to retrieve code ```ruby client_secret.generate_code_uri ``` Set code ```ruby client_secret.code = request['code'] ``` ### Set access token ```ruby client_secret.set_tokens! ``` ### Retrieve my shop information ```ruby client_secret.my_info ``` ### Retrieve my items ```ruby client_secret.my_items ``` ### Retrieve my orders ```ruby orders = Base::Apis::Order.new(client_secret) orders.request ``` ### Retrieve savings ```ruby savings = Base::Apis::Saving.new(client_secret) savings.request ``` ### Retrieve delivery companies ```ruby dalivery_companies = Base::Apis::DeliveryCompany.new(client_secret) dalivery_companies.request ``` ### Retrieve item categories ```ruby categories = Base::Apis::Category.new(client_secret) categories.request ``` ### Retrieve detailed item category ```ruby category = Base::Apis::ItemCategory::Detail.new(client_secret) category.request(2_453_256) ``` ### Search items ```ruby search = Base::Apis::Search.new(client_secret) search.request('Tシャツ 白 シルクスクリーン 綿') ``` See [samples](https://github.com/ysksn/base-api-ruby-client-samples/blob/tmp/sample.rb) ### TODO(s) - Implement more such as: - Add - Item - Item image - Category - Item Category - Delete - Item info - Item image - Item variation - Category - Update - Item info - Item stok - Order status - Search - Refresh result ## License This library is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/ysksn/base-api-ruby-client/blob/master/LICENSE) ## References - [BASE](https://thebase.in/) - [BASE API v1 Document](https://github.com/baseinc/api-docs) - [ysksn/base-api-ruby-client](https://github.com/ysksn/base-api-ruby-client)