Class: Facebooker::Feed::TemplatizedAction

Inherits:
ActionBase
  • Object
show all
Defined in:
lib/facebooker/feed.rb

Overview

Representation of a templatized action to be published into a user’s news feed

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ActionBase

#add_image

Instance Attribute Details

#body_dataObject

Returns the value of attribute body_data.



39
40
41
# File 'lib/facebooker/feed.rb', line 39

def body_data
  @body_data
end

#body_generalObject

Returns the value of attribute body_general.



39
40
41
# File 'lib/facebooker/feed.rb', line 39

def body_general
  @body_general
end

#body_templateObject

Returns the value of attribute body_template.



39
40
41
# File 'lib/facebooker/feed.rb', line 39

def body_template
  @body_template
end

#page_actor_idObject

Returns the value of attribute page_actor_id.



39
40
41
# File 'lib/facebooker/feed.rb', line 39

def page_actor_id
  @page_actor_id
end

#target_idsObject

Returns the value of attribute target_ids.



39
40
41
# File 'lib/facebooker/feed.rb', line 39

def target_ids
  @target_ids
end

#title_dataObject

Returns the value of attribute title_data.



39
40
41
# File 'lib/facebooker/feed.rb', line 39

def title_data
  @title_data
end

#title_templateObject

Returns the value of attribute title_template.



39
40
41
# File 'lib/facebooker/feed.rb', line 39

def title_template
  @title_template
end

Instance Method Details

#convert_json(hash_or_string) ⇒ Object



52
53
54
# File 'lib/facebooker/feed.rb', line 52

def convert_json(hash_or_string)    
  (hash_or_string.is_a?(Hash) and hash_or_string.respond_to?(:to_json)) ? hash_or_string.to_json : hash_or_string
end

#to_paramsObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/facebooker/feed.rb', line 41

def to_params
 raise "Must set title_template" if self.title_template.nil?
 { :page_actor_id => page_actor_id, 
   :title_template => title_template, 
   :title_data => convert_json(title_data),
   :body_template => body_template, 
   :body_data => convert_json(body_data), 
   :body_general => body_general,
   :target_ids => target_ids }.merge image_params
end