Project

kc-sdk-app

0.0
No release in over a year
Kabob cloud client library.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0
~> 0.21.2

Runtime

 Project Readme

Build Status

kc-sdk-app

Provides kabob cloud app api client.

Installation

Add this line to your application's Gemfile:

gem 'kc-sdk-app'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kc-sdk-app

For rails, create config config/initializers/kc_sdk_app.rb

KcSdkApp.configure do |config|
  # kabob cloud api url, default: https://cloud.kabob.io
  config.api_url = 'https://cloud.kabob.io'

  # you have to set your app access token
  config.access_token = 'YOUR_APP_ACCESS_TOKEN'

  # you can set a logger if you want logging api request
  # config.logger = Rails.logger
end

Usage

Api

Api

Apps

current

Get current app

result = KcSdkApp.api.apps.current
# { "uid": 'kabob.lookr' }

Orders

surplus

Get surplus

result = KcSdkApp.api.orders.surplus(company_id: 1, plan: 'go', scope: 'point')
# { "data": 10, is_trial: false }
result = KcSdkApp.api.orders.surplus(company_id: 1, plan: 'go', scope: 'license')
# { "data": 10, is_trial: false, active_until: '2030-01-01 00:00:00' }
consuming

Consume order balance

result = KcSdkApp.api.orders.consuming(company_id: 1, plan: 'go', scope: 'point', quantity: 1, taken_at: '2020-12-25 00:00:00 UTC', uid: 'uid')
# { "meta": { "code": 0 } }

Switch App

The default app access token is the one defined in configuration.

If you want to request data as other apps, new an api instance with other access_token.

kc_api = KcSdkApp::Api.new(access_token: 'OTHER_APP_ACCESS_TOKEN')
kc_api.apps.current
# { "uid": 'kabob.other_app' }

Contact

The project's website is located at https://github.com/kabobcompany/kc-sdk-app-ruby