Class: Hcloud::PrimaryIP

Inherits:
Object
  • Object
show all
Includes:
EntryLoader
Defined in:
lib/hcloud/primary_ip.rb

Instance Attribute Summary

Attributes included from EntryLoader

#response

Instance Method Summary collapse

Methods included from EntryLoader

#_attributes, #_load, #_run_callbacks, #_update_attribute, #client, #initialize, #inspect, #method_missing, #prepare_request, #resource_path, #resource_url, #respond_to_missing?, #rollback, #save, #update

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hcloud::EntryLoader

Instance Method Details

#assign(assignee_id:, assignee_type: 'server') ⇒ Object



18
19
20
21
22
23
# File 'lib/hcloud/primary_ip.rb', line 18

def assign(assignee_id:, assignee_type: 'server')
  raise Hcloud::Error::InvalidInput, 'no assignee_id given' if assignee_id.nil?
  raise Hcloud::Error::InvalidInput, 'no assignee_type given' if assignee_type.nil?

  prepare_request('actions/assign', j: COLLECT_ARGS.call(__method__, binding))
end

#change_dns_ptr(ip:, dns_ptr:) ⇒ Object



29
30
31
32
33
# File 'lib/hcloud/primary_ip.rb', line 29

def change_dns_ptr(ip:, dns_ptr:)
  raise Hcloud::Error::InvalidInput, 'no IP given' if ip.blank?

  prepare_request('actions/change_dns_ptr', j: { ip: ip, dns_ptr: dns_ptr })
end

#unassignObject



25
26
27
# File 'lib/hcloud/primary_ip.rb', line 25

def unassign
  prepare_request('actions/unassign', method: :post)
end