Class: Superset::Tag::AddToObject
- Defined in:
- lib/superset/tag/add_to_object.rb
Constant Summary
Constants inherited from Request
Instance Attribute Summary collapse
-
#object_id ⇒ Object
readonly
Returns the value of attribute object_id.
-
#object_type_id ⇒ Object
readonly
Returns the value of attribute object_type_id.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Attributes inherited from Request
Instance Method Summary collapse
-
#initialize(object_type_id:, object_id:, tags: []) ⇒ AddToObject
constructor
A new instance of AddToObject.
- #params ⇒ Object
- #perform ⇒ Object
- #response ⇒ Object
- #validate_constructor_args ⇒ Object
Methods inherited from Request
call, #query_params, #result, #superset_host
Methods included from Display
#display_headers, #headings, #list, #list_attributes, #result, #rows, #table, #title
Constructor Details
#initialize(object_type_id:, object_id:, tags: []) ⇒ AddToObject
Returns a new instance of AddToObject.
9 10 11 12 13 |
# File 'lib/superset/tag/add_to_object.rb', line 9 def initialize(object_type_id:, object_id:, tags: []) @object_type_id = object_type_id @object_id = object_id @tags = end |
Instance Attribute Details
#object_id ⇒ Object (readonly)
Returns the value of attribute object_id.
7 8 9 |
# File 'lib/superset/tag/add_to_object.rb', line 7 def object_id @object_id end |
#object_type_id ⇒ Object (readonly)
Returns the value of attribute object_type_id.
7 8 9 |
# File 'lib/superset/tag/add_to_object.rb', line 7 def object_type_id @object_type_id end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
7 8 9 |
# File 'lib/superset/tag/add_to_object.rb', line 7 def @tags end |
Instance Method Details
#params ⇒ Object
25 26 27 28 29 |
# File 'lib/superset/tag/add_to_object.rb', line 25 def params { "properties": { "tags": } } end |
#perform ⇒ Object
15 16 17 18 19 |
# File 'lib/superset/tag/add_to_object.rb', line 15 def perform validate_constructor_args response # NOTE API response for success is {} .. not particularly informative end |
#response ⇒ Object
21 22 23 |
# File 'lib/superset/tag/add_to_object.rb', line 21 def response @response ||= client.post(route, params) end |
#validate_constructor_args ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/superset/tag/add_to_object.rb', line 31 def validate_constructor_args raise InvalidParameterError, "object_type_id integer is required" unless object_type_id.present? && object_type_id.is_a?(Integer) raise InvalidParameterError, "object_type_id is not a known value" unless ObjectType.list.include?(object_type_id) raise InvalidParameterError, "object_id integer is required" unless object_id.present? && object_id.is_a?(Integer) raise InvalidParameterError, "tags array is required" unless .present? && .is_a?(Array) raise InvalidParameterError, "tags array must contain string only values" unless .all? { |item| item.is_a?(String) } end |