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.
19 20 21 |
# File 'lib/fog/softlayer/models/product/items.rb', line 19 def initialize(attributes = {}) super(attributes) end |
Instance Method Details
#all ⇒ Object
23 24 25 26 27 |
# File 'lib/fog/softlayer/models/product/items.rb', line 23 def all requires :package_id data = service.get_package_items(package_id).body load(data) end |
#get(identifier) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/fog/softlayer/models/product/items.rb', line 29 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 |