Sha256: e58d4bef390a5ec22ffa67856c404cba5dd5f5db93c632ad63e06df71f52b2cc

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'supersaas-api-client'

puts '# SuperSaaS Schedules Example'

unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.api_key
  puts 'ERROR! Missing account credentials. Rerun the script with your credentials, e.g.'
  puts 'SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_KEY=<xxxxxxxxxxxxxxxxxxxxxx> ./examples/users.rb'
  return
end

puts "## Account:  #{Supersaas::Client.instance.account_name}"
puts "## API KEY: #{'*' * Supersaas::Client.instance.api_key.size}"

Supersaas::Client.instance.verbose = true

puts 'listing schedules...'
puts '#### Supersaas::Client.instance.schedules.list'
schedules = Supersaas::Client.instance.schedules.list

puts 'listing schedule resources...'
[10, schedules.size].min&.times do |i|
  puts "#### Supersaas::Client.instance.schedules.resources(#{schedules[i].id})"
  # Capacity schedules bomb
  begin
    Supersaas::Client.instance.schedules.resources(schedules[i].id)
  rescue StandardError
    next
  end
end

puts 'puts listing fields...'
[10, schedules.size].min&.times do |i|
  puts "#### Supersaas::Client.instance.schedules.field_list(#{schedules[i].id})"
  Supersaas::Client.instance.schedules.field_list(schedules[i].id)
end
puts

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
supersaas-api-client-2.0.4 examples/schedules.rb
supersaas-api-client-2.0.3 examples/schedules.rb
supersaas-api-client-2.0.2 examples/schedules.rb