class Object
Public Instance Methods
c()
click to toggle source
# File lib/spark_api/cli/setup.rb, line 45 def c SparkApi.client end
delete(path, options={})
click to toggle source
# File lib/spark_api/cli/setup.rb, line 63 def delete(path, options={}) c.delete(path, options) end
get(path, options={})
click to toggle source
Straight up HTTP functions y'all!!!
# File lib/spark_api/cli/setup.rb, line 51 def get(path, options={}) c.get(path, options) end
load_oauth2_session(session_alias = "default")
click to toggle source
# File lib/spark_api/cli/setup.rb, line 74 def load_oauth2_session session_alias = "default" c.oauth2_provider.session = "" rescue => e puts "Unable to find a saved oauth2 session: #{e.message}" end
persist_sessions!(my_alias = nil)
click to toggle source
Enables saving and loading serialized oauth2 sessions for the system user.
# File lib/spark_api/cli/oauth2.rb, line 27 def persist_sessions! my_alias = nil warn "Warning: persistent session mode saves access tokens in clear text on the filesystem." SparkApi.client.oauth2_provider.session_alias = my_alias unless my_alias.nil? SparkApi.client.oauth2_provider.persistent_sessions = true end
post(path, body = nil, options={})
click to toggle source
# File lib/spark_api/cli/setup.rb, line 55 def post(path, body = nil, options={}) c.post(path, body, options) end
put(path, body = nil, options={})
click to toggle source
# File lib/spark_api/cli/setup.rb, line 59 def put(path, body = nil, options={}) c.put(path, body, options) end
save_oauth2_session!(session_alias = "default")
click to toggle source
Handy session persistence
# File lib/spark_api/cli/setup.rb, line 68 def save_oauth2_session! session_alias = "default" rescue => e puts "Unable to save the oauth2 session: #{e.message}" end