Module: Grafana::Preferences
- Included in:
- Client
- Defined in:
- lib/grafana/preferences.rb
Overview
original API Documentation can be found under: docs.grafana.org/http_api/preferences/#user-and-org-preferences-api
Instance Method Summary collapse
-
#org_preferences ⇒ Object
Get Current Org Prefs GET /api/org/preferences.
-
#update_org_preferences(params) ⇒ Object
Update Current Org Prefs PUT /api/org/preferences.
-
#update_user_preferences(params) ⇒ Object
Update Current User Prefs PUT /api/user/preferences.
-
#user_preferences ⇒ Object
Get Current User Prefs GET /api/user/preferences.
Instance Method Details
#org_preferences ⇒ Object
Get Current Org Prefs GET /api/org/preferences
46 47 48 49 50 51 52 53 54 |
# File 'lib/grafana/preferences.rb', line 46 def org_preferences() v, mv = version.values return { 'status' => 404, 'message' => format( 'only Grafana 5 has folder support. you use version %s', v) } if(mv != 5) endpoint = '/api/org/preferences' @logger.debug("Getting current organisation preferences (GET #{endpoint})") if @debug get(endpoint) end |
#update_org_preferences(params) ⇒ Object
Update Current Org Prefs PUT /api/org/preferences
theme - One of: light, dark, or an empty string for the default theme homeDashboardId - The numerical :id of a favorited dashboard, default: 0 timezone - One of: utc, browser, or an empty string for the default
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/grafana/preferences.rb', line 65 def update_org_preferences(params) raise ArgumentError.new(format('wrong type. \'params\' must be an Hash, given \'%s\'', params.class.to_s)) unless( params.is_a?(Hash) ) raise ArgumentError.new('missing \'params\'') if( params.size.zero? ) endpoint = '/api/org/preferences' @logger.debug("update current organisation preferences (GET #{endpoint})") if @debug update_preferences( endpoint, params ) end |
#update_user_preferences(params) ⇒ Object
Update Current User Prefs PUT /api/user/preferences
theme - One of: light, dark, or an empty string for the default theme homeDashboardId - The numerical :id of a favorited dashboard, default: 0 timezone - One of: utc, browser, or an empty string for the default
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/grafana/preferences.rb', line 32 def update_user_preferences(params) raise ArgumentError.new(format('wrong type. \'params\' must be an Hash, given \'%s\'', params.class.to_s)) unless( params.is_a?(Hash) ) raise ArgumentError.new('missing \'params\'') if( params.size.zero? ) endpoint = '/api/user/preferences' @logger.debug("update current user preferences (GET #{endpoint})") if @debug update_preferences( endpoint, params ) end |
#user_preferences ⇒ Object
Get Current User Prefs GET /api/user/preferences
14 15 16 17 18 19 20 21 22 |
# File 'lib/grafana/preferences.rb', line 14 def user_preferences() v, mv = version.values return { 'status' => 404, 'message' => format( 'only Grafana 5 has folder support. you use version %s', v) } if(mv != 5) endpoint = '/api/user/preferences' @logger.debug("Getting current user preferences (GET #{endpoint})") if @debug get(endpoint) end |