Class: WIS::DOM::Opinion

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account, issue) ⇒ Opinion

Returns a new instance of Opinion.



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

def initialize(, issue)
	@account = 
	@issue = issue
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



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

def 
  @account
end

#issueObject (readonly)

Returns the value of attribute issue.



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

def issue
  @issue
end

#narrativeObject

Returns the value of attribute narrative.



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

def narrative
  @narrative
end

#positionObject

Returns the value of attribute position.



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

def position
  @position
end

#takenObject

Returns the value of attribute taken.



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

def taken
  @taken
end

Class Method Details

.adapt_json(data) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/dom/opinion.rb', line 10

def self.adapt_json(data)
	 = WIS::DOM::Account.new(data["Account"]["ID"], data["Account"]["Name"], data["Account"]["Description"])
	issue = WIS::DOM::Issue.new(data["Issue"]["ID"], data["Issue"]["Description"])
	opinion = WIS::DOM::Opinion.new(, issue)
	opinion.narrative = data["Narrative"] unless data["Narrative"].nil?
	opinion.taken = data["Taken"] unless data["Taken"].nil?
	opinion.position = data["Position"] unless data["Position"].nil?
	opinion
end