Class: GSGraph::OpenGraph::Action
- Defined in:
- lib/gs_graph/open_graph/action.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#from ⇒ Object
Returns the value of attribute from.
-
#objects ⇒ Object
Returns the value of attribute objects.
-
#publish_time ⇒ Object
Returns the value of attribute publish_time.
-
#raw_attributes ⇒ Object
Returns the value of attribute raw_attributes.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Node
#access_token, #endpoint, #identifier
Instance Method Summary collapse
-
#initialize(identifier, attributes = {}) ⇒ Action
constructor
A new instance of Action.
Methods included from Connections::Likes::Likable
Methods included from Connections::Likes
Methods included from Connections::Comments
Methods inherited from Node
#connection, #destroy, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ Action
Returns a new instance of Action.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gs_graph/open_graph/action.rb', line 11 def initialize(identifier, attributes = {}) super @raw_attributes = attributes @type = attributes[:type] if application = attributes[:application] @application = Application.new(application[:id], application) end if from = attributes[:from] @from = User.new(from[:id], from) end @objects = {} if attributes[:data] attributes[:data].each do |key, _attributes_| @objects[key] = case _attributes_ when Hash Object.new _attributes_[:id], _attributes_ else _attributes_ end end end @objects = @objects.with_indifferent_access [:start_time, :end_time, :publish_time].each do |key| self.send "#{key}=", Time.parse(attributes[key]) if attributes[key] end # cached connection cache_collections attributes, :comments, :likes end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
8 9 10 |
# File 'lib/gs_graph/open_graph/action.rb', line 8 def application @application end |
#end_time ⇒ Object
Returns the value of attribute end_time.
8 9 10 |
# File 'lib/gs_graph/open_graph/action.rb', line 8 def end_time @end_time end |
#from ⇒ Object
Returns the value of attribute from.
8 9 10 |
# File 'lib/gs_graph/open_graph/action.rb', line 8 def from @from end |
#objects ⇒ Object
Returns the value of attribute objects.
8 9 10 |
# File 'lib/gs_graph/open_graph/action.rb', line 8 def objects @objects end |
#publish_time ⇒ Object
Returns the value of attribute publish_time.
8 9 10 |
# File 'lib/gs_graph/open_graph/action.rb', line 8 def publish_time @publish_time end |
#raw_attributes ⇒ Object
Returns the value of attribute raw_attributes.
9 10 11 |
# File 'lib/gs_graph/open_graph/action.rb', line 9 def raw_attributes @raw_attributes end |
#start_time ⇒ Object
Returns the value of attribute start_time.
8 9 10 |
# File 'lib/gs_graph/open_graph/action.rb', line 8 def start_time @start_time end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/gs_graph/open_graph/action.rb', line 8 def type @type end |