Class: MrMurano::Gateway::Settings

Inherits:
GweBase
  • Object
show all
Defined in:
lib/MrMurano/Gateway.rb

Constant Summary

Constants included from SolutionId

SolutionId::INVALID_API_ID, SolutionId::UNEXPECTED_TYPE_OR_ERROR_MSG

Constants included from Verbose

Verbose::TABULARIZE_DATA_FORMAT_ERROR

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 GweBase

#endpoint, #info, #initialize

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 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 AccountBase

#add_headers, #ask_for_password!, #ask_for_user!, #cfg_clear_user_and_business, #credentials_reset, #get, #initialize, #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

This class inherits a constructor from MrMurano::Gateway::GweBase

Instance Method Details

#identity_formatObject



78
79
80
81
82
83
84
# File 'lib/MrMurano/Gateway.rb', line 78

def identity_format
  ret = get
  return {} unless ret.is_a?(Hash)
  return {} unless ret.key?(:identity_format)
  return {} unless ret[:identity_format].is_a?(Hash)
  ret[:identity_format]
end

#identity_format=(x) ⇒ Object



86
87
88
89
90
91
92
# File 'lib/MrMurano/Gateway.rb', line 86

def identity_format=(x)
  raise 'Not Hash' unless x.is_a?(Hash)
  raise 'Not Hash' if x.key?(:options) && !x[:options].is_a?(Hash)
  x.delete_if { |k, _v| !i[type prefix options].include?(k) }
  x[:options].delete_if { |k, _v| !i[casing length].include?(k) }
  patch('', identity_format: x)
end

#protocolObject

Get the protocol settings



63
64
65
66
67
68
69
# File 'lib/MrMurano/Gateway.rb', line 63

def protocol
  ret = get
  return {} unless ret.is_a?(Hash)
  return {} unless ret.key?(:protocol)
  return {} unless ret[:protocol].is_a?(Hash)
  ret[:protocol]
end

#protocol=(x) ⇒ Object

Set the protocol settings



72
73
74
75
76
# File 'lib/MrMurano/Gateway.rb', line 72

def protocol=(x)
  raise 'Not Hash' unless x.is_a?(Hash)
  x.delete_if { |k, _v| !i[name devmode].include?(k) }
  patch('', protocol: x)
end

#provisioningObject



94
95
96
97
98
99
100
# File 'lib/MrMurano/Gateway.rb', line 94

def provisioning
  ret = get
  return {} unless ret.is_a?(Hash)
  return {} unless ret.key?(:provisioning)
  return {} unless ret[:provisioning].is_a?(Hash)
  ret[:provisioning]
end

#provisioning=(x) ⇒ Object



102
103
104
105
106
107
108
109
110
# File 'lib/MrMurano/Gateway.rb', line 102

def provisioning=(x)
  raise 'Not Hash' unless x.is_a?(Hash)
  raise 'Not Hash' if x.key?(:ip_whitelisting) && !x[:ip_whitelisting].is_a?(Hash)
  x.delete_if do |k, _v|
    !i[enabled auth_type generate_identity presenter_identity ip_whitelisting].include?(k)
  end
  x[:ip_whitelisting].delete_if { |k, _v| !i[enabled allowed].include?(k) }
  patch('', provisioning: x)
end