Class: GoodData::Command::Api
Overview
Low level access to GoodData API
Class Method Summary collapse
-
.delete(args, opts) ⇒ Object
Delete resource.
-
.get(args, opts) ⇒ Object
Get resource.
- .info ⇒ Object (also: index)
- .post(args, opts) ⇒ Object
-
.test ⇒ Object
Test of login.
Class Method Details
.delete(args, opts) ⇒ Object
Delete resource
49 50 51 52 53 54 55 |
# File 'lib/gooddata/commands/api.rb', line 49 def delete(args, opts) path = args.first fail(GoodData::CommandFailed, 'Specify the path you want to DELETE.') if path.nil? client = GoodData.connect(opts) client.delete path end |
.get(args, opts) ⇒ Object
Get resource
39 40 41 42 43 44 45 |
# File 'lib/gooddata/commands/api.rb', line 39 def get(args, opts) path = args.first fail(GoodData::CommandFailed, 'Specify the path you want to GET.') if path.nil? client = GoodData.connect(opts) client.get path end |
.info ⇒ Object Also known as: index
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gooddata/commands/api.rb', line 13 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 |
.post(args, opts) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/gooddata/commands/api.rb', line 57 def post(args, opts) path = Array(args).shift fail(GoodData::CommandFailed, 'Specify the path you want to POST to.') if path.nil? payload = Array(args).shift json = payload && File.exist?(payload) ? JSON.parse(File.read(payload)) : {} client = GoodData.connect(opts) client.post path, json end |