class ProfitBricks::IPBlock

IPBlock class

Public Class Methods

create(options = {})
Alias for: reserve
get(ipblock_id) click to toggle source

Retrieve a reserved IP block.

# File lib/profitbricks/ipblock.rb, line 62
def get(ipblock_id)
  response = ProfitBricks.request(
    method: :get,
    path: "/ipblocks/#{ipblock_id}",
    expects: 200
  )
  instantiate_objects(response)
end
list() click to toggle source

List all reserved IP blocks.

# File lib/profitbricks/ipblock.rb, line 52
def list
  response = ProfitBricks.request(
    method: :get,
    path: '/ipblocks',
    expects: 200
  )
  instantiate_objects(response)
end
reserve(options = {}) click to toggle source

Reserve an IP block.

Parameters

  • options<Hash>:

    • location<String> - Required, must be one of the following locations:

      • us/las - United States / Las Vegas

      • de/fra - Germany / Frankfurt

      • de/fkb - Germany / Karlsruhe

    • size<Integer> - Required, the desired size of the IP block.

Returns

  • id<String> - Universally unique identifer of resource

  • type<String> - Resource type

  • href<String> - Resource URL representation

  • metadata<Hash>:

    • lastModifiedDate

    • lastModifiedBy

    • createdDate

    • createdBy

    • etag

  • properties<Hash>:

    • size<Integer> - Size of the IP block

    • ips<Array> - A collection of IP addresses associated with the IP block

    • location<String> - Location of IP block

# File lib/profitbricks/ipblock.rb, line 41
def reserve(options = {})
  response = ProfitBricks.request(
    method: :post,
    path: '/ipblocks',
    expects: 202,
    body: { properties: options }.to_json
  )
  instantiate_objects(response)
end
Also aliased as: create

Public Instance Methods

delete()
Alias for: release
release() click to toggle source

Release an IP block.

# File lib/profitbricks/ipblock.rb, line 5
def release
  ProfitBricks.request(
    method: :delete,
    path: "/ipblocks/#{id}",
    expects: 202
  )
end
Also aliased as: delete