Sha256: 3da523c232f087d9d17ac745fef010e07d33a8266d637193bfc62b3713b47b0b

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

# encoding: UTF-8

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)
          raise(GoodData::CommandFailed, 'Specify the path you want to GET.') if path.nil?
          result = GoodData.get path
          result rescue puts result
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gooddata-0.6.0 lib/gooddata/commands/api.rb