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 'vcr' | |
require 'addressable/uri' | |
require 'net/http' | |
require 'uri' | |
VCR.configure do |configure| | |
configure.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures') | |
configure.hook_into :webmock | |
#1. Change request before http request |
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
$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') | |
require 'tests/drivers/fgcp/common' | |
require 'rubygems' | |
describe 'Deltacloud API' do | |
include Deltacloud::Test | |
it 'must returns valid drivers' do | |
get collection_url(:drivers) | |
last_response.status.must_equal 200 |
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
ENV['API_DRIVER'] = 'fgcp' | |
ENV['API_USERNAME'] = 'cert-dir' | |
ENV['API_PASSWORD'] = 'password' | |
load File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'deltacloud_rack.rb') | |
#load File.join(File.dirname(__FILE__), '..', '..', 'common.rb') | |
Deltacloud::configure do |server| | |
server.root_url '/api' | |
server.version '0.5.0' |
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
fgcp_type = ProviderType.find_by_name('fgcp') | |
# Create a Username credential definition | |
CredentialDefinition.create!({ | |
:name => 'username', | |
:label => 'Username', | |
:input_type => 'text', | |
:provider_type => fgcp_type | |
}) |
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
#!/usr/bin/ruby | |
require 'openssl' | |
require 'base64' | |
if ARGV.length == 2 | |
pkcs12 = OpenSSL::PKCS12.new(File.read(ARGV[0]), ARGV[1]) | |
p pkcs12.certificate | |
else | |
puts "Usage: load_cert.rb <path_to_cert> <cert_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
<?php | |
$precision = 49; | |
ini_set("precision", $precision); | |
echo pi(); //will output 3.141592653589793115997963468544185161590576171875 | |
?> |
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
<?php | |
//static variable make place in memory without initialization the object\ | |
//static functions are class level function not object level, they cant access object level | |
class YourClass | |
{ | |
protected $_attribute; | |
public function __construct() { | |
$this-> _attribute = 10; |
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
<?php | |
class Sentence{ | |
static $phrase = ""; | |
static $word1 = "eek"; | |
static $word2 = "eep"; | |
static $word3 = "yikis"; | |
static function callRecursive($x){ | |
//print $x."\n"; checking counter |
NewerOlder