Sha256: 6390d225cfc33e72ff4f5a8ba8f1aa02f20e87ef8207fb73e8feb2ed1547c27f

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 KB

Contents

desc 'Zendesk and Crowdin info'
command :'project:info' do |c|
  c.action do |global_options, options, args|
    puts "ruby #{RUBY_VERSION}"
    puts "zci #{ZCI::VERSION}"
    puts "zendesk_help_center_api #{ZendeskAPI::HelpCenter::VERSION}"
    puts
    # Crowdin
    begin
      crowdin_info = @crowdin.project_info
      puts "Crowdin: authentication successful."
      puts "Crowdin: available locales:"
      crowdin_info["languages"].each do |lang|
        puts "  - #{lang['code']}"
      end
    rescue => e
      puts "Crowdin: API key is incorect"
    end
    puts

    # Zendesk
    if @zendesk.current_user.id
      puts "Zendesk: authentication successful."
      brands = @zendesk.brands

      brands.each do |brand|
        puts "Zendesk URL: #{brand.brand_url}"

        zendesk_url = brand.brand_url + "/api/v2"

        zendesk_client = ZCI.initialize_zendesk_client(
          zendesk_url,
          @cli_config['zendesk_username'],
          @cli_config['zendesk_password'],
          global_options[:verbose]
        )

        locales = zendesk_client.locales
        categories = zendesk_client.hc_categories

        puts "  available categories:"
        categories.each do |category|
          puts "    - #{category.id}: #{category.name}"
        end

        puts "  available locales:"
        locales.each do |locale|
          puts "    - #{locale.locale}"
        end
        puts
      end

    else
      puts "Zendesk: login and/or password is incorect"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zci-0.10.0 lib/zci/commands/06_info.rb
zci-0.9.0 lib/zci/commands/06_info.rb
zci-0.8.0 lib/zci/commands/06_info.rb
zci-0.7.2 lib/zci/commands/06_info.rb
zci-0.7.1 lib/zci/commands/06_info.rb
zci-0.7.0 lib/zci/commands/06_info.rb