Class: MrMurano::Keystore

Inherits:
ServiceConfig show all
Defined in:
lib/MrMurano/Keystore.rb

Constant Summary

Constants included from Verbose

Verbose::TABULARIZE_DATA_FORMAT_ERROR

Constants included from SolutionId

SolutionId::INVALID_API_ID, SolutionId::UNEXPECTED_TYPE_OR_ERROR_MSG

Constants included from AccountBase

AccountBase::LOGIN_ADVICE, AccountBase::LOGIN_NOTICE

Instance Attribute Summary

Attributes included from SolutionId

#api_id, #sid, #valid_api_id

Instance Method Summary collapse

Methods inherited from ServiceConfig

#call, #create, #fetch, #info, #list, #logs, #must_id!, #remove, #scid, #scid_for_name, #search

Methods inherited from SolutionBase

#==, #endpoint, #search

Methods included from SyncUpDown

#config_vars_decode, #config_vars_encode, #debug_print_localitems, #diff_download, #diff_item_write, #docmp, #download, #ignore?, #ignoring, #list, #localitems, #locallist, #locallist_add_item, #locallist_complain_missing, #locallist_mark_seen, #location, #match, #remove, #remove_or_clear, #removelocal, #resolve_config_var_usage!, #resurrect_undeletables, #searchFor, #syncdown_after, #syncdown_before, #synckey, #syncup_after, #syncup_before, #to_remote_items, #tolocalname, #tolocalpath, #update_mtime, #upload

Methods included from Verbose

ask_yes_no, #ask_yes_no, #assert, assert, cmd_confirm_delete!, #cmd_confirm_delete!, debug, #debug, dump_file_json, dump_file_plain, dump_file_yaml, #dump_output_file, #error, error, #error_file_format!, fancy_ticks, #fancy_ticks, #load_file_json, #load_file_plain, #load_file_yaml, #load_input_file, outf, #outf, #outformat_engine, #pluralize?, pluralize?, #prepare_hash_csv, #read_hashf!, #tabularize, tabularize, verbose, #verbose, warning, #warning, #whirly_interject, whirly_interject, #whirly_linger, whirly_linger, #whirly_msg, whirly_msg, #whirly_pause, whirly_pause, #whirly_start, whirly_start, #whirly_stop, whirly_stop, #whirly_unpause, whirly_unpause

Methods included from SyncCore

#debug_selected, #dodiff, #dodiff_build_cmd, #dodiff_cull_tempfile_paths, #dodiff_do_diff, #dodiff_download_remote, #dodiff_flexible, #dodiff_header_aware, #dodiff_local_to_tempfile, #dodiff_prepare_local_and_diff, #dodiff_resolve_localname, #dodiff_tempfile_paths, #filter_solution, #init_mods_and_chgs_arrs, #item_dirty_set_status, #item_local_there_merged, #item_merged_diff_status, #item_merged_set_status, #item_select_selected!, #items_classify_and_find_duplicates, #items_cull_clashes!, #items_lists, #items_log_duplicates, #items_log_duplicates_there_local, #items_mods_and_chgs!, #items_new_and_old!, #select_selected!, #sort_by_name, #status, #sync_update_progress, #syncable_validate_api_id, #syncdown, #syncdown_item, #syncup, #syncup_item

Methods included from SyncAllowed

#download_item_allowed, #remove_item_allowed, #removelocal_item_allowed, #sync_item_allowed, #upload_item_allowed

Methods included from SolutionId

#affirm_valid, #api_id?, #endpoint, #init_api_id!, #valid_api_id?

Methods included from AccountBase

#add_headers, #ask_for_password!, #ask_for_user!, #cfg_clear_user_and_business, #credentials_reset, #get, #invalidate_token, #login_info, #logout, #must_prompt_if_logged_off!, #token, #token_reset, #verify_cfg_auth!, #verify_cfg_auth_persist, #verify_cfg_auth_scheme!, #verify_cfg_auth_ttl, #verify_set, warn_configfile_env_maybe

Methods included from Http

#add_headers, #curldebug, curldebug_after, curldebug_elapsed, curldebug_log, #delete, #endpoint, #get, #host, #http, #http_reset, #isJSON, #json_opts, #patch, #post, #postf, #put, #showHttpError, #user, #workit, #workit_response

Constructor Details

#initialize(api_id = nil) ⇒ Keystore

Returns a new instance of Keystore.



12
13
14
15
16
17
# File 'lib/MrMurano/Keystore.rb', line 12

def initialize(api_id=nil)
  # FIXME/2017-07-03: Do products have a keystore service? What about other soln types?
  @solntype = 'application.id'
  super
  @service_name = 'keystore'
end

Instance Method Details

#clearallObject



49
50
51
# File 'lib/MrMurano/Keystore.rb', line 49

def clearall
  call(:clear, :post, {})
end

#command(key, cmd, args) ⇒ Object



45
46
47
# File 'lib/MrMurano/Keystore.rb', line 45

def command(key, cmd, args)
  call(:command, :post, key: key, command: cmd, args: args)
end

#delkey(key) ⇒ Object



40
41
42
43
# File 'lib/MrMurano/Keystore.rb', line 40

def delkey(key)
  key = URI.encode_www_form_component(key)
  call(:delete, :post, key: key)
end

#getkey(key) ⇒ Object



28
29
30
31
32
# File 'lib/MrMurano/Keystore.rb', line 28

def getkey(key)
  key = URI.encode_www_form_component(key)
  ret = call(:get, :post, key: key)
  ret[:value]
end

#keyinfoObject



19
20
21
# File 'lib/MrMurano/Keystore.rb', line 19

def keyinfo
  call(:info)
end

#listkeysObject



23
24
25
26
# File 'lib/MrMurano/Keystore.rb', line 23

def listkeys
  ret = call(:list)
  ret[:keys]
end

#setkey(key, value) ⇒ Object



34
35
36
37
38
# File 'lib/MrMurano/Keystore.rb', line 34

def setkey(key, value)
  key = URI.encode_www_form_component(key)
  value = URI.encode_www_form_component(value)
  call(:set, :post, key: key, value: value)
end