Let’s assume that your fantastic code that you have is fairly simple. You would like to print the title of the project. So the session looks something like this
project_live_session: puts project.title "My project Test (2)" => nil
Not too fancy but it is enough to help us illustrate couple of points. First you need to save your code to a file. Go ahead take your favorite text editor and create a new file and put your code into it so it looks like this
Go ahead and save it and call it 'my_first_sdk_program.rb'. Do not execute because it would not work now. Let’s add couple more things.
Jack in does couple of things for you so you can be productive quickly but we have to handle them ourselves in a program.
Loads Automation SDK libraries
It logs you in and provides you the client as a
It jacks into a project and provides you the project as a
projectvariable. If you were wondering why the
project.titleworked in the interactive session in the first place since we never defined
projectthis is why.
We can easily do the same things with these 3 lines of code respectively. So add them to the file so the end result looks like this.
require 'gooddata' client = GoodData.connect('username', 'pass') project = client.projects('project_id') puts project.title
Done. Save it.
Now you can run it by using this command