Class: Widget

Inherits:
Object
  • Object
show all
Defined in:
lib/domain/widget.rb

Overview

Widget model conatining widget craeate and update attributes

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, description: nil) ⇒ Widget

Inialise the widget model



18
19
20
21
22
# File 'lib/domain/widget.rb', line 18

def initialize(name: nil, description: nil) #, kind: nil)

  self.name = name
  self.description = description
  #self.kind = kind

end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/domain/widget.rb', line 8

def description
  @description
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/domain/widget.rb', line 7

def name
  @name
end

Class Method Details

.get_payload(widget) ⇒ Json

Gets Json represenatation of widget object



48
49
50
# File 'lib/domain/widget.rb', line 48

def self.get_payload(widget)
  widget.to_json
end

Instance Method Details

#to_json(*data) ⇒ <Type>

Converts Widget object to Json object



31
32
33
34
35
36
37
38
39
# File 'lib/domain/widget.rb', line 31

def to_json(*data)
   {
    name: @name,
    description: @description
  #  kind: @kind

  }.to_json(*data)
 # hash.delete_if { |k, v| v.nil? || v.empty? }

 # hash.to_json(*data)

end