Class: WIS::DOM::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/dom/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, description) ⇒ Account

Returns a new instance of Account.



5
6
7
8
9
# File 'lib/dom/account.rb', line 5

def initialize(id, name, description)
	@id = id
	@name = name
	@description = description
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/dom/account.rb', line 3

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/dom/account.rb', line 2

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/dom/account.rb', line 2

def name
  @name
end

Class Method Details

.adapt_json(data) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dom/account.rb', line 11

def self.adapt_json(data)
	if data.kind_of?(Array)
		accounts = []
		data.each do |a|
			accounts << WIS::DOM::Account.new(a["ID"], a["Name"], a["Description"])
		end
		accounts
	else			
		WIS::DOM::Account.new(data["ID"], data["Name"], data["Description"])
	end
end