Sha256: da0e6474715bc2e87596fcea63269863919b47a1edf3c4ed32e99962f6696076

Contents?: true

Size: 1.64 KB

Versions: 35

Compression:

Stored size: 1.64 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require_relative '../exceptions/command_failed'

module GoodData
  module Command
    # Low level access to GoodData API
    class Api
      class << self
        def info
          json = {
            'releaseName' => 'N/A',
            'releaseDate' => 'N/A',
            'releaseNotesUri' => 'N/A'
          }

          puts 'GoodData API'
          puts "  Version: #{json['releaseName']}"
          puts "  Released: #{json['releaseDate']}"
          puts "  For more info see #{json['releaseNotesUri']}"
        end

        alias_method :index, :info

        # Test of login
        def test
          if GoodData.test_login
            puts "Succesfully logged in as #{GoodData.profile.user}"
          else
            puts 'Unable to log in to GoodData server!'
          end
        end

        # Get resource
        # @param path Resource path
        def get(path)
          fail(GoodData::CommandFailed, 'Specify the path you want to GET.') if path.nil?
          result = GoodData.get path
          begin
            result
          rescue
            puts result
          end
        end

        # Delete resource
        # @param path Resource path
        def delete(path)
          fail(GoodData::CommandFailed, 'Specify the path you want to DELETE.') if path.nil?
          result = GoodData.delete path
          begin
            result
          rescue
            puts result
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
gooddata-2.0.1-java lib/gooddata/commands/api.rb
gooddata-2.0.1 lib/gooddata/commands/api.rb
gooddata-2.0.0-java lib/gooddata/commands/api.rb
gooddata-2.0.0 lib/gooddata/commands/api.rb
gooddata-1.3.6-java lib/gooddata/commands/api.rb
gooddata-1.3.6 lib/gooddata/commands/api.rb
gooddata-1.3.5-java lib/gooddata/commands/api.rb
gooddata-1.3.5 lib/gooddata/commands/api.rb
gooddata-1.3.4-java lib/gooddata/commands/api.rb
gooddata-1.3.4 lib/gooddata/commands/api.rb
gooddata-1.3.3-java lib/gooddata/commands/api.rb
gooddata-1.3.3 lib/gooddata/commands/api.rb
gooddata-1.3.2-java lib/gooddata/commands/api.rb
gooddata-1.3.2 lib/gooddata/commands/api.rb
gooddata-1.3.1-java lib/gooddata/commands/api.rb
gooddata-1.3.1 lib/gooddata/commands/api.rb
gooddata-1.3.0-java lib/gooddata/commands/api.rb
gooddata-1.3.0 lib/gooddata/commands/api.rb
gooddata-1.2.1-java lib/gooddata/commands/api.rb
gooddata-1.2.1 lib/gooddata/commands/api.rb