Class: InternetBS::DotDEAttributes
Constant Summary
collapse
- ROLES =
{
'PERSON' => 'Natural person',
'ROLE' => 'An abstract name for a group of persons (so-called role account, e.g. Business Services)',
'ORG' => 'A legal person (company, association, grouping of holders, organization etc.)'
}
Instance Method Summary
collapse
#admin_params, #billing_params, #registrant_params, #zone_params
Methods inherited from Base
#inspect
Instance Method Details
#mandatory_params ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/internetbs/dot_de_attributes.rb', line 20
def mandatory_params
params = {"#{@contact_type.to_s}_role" => @role, "#{@contact_type.to_s}_clientip" => @ip_address}
params.merge!({"#{@contact_type.to_s}_disclosename" => @disclose_name ? 'YES' : 'NO'})
params.merge!({"#{@contact_type.to_s}_disclosecontact" => @disclose_contact ? 'YES' : 'NO'})
params.merge!({"#{@contact_type.to_s}_discloseaddress" => @disclose_address ? 'YES' : 'NO'})
params.merge!({"#{@contact_type.to_s}_tosagree" => @terms_accepted ? 'YES' : 'NO'})
return params
end
|
#optional_params ⇒ Object
29
30
31
32
33
34
|
# File 'lib/internetbs/dot_de_attributes.rb', line 29
def optional_params
params = {}
params.merge!({"#{@contact_type.to_s}_sip" => @sip_uri}) if @sip_uri
params.merge!({"#{@contact_type.to_s}_remark" => @remark}) if @remark
return params
end
|
#valid?(inputs = {}) ⇒ Boolean
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/internetbs/dot_de_attributes.rb', line 36
def valid?(inputs = {})
ensure_attribute_has_value :role, :disclose_name, :disclose_contact,
:disclose_address, :terms_accepted, :ip_address
unless ROLES.has_key?(@role)
@errors << "role must be one in ROLES"
else
case @contact_type
when :registrant
unless ['PERSON', 'ORG'].include?(@role)
@errors << 'role must be either PERSON or ORG for registrant contact'
end
when :admin
unless ['PERSON'].include?(@role)
@errors << 'role must be PERSON for admin contact'
end
when :tech
unless ['PERSON', 'ORG'].include?(@role)
@errors << 'role must be either PERSON or ORG for tech contact'
end
when :zone
unless ['PERSON', 'ORG'].include?(@role)
@errors << 'role must be either PERSON or ORG for zone contact'
end
end
end
super
end
|