Class: Fog::Softlayer::Product::Items
- Inherits:
-
Collection
- Object
- Collection
- Fog::Softlayer::Product::Items
- Defined in:
- lib/fog/softlayer/models/product/items.rb
Instance Method Summary collapse
- #all ⇒ Object
- #get(identifier) ⇒ Object
-
#initialize(attributes = {}) ⇒ Items
constructor
A new instance of Items.
Constructor Details
#initialize(attributes = {}) ⇒ Items
Returns a new instance of Items.
18 19 20 |
# File 'lib/fog/softlayer/models/product/items.rb', line 18 def initialize(attributes = {}) super(attributes) end |
Instance Method Details
#all ⇒ Object
22 23 24 25 26 |
# File 'lib/fog/softlayer/models/product/items.rb', line 22 def all requires :package_id data = service.get_package_items(package_id).body load(data) end |
#get(identifier) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/fog/softlayer/models/product/items.rb', line 28 def get(identifier) requires :package_id return nil if identifier.nil? || identifier == "" data = service.get_package_item(package_id, identifier).body.first new.merge_attributes(data) rescue Excon::Errors::NotFound nil end |