Class: Zm::Client::Tag
- Inherits:
-
Base::Object
- Object
- Base::Object
- Zm::Client::Tag
- Defined in:
- lib/zm/client/tag/tag.rb
Overview
class account tag
Instance Attribute Summary collapse
-
#color ⇒ Object
include Zm::Model::AttributeChangeObserver.
-
#id ⇒ Object
include Zm::Model::AttributeChangeObserver.
-
#name ⇒ Object
include Zm::Model::AttributeChangeObserver.
-
#rgb ⇒ Object
include Zm::Model::AttributeChangeObserver.
Attributes inherited from Base::Object
Instance Method Summary collapse
-
#create! ⇒ Object
define_changed_attributes :name, :color, :rgb.
- #delete! ⇒ Object
- #modify! ⇒ Object
- #rename!(new_name) ⇒ Object
- #update!(hash) ⇒ Object
Methods inherited from Base::Object
#clone, #initialize, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute
Constructor Details
This class inherits a constructor from Zm::Client::Base::Object
Instance Attribute Details
#color ⇒ Object
include Zm::Model::AttributeChangeObserver
9 10 11 |
# File 'lib/zm/client/tag/tag.rb', line 9 def color @color end |
#id ⇒ Object
include Zm::Model::AttributeChangeObserver
9 10 11 |
# File 'lib/zm/client/tag/tag.rb', line 9 def id @id end |
#name ⇒ Object
include Zm::Model::AttributeChangeObserver
9 10 11 |
# File 'lib/zm/client/tag/tag.rb', line 9 def name @name end |
#rgb ⇒ Object
include Zm::Model::AttributeChangeObserver
9 10 11 |
# File 'lib/zm/client/tag/tag.rb', line 9 def rgb @rgb end |
Instance Method Details
#create! ⇒ Object
define_changed_attributes :name, :color, :rgb
13 14 15 16 17 18 |
# File 'lib/zm/client/tag/tag.rb', line 13 def create! rep = @parent.sacc.invoke(jsns_builder.to_jsns) json = rep[:CreateTagResponse][:tag].first TagJsnsInitializer.update(self, json) @id end |
#delete! ⇒ Object
46 47 48 49 50 51 |
# File 'lib/zm/client/tag/tag.rb', line 46 def delete! return false if @id.nil? @parent.sacc.invoke(jsns_builder.to_delete) @id = nil end |
#modify! ⇒ Object
20 21 22 23 24 25 |
# File 'lib/zm/client/tag/tag.rb', line 20 def modify! # return unless color_changed? || rgb_changed? @parent.sacc.invoke(jsns_builder.to_update) true end |
#rename!(new_name) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/zm/client/tag/tag.rb', line 39 def rename!(new_name) return false if new_name == @name @parent.sacc.invoke(jsns_builder.to_rename(new_name)) @name = new_name end |
#update!(hash) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/zm/client/tag/tag.rb', line 27 def update!(hash) return false if hash.delete_if { |k, v| v.nil? || !respond_to?(k) }.empty? do_update!(hash) hash.each do |key, value| update_attribute(key, value) end true end |