Class: WIS::DOM::Opinion
- Inherits:
-
Object
- Object
- WIS::DOM::Opinion
- Defined in:
- lib/dom/opinion.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
-
#narrative ⇒ Object
Returns the value of attribute narrative.
-
#position ⇒ Object
Returns the value of attribute position.
-
#taken ⇒ Object
Returns the value of attribute taken.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(account, issue) ⇒ Opinion
constructor
A new instance of Opinion.
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(account, issue) @account = account @issue = issue end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
2 3 4 |
# File 'lib/dom/opinion.rb', line 2 def account @account end |
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
2 3 4 |
# File 'lib/dom/opinion.rb', line 2 def issue @issue end |
#narrative ⇒ Object
Returns the value of attribute narrative.
3 4 5 |
# File 'lib/dom/opinion.rb', line 3 def narrative @narrative end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/dom/opinion.rb', line 3 def position @position end |
#taken ⇒ Object
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) account = 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(account, 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 |