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
def self.new(user_name, password, api_url, &block) | |
API.new(user_name, password, api_url, &block) | |
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
module Rack | |
class JSON | |
def initialize app | |
@app = app | |
end | |
def call env | |
status, headers, body = @app.call env | |
[status, headers, body.to_json] | |
end | |
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
def self.valid_credentials?(user_name, password, api_url, opts={}) | |
api=API.new(user_name, password, api_url, opts) | |
result = false | |
api.request(:get, '', :force_auth => '1') do |response| | |
result = true if response.code.eql?(200) | |
end | |
return result | |
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
def handle_backend_error(response) | |
response_xml = Nokogiri::XML(response) | |
backtrace = (response_xml/'error/backtrace').empty? ? nil : (response_xml/'error/backtrace').text | |
raise BackendError.new(:message => (response_xml/'error/message').text, | |
:code => response.code, | |
:backtrace => backtrace) | |
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
@sample = Deltacloud::DSL::Task('launch some EC2 and RHEV-M instances') do | |
instances(:driver => :ec2, :username => '', :password => '') do | |
instance 'test-ec2-1' do | |
realm 'us-west-1' | |
image 'ami-12345' | |
profile 't1.micro' | |
end | |
instance 'test-ec2-2' do |
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
<item> | |
<title>Markiza VOYO</title> | |
<link>rtmp://195.168.10.68:1935/live swfUrl=http://voyo.markiza.sk/static/sk/shared/swf/flowplayer.commercial-3.2.4.swf?0.9358190796338022 live=true pageUrl=http://voyo.markiza.sk/lbin/player/LiveStream.php?channel=markiza&r=0.5112703468184918 swfVfy=true playpath=markiza.sdp</link> | |
<thumbnail>http://www.lyngsat-logo.com/logo/tv/mm/markiza.jpg</thumbnail> | |
</item> |
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
get "/items/:id" do | |
@item = Item.find(params[:id]) | |
halt 404 if @item.nil? | |
haml :'items/show' | |
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 'sinatra/base' | |
require 'sinatra/rabbit' | |
class MyApp < Sinatra::Base | |
include Sinatra::Rabbit | |
get '/' do | |
redirect '/images' | |
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 MyApp < Sinatra::Base | |
include Sinatra::Rabbit | |
collection :instances do | |
operation :reboot, :if => reboot_supported? do | |
# ... | |
end | |
end | |
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 MyApp < Sinatra::Base | |
include Sinatra::Rabbit | |
collection :buckets do | |
collection :blobs, :with_id => :bucket_id do | |
description "Blobs are binary objects stored in buckets" | |
# GET /buckets/:bucket_id/blobs/:id | |
operation :show do |