Class: Zm::Client::ConcatMember
- Inherits:
-
Object
- Object
- Zm::Client::ConcatMember
- Defined in:
- lib/zm/client/contact/contact_member.rb
Constant Summary collapse
- INTERNAL =
'C'- FREE =
'I'- LDAP =
'G'- ADD =
'+'- DEL =
'-'
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #add! ⇒ Object
- #concat ⇒ Object
- #construct_soap_node ⇒ Object
- #free? ⇒ Boolean
-
#initialize(type, value, op = nil) ⇒ ConcatMember
constructor
A new instance of ConcatMember.
- #internal? ⇒ Boolean
- #ldap? ⇒ Boolean
- #remove! ⇒ Object
- #shared? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(type, value, op = nil) ⇒ ConcatMember
Returns a new instance of ConcatMember.
28 29 30 31 32 |
# File 'lib/zm/client/contact/contact_member.rb', line 28 def initialize(type, value, op = nil) @op = op @type = type @value = value end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
26 27 28 |
# File 'lib/zm/client/contact/contact_member.rb', line 26 def op @op end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
26 27 28 |
# File 'lib/zm/client/contact/contact_member.rb', line 26 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
26 27 28 |
# File 'lib/zm/client/contact/contact_member.rb', line 26 def value @value end |
Class Method Details
.find_type_by_value(value) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/zm/client/contact/contact_member.rb', line 13 def find_type_by_value(value) return INTERNAL if !value.to_i.zero? || Zm::Client::Regex::SHARED_CONTACT.match(value) return LDAP if Zm::Client::Regex::BASEDN_REGEX.match(value) FREE end |
.init_by_value(value) ⇒ Object
20 21 22 23 |
# File 'lib/zm/client/contact/contact_member.rb', line 20 def init_by_value(value) type_v = find_type_by_value(value) new(type_v, value) end |
Instance Method Details
#add! ⇒ Object
58 59 60 |
# File 'lib/zm/client/contact/contact_member.rb', line 58 def add! @op = ADD end |
#concat ⇒ Object
34 35 36 |
# File 'lib/zm/client/contact/contact_member.rb', line 34 def concat [@value, @type, @op] end |
#construct_soap_node ⇒ Object
66 67 68 69 70 |
# File 'lib/zm/client/contact/contact_member.rb', line 66 def construct_soap_node node = { type: @type, value: @value } node[:op] = @op unless @op.nil? node end |
#free? ⇒ Boolean
50 51 52 |
# File 'lib/zm/client/contact/contact_member.rb', line 50 def free? @type == FREE end |
#internal? ⇒ Boolean
42 43 44 |
# File 'lib/zm/client/contact/contact_member.rb', line 42 def internal? @type == INTERNAL && !Zm::Client::Regex::SHARED_CONTACT.match(value) end |
#ldap? ⇒ Boolean
54 55 56 |
# File 'lib/zm/client/contact/contact_member.rb', line 54 def ldap? @type == LDAP end |
#remove! ⇒ Object
62 63 64 |
# File 'lib/zm/client/contact/contact_member.rb', line 62 def remove! @op = DEL end |
#shared? ⇒ Boolean
46 47 48 |
# File 'lib/zm/client/contact/contact_member.rb', line 46 def shared? @type == INTERNAL && Zm::Client::Regex::SHARED_CONTACT.match(value) end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/zm/client/contact/contact_member.rb', line 38 def to_s concat.join(' :: ') end |