🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

lonnon-Helipad

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lonnon-Helipad

bundlerRubygems
Version
0.0.1
Version published
Maintainers
1
Created
Source

Ruby interface to the excellent Helipad[http://pad.helicoid.net/home.html]

online note pad.

Author: Lonnon Foster (lonnon.foster@gmail.com)

== Overview

This package provides three classes for working with

Helipad[http://pad.helicoid.net/home.html]: Helipad, Helipad::Document, and

Helipad::Response.

The Helipad class does all the heavy lifting. Creating an instance of

Helipad requires your login credentials.

hp = Helipad.new("lonnon@example.com", "password")

Armed with an instance of Helipad, you can call its methods to interact

with Helipad[http://pad.helicoid.net/home.html] documents.

The Helipad::Document class holds the data contained in a

Helipad[http://pad.helicoid.net/home.html] document. The get method

returns a Helipad::Document instance. The find, get_all, and get_titles

methods return an Array of Helipad::Document instances.

The Helipad::Response class holds return data sent by

Helipad[http://pad.helicoid.net/home.html] that describes the success or

failure of various actions. The create, destroy, and update methods

return a Helipad::Response instance.

== Examples of Use

All of these examples assume that a Helipad object called +hp+ exists.

hp = Helipad.new("lonnon@example.com", "password")

=== Get an Existing Document

document = hp.get(3)

puts document.source

=== Get a Document Formatted as HTML

puts hp.get_html(3)

=== Find Documents

def how_many(search_term)

documents = hp.find(search_term)

documents.size

end

find_this = "wombats"

puts "#{how_many(find_this)} document(s) were found containing '#{find_this}'."

=== Find Documents by Tags

documents = hp.find(:tag, "work")

titles = documents.collect { |doc| doc.title }

puts "Documents tagged with 'work':\n #{titles.join("\n ")}"

=== Create a Document

source = File.read("cake_recipe.txt")

response = hp.create(:title => "Delicious Chocolate Cake",

:tags => "recipe dessert",

:source => source)

puts "Recipe saved" if response.saved?

=== Delete Documents

doc_ids = hp.find(:tag, "incriminating").collect { |doc| doc.doc_id }

doc_ids.each do |id|

hp.destroy(id)

end

Permission is hereby granted, free of charge, to any person obtaining a copy

of this software and associated documentation files (the "Software"), to deal

in the Software without restriction, including without limitation the rights

to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

copies of the Software, and to permit persons to whom the Software is

furnished to do so, subject to the following conditions:

all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

THE SOFTWARE.

== Thanks

Special thanks to {Alex Young}[http://alexyoung.org/] at Helicoid[http://helicoid.net]

for creating Helipad[http://pad.helicoid.net/home.html].

FAQs

Package last updated on 11 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts