Class: Zm::Client::AccountJsnsInitializer
- Inherits:
-
Object
- Object
- Zm::Client::AccountJsnsInitializer
- Defined in:
- lib/zm/client/account/account_jsns_initializer.rb
Overview
class for initialize account
Class Method Summary collapse
Class Method Details
.create(parent, json) ⇒ Object
8 9 10 11 12 |
# File 'lib/zm/client/account/account_jsns_initializer.rb', line 8 def create(parent, json) item = Account.new(parent) update(item, json) end |
.update(item, json) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/zm/client/account/account_jsns_initializer.rb', line 14 def update(item, json) attr_types_h = item.parent.zimbra_attributes.all_account_attr_types_h # puts attr_types_h item.id = json[:id] item.name = json[:name] json[:a].reject! { |n| n[:n].nil? } json_map = Hash[json[:a].map { |n| [n[:n], n[:_content]] }].freeze # puts json_map # item.parent.zimbra_attributes.all_account_attrs.each do |attr| # if attr.type.nil? # # p attr # else # json_field = json_map[attr.name] # puts json_field unless json_field.nil? # end # end item.init_from_json(json) item end |