Class: Powncer::Link
Constant Summary
Constants inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Link
constructor
A new instance of Link.
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 = {}) ⇒ Link
Returns a new instance of Link.
5 6 7 8 9 10 |
# File 'lib/powncer/link.rb', line 5 def initialize( = {}) [:url] ||= "" raise RequirementMissing unless [:url].is_valid_url? super @attributes["url"] = [:url] 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
14 15 16 17 18 19 20 21 22 |
# File 'lib/powncer/link.rb', line 14 def create(attributes) attributes.symbolize_keys! link = self.new(attributes) unless link.to.is_a?(Symbol) target_key = self.superclass.ensure_send_to(:friend, link.to) end url = "/send/link.#{self.superclass::FORMAT}" Link.instantiate post(url, {:body => link.body, :to => target_key || link.to, :url => link.url}) end |