class ChinoRuby::Applications

Public Instance Methods

create_application(name, grant_type, redirect_url) click to toggle source
# File lib/chino_ruby/classes.rb, line 301
def create_application(name, grant_type, redirect_url)
  check_string(name)
  check_string(grant_type)
  check_string(redirect_url)
  data = {"name": name, "grant_type": grant_type, "redirect_url": redirect_url}.to_json
  app = Application.new
  app.from_json(post_resource("/auth/applications", data).to_json, true)
  app
end
delete_application(app_id, force) click to toggle source
# File lib/chino_ruby/classes.rb, line 322
def delete_application(app_id, force)
  check_string(app_id)
  check_boolean(force)
  delete_resource("/auth/applications/#{app_id}", force)
end
get_application(app_id) click to toggle source
# File lib/chino_ruby/classes.rb, line 276
def get_application(app_id)
  check_string(app_id)
  app = Application.new
  app.from_json(get_resource("/auth/applications/#{app_id}").to_json, true)
  app
end
list_applications(limit=nil, offset=nil) click to toggle source
# File lib/chino_ruby/classes.rb, line 283
def list_applications(limit=nil, offset=nil)
  apps = GetApplicationsResponse.new
  if limit==nil && offset==nil
    apps.from_json(get_resource("/auth/applications", ChinoRuby::QUERY_DEFAULT_LIMIT, 0).to_json)
  else
    apps.from_json(get_resource("/auth/applications", limit, offset).to_json)
  end
  as = apps.applications
  apps.applications = []
  as.each do |a|
    app = Application.new
    app.app_id = a['app_id']
    app.app_name = a['app_name']
    apps.applications.push(app)
  end
  apps
end
update_application(app_id, name, grant_type, redirect_url) click to toggle source
# File lib/chino_ruby/classes.rb, line 311
def update_application(app_id, name, grant_type, redirect_url)
  check_string(name)
  check_string(grant_type)
  check_string(redirect_url)
  check_string(app_id)
  data = {"name": name, "grant_type": grant_type, "redirect_url": redirect_url}.to_json
  app = Application.new
  app.from_json(put_resource("/auth/applications/#{app_id}", data).to_json, true)
  app
end