Class: EPP::Contact::CheckResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/epp-client/contact/check_response.rb

Instance Method Summary collapse

Methods inherited from Response

#initialize, #method, #method_missing, #respond_to?, #respond_to_missing?

Methods included from ResponseHelper

#nodes_for_xpath, #value_for_xpath, #values_for_xpath

Constructor Details

This class inherits a constructor from EPP::Contact::Response

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class EPP::Contact::Response

Instance Method Details

#available?(id = nil) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
# File 'lib/epp-client/contact/check_response.rb', line 6

def available?(id = nil)
  return availability[id] if id

  if id.nil? && availability.count == 1
    return availability.values.first
  end

  raise ArgumentError, "id must be specified if more than one contact checked"
end

#countObject



28
29
30
# File 'lib/epp-client/contact/check_response.rb', line 28

def count
  availability.count
end

#idObject



23
24
25
26
# File 'lib/epp-client/contact/check_response.rb', line 23

def id
  raise "id unavailable when more than one contact checked, use #ids" if count != 1
  ids.first
end

#idsObject



19
20
21
# File 'lib/epp-client/contact/check_response.rb', line 19

def ids
  availability.keys
end

#unavailable?(id = nil) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/epp-client/contact/check_response.rb', line 15

def unavailable?(id = nil)
  !available?(id)
end