This file contains hidden or 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
from httplib2 import Http | |
from urllib import urlencode | |
import libxml2 | |
class RestClient: | |
"""A simple REST client library""" | |
def __init__(self, api_url, api_user, api_password): | |
self.url, self.user, self.password = api_url, api_user, api_password | |
self.client = Http() |
This file contains hidden or 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
require 'rubygems' | |
require 'cinch' | |
require 'json' | |
require 'pp' | |
require 'rest-client' | |
def client(uri) | |
RestClient::Resource.new("https://teambox.com/api/1/#{uri}", 'x', 'x') | |
end |
This file contains hidden or 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
require 'rest-client' | |
class Identica | |
attr_reader :client | |
def initialize(username, password) | |
@client = RestClient::Resource.new("http://identi.ca/api", username, password) | |
end |
This file contains hidden or 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 Bitly | |
attr_reader :client | |
def initialize(username, password) | |
@username, @password = username, password | |
@client = RestClient::Resource.new('http://api.bitly.com/v3') | |
end | |
def shorten(url) |
This file contains hidden or 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
require 'rubygems' | |
require 'cinch' | |
require 'nokogiri' | |
require 'pp' | |
require 'rest-client' | |
FEED_URL="https://www.aeolusproject.org/redmine/activity.atom?key=296155b7b55159144a341f198e5909d24cd003ea" | |
def feed | |
client = RestClient::Resource.new(FEED_URL, '<username>', '<password>') |
This file contains hidden or 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
require 'xmlrpc/client' | |
require 'pp' | |
server = XMLRPC::Client.new2("http://koji.fedoraproject.org/kojihub") | |
result = server.call "search", "deltacloud-core", "build", "regexp" | |
pp result |
This file contains hidden or 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
require 'rubygems' | |
require 'rbvmomi' | |
machine_conf_spec = RbVmomi::VIM.VirtualMachineConfigSpec( | |
:deviceChange => [{ | |
:operation => :add, | |
:device => RbVmomi::VIM::VirtualCdrom( | |
:key => 2, | |
:connectable => RbVmomi::VIM::VirtualDeviceConnectInfo( | |
:startConnected => true, |
This file contains hidden or 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
require 'open-uri' | |
require 'nokogiri' | |
module Course | |
class RSSSource | |
attr_accessor :url | |
attr_accessor :xml | |
def initialize(url) | |
self.url = url |
This file contains hidden or 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
require 'open-uri' | |
require 'nokogiri' | |
require 'pony' | |
#sudo gem install pony | |
module Course | |
class RSSSource | |
attr_accessor :url | |
attr_accessor :xml |
This file contains hidden or 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
module Helpers | |
def operations_for_collection(collection) | |
collections[collection].operations.values.select { |op| op.has_capability?(driver) } | |
end | |
end |
OlderNewer