Module: Zuck::FbObject::Write
- Included in:
- RawFbObject
- Defined in:
- lib/zuck/fb_object/write.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/zuck/fb_object/write.rb', line 4 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#destroy ⇒ Object
33 34 35 |
# File 'lib/zuck/fb_object/write.rb', line 33 def destroy self.class.destroy(graph, path) end |
#save ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/zuck/fb_object/write.rb', line 8 def save self.class.raise_if_read_only # Tell facebook to return data = @hash_delegator_hash.merge(redownload: 1) data = data.stringify_keys # Don't post ids, because facebook doesn't like it data = data.keep_if{ |k,v| k != "id" } # Update on facebook result = post(graph, path, data) # The data is nested by name and id, e.g. # # "campaigns" => { "12345" => "data" } # # Since we only put one at a time, we'll fetch this like that. data = result["data"].values.first.values.first # Update and return set_data(data) result["result"] end |