Class: GSGraph::Question

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

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from Connections::QuestionOptions

#question_options

Methods inherited from Node

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

Methods included from Comparison

#==

Constructor Details

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

Returns a new instance of Question.



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

def initialize(identifier, attributes = {})
  super
  @from = if attributes[:from]
    User.new(attributes[:from][:id], attributes[:from])
  end
  @question = attributes[:question]
  @created_time = if attributes[:created_time]
    Time.parse(attributes[:created_time]).utc
  end
  @updated_time = if attributes[:updated_time]
    Time.parse(attributes[:updated_time]).utc
  end

  # cached connection
  if attributes[:options]
    cache_collection attributes, :options
  end
end

Instance Attribute Details

#created_timeObject

Returns the value of attribute created_time.



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

def created_time
  @created_time
end

#fromObject

Returns the value of attribute from.



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

def from
  @from
end

#questionObject

Returns the value of attribute question.



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

def question
  @question
end

#updated_timeObject

Returns the value of attribute updated_time.



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

def updated_time
  @updated_time
end