Module: Idcf::JsonHyperSchema::Expands::LinkInfoBaseExtension
- Defined in:
- lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb
Overview
Link Info Base ext
Instance Method Summary collapse
-
#async? ⇒ Boolean
is async.
- #make_params_for_cli(args) ⇒ Object
- #make_uri_for_cli(args) ⇒ Object
- #parent_titles(schema = nil) ⇒ Object
-
#result_api_params(args, api_result, resource_id = nil) ⇒ Array
result api params.
-
#result_api_title ⇒ String
result api link title.
Instance Method Details
#async? ⇒ Boolean
is async
9 10 11 |
# File 'lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb', line 9 def async? !!@data.data['$async'] end |
#make_params_for_cli(args) ⇒ Object
44 45 46 |
# File 'lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb', line 44 def make_params_for_cli(args) make_params(args[url_param_names.size]) end |
#make_uri_for_cli(args) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb', line 37 def make_uri_for_cli(args) param_size = url_param_names.size url_params = args.slice(0, param_size) params = args[param_size] make_uri(url_params, params) end |
#parent_titles(schema = nil) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb', line 48 def parent_titles(schema = nil) result = [] if schema.present? parent_schema = schema.parent if parent_schema.present? result << parent_schema.title if parent_schema.title.present? result.concat(parent_titles(parent_schema)) end else result << title result.concat(parent_titles(@data)) result.reverse! end result end |
#result_api_params(args, api_result, resource_id = nil) ⇒ Array
result api params
27 28 29 30 31 32 33 34 35 |
# File 'lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb', line 27 def result_api_params(args, api_result, resource_id = nil) return [] if @data.data['$result'].nil? arg = Marshal.load(Marshal.dump(args)) target = @data.data['$result']['params'] target = target.nil? ? [] : target raise Idcf::Cli::Error::CliError, 'params is not Array' unless target.class == Array result = make_result_api_params(target, arg, api_result, resource_id) result end |
#result_api_title ⇒ String
result api link title
16 17 18 19 |
# File 'lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb', line 16 def result_api_title res = @data.data['$result'] res && res['title'] ? res['title'] : '' end |