Class: GSGraph::QuestionOption

Inherits:
Node
  • Object
show all
Includes:
Connections::Votes
Defined in:
lib/gs_graph/question_option.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from Connections::Votes

#votes

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ QuestionOption

Returns a new instance of QuestionOption.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gs_graph/question_option.rb', line 7

def initialize(identifier, attributes = {})
  super
  @from = if attributes[:from]
    User.new(attributes[:from][:id], attributes[:from])
  end
  @name = attributes[:name]
  @vote_count = attributes[:votes]
  @object = if attributes[:object]
    Page.new(attributes[:object][:id], attributes[:object])
  end
  @created_time = if attributes[:created_time]
    Time.parse(attributes[:created_time]).utc
  end
end

Instance Attribute Details

#created_timeObject

Returns the value of attribute created_time.



5
6
7
# File 'lib/gs_graph/question_option.rb', line 5

def created_time
  @created_time
end

#fromObject

Returns the value of attribute from.



5
6
7
# File 'lib/gs_graph/question_option.rb', line 5

def from
  @from
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/gs_graph/question_option.rb', line 5

def name
  @name
end

#objectObject

Returns the value of attribute object.



5
6
7
# File 'lib/gs_graph/question_option.rb', line 5

def object
  @object
end

#vote_countObject

Returns the value of attribute vote_count.



5
6
7
# File 'lib/gs_graph/question_option.rb', line 5

def vote_count
  @vote_count
end