No commit activity in last 3 years
No release in over 3 years
A module and class factory for SoftLayer's customer portal API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.5.0
 Project Readme
This is a module and class factory for SoftLayer's customer portal API (http://sldn.softlayer.com ).  See the rdoc documentation and the sample directory for usage details.

The factory creates classes as they are declared.  As a group:

SLAPICLASSES = [ 'SoftLayer::Account' ]
SLAPISERVICES = [ 'SoftLayer_Billing_Item', 'SoftLayer_Network_Storage' ]
SoftLayer::declareClasses(:ruby => SLAPICLASSES, :soap => SLAPISERVICES)

Or one at a time:

SoftLayer::ClassFactory(:class => 'SoftLayer::Account')

Objects are then created and used like normal Ruby objects:

account = SoftLayer::Account.new(:user => AUTH_USER, :key => AUTH_KEY, :initParam => ACCT_ID)
puts account.getBalance

The object's associated Type is available like a Hash:

puts account['email']

Object Masks:

account.objectMask = { 'allBillingItems' => nil }
pp account['allBillingItems']


API user and key is cached after first use (but can be overridden on a per object basis):

SLAPISERVICES = [ 'SoftLayer_Account', 'SoftLayer_Billing_Item', 'SoftLayer_Network_Storage' ]
SoftLayer::declareClasses(:soap => SLAPISERVICES)

account = SoftLayer::Account.new(:user => AUTH_USER, :key => AUTH_KEY, :initParam => ACCT_ID)
account.objectMask={ 'allBillingItems' => nil, 'nasNetworkStorage' => nil }
account['allBillingItems'].each do |bi|
	billingItem = SoftLayer::Billing::Item.new(:initParam => bi['id'])
	pp billingItem.getLocation['longName']
end

account['nasNetworkStorage'].each do |n|
	nas = SoftLayer::Network::Storage.new(:user => OTHER_AUTH_USER, :key => OTHER_AUTH_KEY, :initParam => n['id'])
	pp nas.capacityGb
end

Result Limits:

account.getAllBillingItems(:limit => [X,Y]) do |bia|
	( blah )
end

Such that bia is an array containing X or fewer elements; blah executes on each batch until there's no more.  

Without a block, should return the 5 elements offset from Y:

bia = account.getAllBillingItems(:limit => [5,Y])
bia.size <= 5