Class: GoodData::Command::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/gooddata/commands/api.rb

Overview

Low level access to GoodData API

Class Method Summary collapse

Class Method Details

.delete(path) ⇒ Object

Delete resource

Parameters:

  • path

    Resource path



52
53
54
55
56
57
58
59
60
# File 'lib/gooddata/commands/api.rb', line 52

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

.get(path) ⇒ Object

Get resource

Parameters:

  • path

    Resource path



40
41
42
43
44
45
46
47
48
# File 'lib/gooddata/commands/api.rb', line 40

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

.infoObject Also known as: index



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gooddata/commands/api.rb', line 14

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

.testObject

Test of login



30
31
32
33
34
35
36
# File 'lib/gooddata/commands/api.rb', line 30

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