Sha256: b0d91dd4fa2c4911051e5aaa5bb2857475622d6c4f04ad3ce9d8deedcb0aa60a
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'bundler/setup' require 'zoho_hub' require 'zoho_hub/settings/module' require 'zoho_hub/records/base_record' require 'dotenv' Dotenv.load ZohoHub.configure do |config| config.client_id = ENV['ZOHO_CLIENT_ID'] config.secret = ENV['ZOHO_SECRET'] config.redirect_uri = ENV['ZOHO_OAUTH_REDIRECT_URL'] end token_params = ZohoHub::Auth.refresh_token(ENV['ZOHO_REFRESH_TOKEN']) ZohoHub.setup_connection(token_params) puts "Reading modules for client ID: #{ENV['ZOHO_CLIENT_ID']}..." modules_hashes = ZohoHub::Settings::Module.all_json puts "Found #{modules_hashes.size} modules" modules_hashes.each do |hash| puts "- Writing configuration for #{hash[:plural_label]}" file_name = File.join(ZohoHub.root, 'cache', 'modules', "#{hash[:api_name]}.json") File.open(file_name, 'w') do |file| file.write(JSON.pretty_generate(hash)) end next unless hash[:api_supported] fields_array = ZohoHub::Settings::Field.all_json_for(hash[:api_name]) file_name = File.join(ZohoHub.root, 'cache', 'fields', "#{hash[:api_name]}.json") File.open(file_name, 'w') do |file| file.write(JSON.pretty_generate(fields_array)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zoho_hub-0.2.0 | bin/read |
zoho_hub-0.1.9 | bin/read |