Class: ClearElection::Election::Agent
- Inherits:
-
Object
- Object
- ClearElection::Election::Agent
- Defined in:
- lib/clear-election-sdk/election.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(uri:) ⇒ Agent
constructor
A new instance of Agent.
Constructor Details
#initialize(uri:) ⇒ Agent
Returns a new instance of Agent.
88 89 90 |
# File 'lib/clear-election-sdk/election.rb', line 88 def initialize(uri:) @uri = Addressable::URI.parse(uri) end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
86 87 88 |
# File 'lib/clear-election-sdk/election.rb', line 86 def uri @uri end |
Class Method Details
.from_json(data) ⇒ Object
92 93 94 |
# File 'lib/clear-election-sdk/election.rb', line 92 def self.from_json(data) self.new(uri: data["uri"].sub(%r{/?$}, '/')) end |
Instance Method Details
#as_json ⇒ Object
96 97 98 99 100 |
# File 'lib/clear-election-sdk/election.rb', line 96 def as_json() { "uri" => @uri.to_s } end |