Class: Ubiquitously::Gist::Post
- Inherits:
-
Service::Post
- Object
- Base
- Service::Post
- Ubiquitously::Gist::Post
- Defined in:
- lib/ubiquitously/services/gist.rb
Instance Attribute Summary
Attributes inherited from Service::Post
#captcha, #categories, #description, #downvotes, #extension, #format, #image, #kind, #must_be_unique, #privacy, #rating, #remote, #service_id, #service_url, #slug, #source, #source_url, #state, #status, #tags, #title, #token, #upvotes, #url, #user, #vote
Instance Method Summary collapse
Methods inherited from Service::Post
Methods included from Loggable::Post
Methods included from Restful::Post
Methods included from Postable::Post
Methods included from Ownable::Post
Methods inherited from Base
Methods included from SubclassableCallbacks
Constructor Details
This class inherits a constructor from Ubiquitously::Service::Post
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ubiquitously/services/gist.rb', line 25 def create page = agent.get("http://gist.github.com/") form = page.form_with(:action => "/gists") form.field_with(:name => "file_ext[gistfile1]")..each do |option| if format == extension || format == option.text.to_s.downcase.strip option.select break end end form["file_name[gistfile1]"] = token[:title] form["file_contents[gistfile1]"] = token[:description] if public? = form..last else form["action_button"] = "private" = form..first end page = form.submit() true end |
#tokenize ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ubiquitously/services/gist.rb', line 18 def tokenize super.merge( # make sure we have the extension :title => self.title.gsub(/(?:\.#{self.extension})?$/, ".#{self.extension}") ) end |