lib/profitbricks/ip_block.rb in profitbricks-0.9.9 vs lib/profitbricks/ip_block.rb in profitbricks-1.0.0

- old
+ new

@@ -16,32 +16,31 @@ # Releases an existing block of reserved public IPs. # # @return [Boolean] true on success, false otherwise def release - response = Profitbricks.request :release_public_ip_block, "<blockId>#{self.id}</blockId>" - return true if response.to_hash[:release_public_ip_block_response][:return] + response = Profitbricks.request :release_public_ip_block, block_id: self.id + return true end class << self # Returns a list of all public IP blocks reserved by the user, including the reserved IPs and connected NICs. # # @return [Array<IpBlock>] List of all IpBlocks def all response = Profitbricks.request :get_all_public_ip_blocks - datacenters = response.to_hash[:get_all_public_ip_blocks_response][:return] - [datacenters].flatten.compact.collect do |block| + [response].flatten.compact.collect do |block| PB::IpBlock.new(block) end end # Reserves a specific amount of public IPs which can be manually assigned to a NIC by the user. # # @param [Fixnum] Block size / amount of IPs to reserve # @return [IpBlock] The reserved IpBlock def reserve(amount) - response = Profitbricks.request :reserve_public_ip_block, "<blockSize>#{amount}</blockSize>" - return PB::IpBlock.new(response.to_hash[:reserve_public_ip_block_response][:return]) + response = Profitbricks.request :reserve_public_ip_block, block_size: amount + return PB::IpBlock.new(response) end end end \ No newline at end of file