Class: Powncer::Media
Constant Summary
Constants inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Media
constructor
A new instance of Media.
Methods inherited from Note
ensure_send_to, find, #is_public?, #link, #recipients, #save, #sender, #type
Methods inherited from Base
extract_options, #id, instantiate, parse, #post, post, request, #request
Constructor Details
#initialize(options = {}) ⇒ Media
Returns a new instance of Media.
5 6 7 8 |
# File 'lib/powncer/media.rb', line 5 def initialize( = {}) super @attributes["data"] = [:data] if [:data] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Powncer::Base
Class Method Details
.create(attributes) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/powncer/media.rb', line 12 def create(attributes) attributes.symbolize_keys! file = self.new(attributes) unless file.to.is_a?(Symbol) target_key = self.superclass.ensure_send_to(:friend, file.to) end url = "/send/file.#{self.superclass::FORMAT}" Media.instantiate post(url, {:to => target_key || file.to, :data => file.data}) end |