Skip to content

Commit ab57eba

Browse files
committed
Once again, this time with the files added
1 parent 3419bfe commit ab57eba

4 files changed

Lines changed: 30 additions & 16 deletions

File tree

examples/order_bare_metal_package.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def tl_dr_version
8181

8282
# For this example, we'll assume that we've selected the a package
8383
# with an id of 32 representing a "Quad Processor, Quad Core Intel"
84-
quad_intel_package = SoftLayer::ProductPackage.package_with_id(client, 32)
84+
quad_intel_package = SoftLayer::ProductPackage.package_with_id(32, client)
8585

8686
# Now we need to now what ProductItemCategories are required to
8787
# configure a server in that package. This code prints out a table

examples/ticket_info.rb

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,23 @@
2525
require 'pp'
2626

2727
softlayer_client = SoftLayer::Client.new(
28-
:username => "joecustomer", # enter your username here
29-
:api_key => "feeddeadbeefbadf00d..." # enter your api key here
28+
# :username => "joecustomer", # enter your username here
29+
# :api_key => "feeddeadbeefbadf00d..." # enter your api key here
3030
)
3131

3232
begin
33+
# Demonstrates using the low-level capabilities of the gem to get
34+
# at information. In this case we are talking directly to the ticket
35+
# service
3336
ticket_service = softlayer_client.service_named("Ticket");
34-
ticket_ref = ticket_service.object_with_id(8172109)
37+
38+
# Retrive a particular ticket by ID (you will have to substitute an existing ticket's ID here)
39+
ticket_ref = ticket_service.object_with_id(12345)
3540

36-
ticket = ticket_ref.object_mask("mask[updates[entry,createDate],assignedUserId,attachedHardware.datacenter]".getObject
41+
# Retrive very specific information about the ticket
42+
ticket = ticket_ref.object_mask("mask[updates[entry,createDate],assignedUserId,attachedHardware.datacenter]").getObject
43+
3744
pp ticket
3845
rescue Exception => exception
39-
puts "Unable to retrieve the ticket"
40-
end
41-
42-
# update the ticket
43-
begin
44-
updates = ticket_ref.addUpdate({"entry" => "An update from the Ruby client!"})
45-
puts "Update ticket 123456. The new update's id is #{updates[0]['id']}"
46-
rescue Exception => exception
47-
puts "Unable to update the ticket: #{exception}"
48-
end
46+
puts "Unable to retrieve the ticket #{exception}"
47+
end

lib/softlayer/ProductItemCategory.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ def free?
4848
# service.
4949
class ProductItemCategory < ModelBase
5050
include ::SoftLayer::DynamicAttribute
51+
52+
##
53+
# :attr_reader:
54+
# The categoryCode is a primary identifier for a particular
55+
# category. It is a string like 'os' or 'ram'
56+
sl_attr :categoryCode
57+
58+
##
59+
# :attr_reader:
60+
# The name of a category is a friendly, readable string
61+
sl_attr :name
5162

5263
sl_dynamic_attr :configuration_options do |config_opts|
5364
config_opts.should_update? do
@@ -67,7 +78,7 @@ class ProductItemCategory < ModelBase
6778
#
6879
# Options are divided into groups (for convenience in the
6980
# web UI), but this code collapses the groups.
70-
groups.collect do |group|
81+
self['groups'].collect do |group|
7182
group['prices'].sort{|lhs,rhs| lhs['sort'] <=> rhs['sort']}.collect do |price_item|
7283
ProductConfigurationOption.new(
7384
price_item['id'],

lib/softlayer/ProductPackage.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ module SoftLayer
5151
class ProductPackage < ModelBase
5252
include ::SoftLayer::DynamicAttribute
5353

54+
##
55+
# A friendly, readable name for the package
56+
sl_attr :name
57+
5458
##
5559
# The list of locations where this product package is available.
5660
sl_attr :availableLocations

0 commit comments

Comments
 (0)