This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# [email protected] July 2012 | |
# | |
# I'm playing around with APIs, and sharing my learnings | |
# You can follow my trials and tribulations at http://viewyonder.com/apis | |
# | |
# This is a simple Ruby script to show how a simple API might work. | |
# The resource model is just a simple array of a single class - no back-end store (yet) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# [email protected] July 2012 | |
# | |
# I'm playing around with APIs, and sharing my learnings | |
# You can follow my trials and tribulations at http://viewyonder.com/apis | |
# | |
# This is a simple Ruby script to show how a simple API might work. | |
# The resource model is just a simple array of a single class - no back-end store (yet) | |
# | |
# The only goal for this version of the script is to all a human using a browser to GET resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NX1K | |
require 'net/ssh' | |
attr_writer :host, :user, :pwd | |
def send(xml) | |
session = Net::SSH.start(@host, @user, :password => @pwd, :timeout => 10, :verbose => :debug) do |session| | |
channel = session.open_channel do |channel| | |
channel.subsystem("xmlagent") do |xmlagent, success| | |
xmlagent.on_data do |xmlagent, data| |