Class: Zm::Client::DataSourceJsnsInitializer

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/datasource/datasource_jsns_initializer.rb

Overview

class for initialize account data source

Class Method Summary collapse

Class Method Details

.create(parent, data_source_type, json) ⇒ Object



8
9
10
11
# File 'lib/zm/client/datasource/datasource_jsns_initializer.rb', line 8

def create(parent, data_source_type, json)
  item = DataSource.new(parent, data_source_type)
  update(item, json)
end

.update(item, json) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/zm/client/datasource/datasource_jsns_initializer.rb', line 13

def update(item, json)
  json.each do |k, v|
    setter_method = "#{k}=".to_sym

    if item.respond_to?(setter_method)
      item.send(setter_method, v)
    end
  end

  item
end