Sha256: 28214f0c7e8bbb17d4eaf4d027fdc2cfeba858a330246d507175404d4afff538
Contents?: true
Size: 1.17 KB
Versions: 36
Compression:
Stored size: 1.17 KB
Contents
#!/usr/bin/env ruby require "bundler/setup" require "alula" require "./spec/helpers/fixture" require "dotenv/load" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. # (If you use this, don't forget to add pry to your Gemfile!) # require "pry" # Pry.start require 'irb' # setup API def auth_api token = oauth_token raise token if [Alula::Oauth::Error, Alula::RateLimitError].include? token.class setup_client(token) puts 'API configured successfully' end def setup_oatuh Alula::Oauth.configure( client_id: ENV['ALULA_API_CLIENT_ID'], client_secret: ENV['ALULA_API_CLIENT_SECRET'], api_url: ENV['ALULA_API_DOMAIN'] ) end def oauth_token setup_oatuh Alula::Oauth.authenticate( grant_type: :client_credentials, scopes: 'rpc:devices.register rpc:devices.assign rest:*' ) end def setup_client(token) Alula::Client.configure do |c| c.api_url = ENV['ALULA_API_DOMAIN'] c.api_key = token.access_token c.role = :system c.video_api_url = ENV['VIDEO_API_DOMAIN'] c.video_api_key = ENV['VIDEO_API_DOMAIN'] end end IRB.start(__FILE__)
Version data entries
36 entries across 36 versions & 1 rubygems