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

- (Object) body_data

Returns the value of attribute body_data



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

def body_data
  @body_data
end

- (Object) body_general

Returns the value of attribute body_general



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

def body_general
  @body_general
end

- (Object) body_template

Returns the value of attribute body_template



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

def body_template
  @body_template
end

- (Object) page_actor_id

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

- (Object) target_ids

Returns the value of attribute target_ids



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

def target_ids
  @target_ids
end

- (Object) title_data

Returns the value of attribute title_data



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

def title_data
  @title_data
end

- (Object) title_template

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

- (Object) convert_json(hash_or_string)



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

- (Object) to_params



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