class ProfitBricks::Resource

Resource class

Public Class Methods

get(resource_type, resource_id, options = {}) click to toggle source

Retrieve a resource

# File lib/profitbricks/resource.rb, line 30
def get(resource_type, resource_id, options = {})
  response = ProfitBricks.request(
    method: :get,
    path: "/um/resources/#{resource_type}/#{resource_id}",
    expects: 200,
    query: options
  )

  instantiate_objects(response)
end
list(options = {}) click to toggle source

List all resources.

# File lib/profitbricks/resource.rb, line 6
def list(options = {})
  response = ProfitBricks.request(
    method: :get,
    path: '/um/resources',
    expects: 200,
    query: options
  )
  add_parent_identities(response)
  instantiate_objects(response)
end
list_by_type(resource_type, options = {}) click to toggle source
# File lib/profitbricks/resource.rb, line 17
def list_by_type(resource_type, options = {})      
  response = ProfitBricks.request(
    method: :get,
    path: "/um/resources/#{resource_type}",
    expects: 200,
    query: options
  )

  add_parent_identities(response)
  instantiate_objects(response)
end