Class: X::Poll
Overview
A poll attached to a post
The API offers no lookup of polls, so a poll is read from the response of the post that expanded it, and the class answers no finder. from_id builds one from its identifier, which a poll the response did not expand is built as too, and which compares equal to the poll it identifies, but hydrate and refresh raise UnsupportedOperation for one that is not hydrated, since there is nothing to look it up with.
Constant Summary collapse
- FIELDS =
Every public poll field
A minor release may add to it the fields the API adds, so that a lookup asks for them too; see Resource#hydrated? for what that means for a resource looked up with a list of fields of its own.
%w[duration_minutes end_datetime id options voting_status].freeze
Instance Attribute Summary collapse
-
#duration_minutes ⇒ Integer?
readonly
The duration of the poll in minutes.
-
#end_datetime ⇒ Time?
readonly
The time when the poll ends.
-
#options ⇒ Array<Hash>
readonly
The poll options with their positions, labels, and vote counts.
-
#voting_status ⇒ String?
readonly
The voting status: open or closed.
Class Method Summary collapse
-
.default_params ⇒ Hash{String => Array<String>}
The default query parameters, which request every field.
Constructor Details
This class inherits a constructor from X::Resource
Instance Attribute Details
#duration_minutes ⇒ Integer? (readonly)
The duration of the poll in minutes
57 |
# File 'x-objects/lib/x/objects/poll.rb', line 57 attribute :duration_minutes, :integer |
#end_datetime ⇒ Time? (readonly)
The time when the poll ends
65 |
# File 'x-objects/lib/x/objects/poll.rb', line 65 attribute :end_datetime, :time |
#options ⇒ Array<Hash> (readonly)
The poll options with their positions, labels, and vote counts
49 |
# File 'x-objects/lib/x/objects/poll.rb', line 49 attribute :options, :objects |
#voting_status ⇒ String? (readonly)
The voting status: open or closed
73 |
# File 'x-objects/lib/x/objects/poll.rb', line 73 attribute :voting_status |
Class Method Details
.default_params ⇒ Hash{String => Array<String>}
The default query parameters, which request every field
The API offers no lookup of polls, so they are requested by the posts that expand them, which ask for these fields, and a poll a response included with all of them is hydrated.
30 |
# File 'x-objects/lib/x/objects/poll.rb', line 30 def self.default_params = {"poll.fields" => FIELDS} |