Class: FbGraph::Achievement
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#context ⇒ Object
Returns the value of attribute context.
-
#data ⇒ Object
Returns the value of attribute data.
-
#description ⇒ Object
Returns the value of attribute description.
-
#display_order ⇒ Object
Returns the value of attribute display_order.
-
#image ⇒ Object
Returns the value of attribute image.
-
#images ⇒ Object
Returns the value of attribute images.
-
#points ⇒ Object
Returns the value of attribute points.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary collapse
- #destroy(options = {}) ⇒ Object
-
#initialize(identifier, attributes = {}) ⇒ Achievement
constructor
A new instance of Achievement.
Methods inherited from Node
#connection, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ Achievement
Returns a new instance of Achievement.
5 6 7 8 9 10 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 |
# File 'lib/fb_graph/achievement.rb', line 5 def initialize(identifier, attributes = {}) super # TODO: Handle data, context in smarter way. [:type, :title, :url, :description, :data, :context].each do |key| send "#{key}=", attributes[key] end if self.data @points = self.data[:points] end if self.context @display_order = self.context[:display_order] end @images = [] if _images_ = attributes[:image] _images_.each do |_image_| @images << _image_[:url] end end @image = @images.first if application = attributes[:application] application[:link] = application[:url] # for some reason, FB uses "url" only here.. @application = Application.new(application[:id], application) end if attributes[:updated_time] @updated_time = Time.parse(attributes[:updated_time]).utc end end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def application @application end |
#context ⇒ Object
Returns the value of attribute context.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def context @context end |
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def data @data end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def description @description end |
#display_order ⇒ Object
Returns the value of attribute display_order.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def display_order @display_order end |
#image ⇒ Object
Returns the value of attribute image.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def image @image end |
#images ⇒ Object
Returns the value of attribute images.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def images @images end |
#points ⇒ Object
Returns the value of attribute points.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def points @points end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def type @type end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def updated_time @updated_time end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/fb_graph/achievement.rb', line 3 def url @url end |
Instance Method Details
#destroy(options = {}) ⇒ Object
39 40 41 42 |
# File 'lib/fb_graph/achievement.rb', line 39 def destroy( = {}) [:access_token] ||= self.access_token application.unregister_achievement!(url, ) end |