Module: Occi::Api::Client::Base::ActionMethods
- Included in:
- ClientBase
- Defined in:
- lib/occi/api/client/base/action_methods.rb
Instance Method Summary collapse
-
#get_action_type_identifier(type, for_kind_w_term = nil) ⇒ String?
Retrieves available action type identifier for the given action type.
-
#get_action_type_identifiers ⇒ Array<String>
Retrieves all available action type identifiers.
-
#get_action_types ⇒ Array<String>
Retrieves all available action types.
Instance Method Details
#get_action_type_identifier(type, for_kind_w_term = nil) ⇒ String?
Retrieves available action type identifier for the given action type.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/occi/api/client/base/action_methods.rb', line 42 def get_action_type_identifier(type, for_kind_w_term = nil) return type if (type =~ URI::ABS_URI) || (type && type.start_with?('/')) acts = @model.actions.to_a.select { |k| k.term == type } tis = acts.collect { |c| c.type_identifier } tis.uniq! tis.keep_if { |ti| ti.include? "/#{for_kind_w_term}/" } unless for_kind_w_term.blank? if tis.length > 1 raise Occi::Api::Client::Errors::AmbiguousNameError, "Action type #{type.inspect} is ambiguous, use a type identifier!" end tis.first end |
#get_action_type_identifiers ⇒ Array<String>
Retrieves all available action type identifiers.
25 26 27 |
# File 'lib/occi/api/client/base/action_methods.rb', line 25 def get_action_type_identifiers @model.actions.to_a.collect { |action| action.type_identifier } end |
#get_action_types ⇒ Array<String>
Retrieves all available action types.
12 13 14 |
# File 'lib/occi/api/client/base/action_methods.rb', line 12 def get_action_types @model.actions.to_a.collect { |action| action.term } end |