Module: NominetEPP::Operations::Lock

Included in:
Client
Defined in:
lib/nominet-epp/operations/lock.rb

Overview

EPP Lock Operation

Instance Method Summary collapse

Instance Method Details

#lock(entity, type, id) ⇒ Boolean

Lock domain or account ‘investigation’ or ‘opt-out’

Parameters:

  • entity (Symbol)

    Entity to lock

  • type (String)

    Type of lock to set

  • id (String)

    Domain name or account ID

Returns:

  • (Boolean)

    locking successful

Raises:

  • (ArgumentError)

    entity is not :domain or :account

  • (ArgumentError)

    type is not ‘investigation’ or ‘opt-out’



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nominet-epp/operations/lock.rb', line 13

def lock(entity, type, id)
  raise ArgumentError, "entity must be :domain or :account" unless [:domain, :account].include?(entity)
  raise ArgumentError, "type must be 'investigation' or 'opt-out'" unless %w(investigation opt-out).include?(type)

  @resp = @client.update do
    case type
    when 'investigation'
      lock_investigation(entity, id)
    when 'opt-out'
      lock_opt_out(entity, id)
    end
  end

  return @resp.success?
end