Class: ClearElection::Election::Candidate
- Inherits:
-
Object
- Object
- ClearElection::Election::Candidate
- Defined in:
- lib/clear-election-sdk/election.rb
Instance Attribute Summary collapse
-
#candidateId ⇒ Object
readonly
Returns the value of attribute candidateId.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(candidateId:, name:) ⇒ Candidate
constructor
A new instance of Candidate.
Constructor Details
#initialize(candidateId:, name:) ⇒ Candidate
Returns a new instance of Candidate.
130 131 132 133 |
# File 'lib/clear-election-sdk/election.rb', line 130 def initialize(candidateId:, name:) @candidateId = candidateId @name = name end |
Instance Attribute Details
#candidateId ⇒ Object (readonly)
Returns the value of attribute candidateId.
128 129 130 |
# File 'lib/clear-election-sdk/election.rb', line 128 def candidateId @candidateId end |
Class Method Details
.from_json(data) ⇒ Object
135 136 137 138 139 140 |
# File 'lib/clear-election-sdk/election.rb', line 135 def self.from_json(data) self.new( candidateId: data["candidateId"], name: data["name"] ) end |
Instance Method Details
#as_json ⇒ Object
142 143 144 145 146 147 |
# File 'lib/clear-election-sdk/election.rb', line 142 def as_json { "candidateId" => @candidateId, "name" => @name } end |