Class: Ovh::Api::Api::Ip::Delegation

Inherits:
Object
  • Object
show all
Defined in:
lib/ovh-api/api/ip/delegation.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Delegation

Returns a new instance of Delegation.



6
7
8
# File 'lib/ovh-api/api/ip/delegation.rb', line 6

def initialize(connection)
  @connection = connection
end

Instance Method Details

#create(ip:, body:) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ovh-api/api/ip/delegation.rb', line 10

def create(ip:, body:)
  raise ArgumentError, 'ip is required' if ip.nil?
  raise ArgumentError, 'body is required' if body.nil?

  @connection.call(
    :POST,
    '/ip/{ip}/delegation'
      .gsub('{ip}', ERB::Util.url_encode(ip.to_s)),
    type: nil,
    auth: [],
    body: body
  )
end

#delete(ip:, target:) ⇒ Object

Raises:

  • (ArgumentError)


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ovh-api/api/ip/delegation.rb', line 24

def delete(ip:, target:)
  raise ArgumentError, 'ip is required' if ip.nil?
  raise ArgumentError, 'target is required' if target.nil?

  @connection.call(
    :DELETE,
    '/ip/{ip}/delegation/{target}'
      .gsub('{ip}', ERB::Util.url_encode(ip.to_s))
      .gsub('{target}', ERB::Util.url_encode(target.to_s)),
    type: nil,
    auth: []
  )
end

#get(ip:, target:) ⇒ Object

Raises:

  • (ArgumentError)


38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ovh-api/api/ip/delegation.rb', line 38

def get(ip:, target:)
  raise ArgumentError, 'ip is required' if ip.nil?
  raise ArgumentError, 'target is required' if target.nil?

  @connection.call(
    :GET,
    '/ip/{ip}/delegation/{target}'
      .gsub('{ip}', ERB::Util.url_encode(ip.to_s))
      .gsub('{target}', ERB::Util.url_encode(target.to_s)),
    type: nil,
    auth: []
  )
end

#list(ip:) ⇒ Object

Raises:

  • (ArgumentError)


52
53
54
55
56
57
58
59
60
61
62
# File 'lib/ovh-api/api/ip/delegation.rb', line 52

def list(ip:)
  raise ArgumentError, 'ip is required' if ip.nil?

  @connection.call(
    :GET,
    '/ip/{ip}/delegation'
      .gsub('{ip}', ERB::Util.url_encode(ip.to_s)),
    type: nil,
    auth: []
  )
end