Class: Zm::Client::LicenseJsnsInitializer

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/license/license_jsns_initializer.rb

Overview

class for initialize license

Class Method Summary collapse

Class Method Details

.create(parent, json) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/zm/client/license/license_jsns_initializer.rb', line 8

def create(parent, json)
  License.new(parent).tap do |item|
    json[:attr].each do |a|
      setter = "#{a.delete(:name)}="
      value = a.dig(:maxLimit, :_content) || a.delete(:_content)

      if item.respond_to?(setter)
        item.send(setter, value)
      end
    end
  end
end