Module: FbGraph::Serialization

Included in:
Location, Privacy, Tag
Defined in:
lib/fb_graph/serialization.rb

Instance Method Summary collapse

Instance Method Details

#as_json(options = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/fb_graph/serialization.rb', line 7

def as_json(options = {})
  hash = self.to_hash options
  hash.delete_if do |k, v|
    v.blank?
  end
  hash
end

#to_hash(options = {}) ⇒ Object



3
4
5
# File 'lib/fb_graph/serialization.rb', line 3

def to_hash(options = {})
  raise "Define #{self.class}#to_hash!"
end

#to_json(options = {}) ⇒ Object



15
16
17
# File 'lib/fb_graph/serialization.rb', line 15

def to_json(options = {})
  as_json.to_json options
end