Class: FbGraph::UserAchievement
- Defined in:
- lib/fb_graph/user_achievement.rb
Instance Attribute Summary collapse
-
#achievement ⇒ Object
Returns the value of attribute achievement.
-
#application ⇒ Object
Returns the value of attribute application.
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#from ⇒ Object
Returns the value of attribute from.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary collapse
- #destroy(options = {}) ⇒ Object
-
#initialize(identifier, attributes = {}) ⇒ UserAchievement
constructor
A new instance of UserAchievement.
Methods included from Connections::Likes::Likable
Methods included from Connections::Likes
Methods included from Connections::Comments
Methods inherited from Node
#connection, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ UserAchievement
Returns a new instance of UserAchievement.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fb_graph/user_achievement.rb', line 9 def initialize(identifier, attributes = {}) super if from = attributes[:from] @from = User.new(from[:id], from) end if created_time = attributes[:created_time] || attributes[:publish_time] @created_time = Time.parse(created_time).utc end if application = attributes[:application] application[:link] = application[:url] # for some reason, FB uses "url" only here.. @application = Application.new(application[:id], application) end if achievement = attributes[:achievement] @achievement = Achievement.new(achievement[:id], achievement) end # cached connection cache_collections attributes, :comments, :likes end |
Instance Attribute Details
#achievement ⇒ Object
Returns the value of attribute achievement.
7 8 9 |
# File 'lib/fb_graph/user_achievement.rb', line 7 def achievement @achievement end |
#application ⇒ Object
Returns the value of attribute application.
7 8 9 |
# File 'lib/fb_graph/user_achievement.rb', line 7 def application @application end |
#created_time ⇒ Object
Returns the value of attribute created_time.
7 8 9 |
# File 'lib/fb_graph/user_achievement.rb', line 7 def created_time @created_time end |
#from ⇒ Object
Returns the value of attribute from.
7 8 9 |
# File 'lib/fb_graph/user_achievement.rb', line 7 def from @from end |
Instance Method Details
#destroy(options = {}) ⇒ Object
30 31 32 33 |
# File 'lib/fb_graph/user_achievement.rb', line 30 def destroy( = {}) [:access_token] ||= self.access_token from.unachieve!(achievement.url, ) end |