Class: InternetBS::DotAsiaAttributes
Constant Summary
collapse
- CED_ENTITY_TYPES =
%w[naturalperson corporation cooperative partnership government politicalparty society institution other]
- CED_ID_FORM_TYPES =
%w[passport certificate legislation societiesregistry policalpartyregistry other]
Instance Method Summary
collapse
#admin_params, #billing_params, #registrant_params, #zone_params
Methods inherited from Base
#inspect
Instance Method Details
#is_sunrise? ⇒ Boolean
19
20
21
|
# File 'lib/internetbs/dot_asia_attributes.rb', line 19
def is_sunrise?
false end
|
#mandatory_params ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/internetbs/dot_asia_attributes.rb', line 23
def mandatory_params
params = {
'dotasiacedlocality' => @ced_locality,
'dotasiacedentity' => @ced_entity,
'dotasiacedidform' => @ced_id_form
}
params.merge!({'dotasiacedentityother' => @ced_entity_other}) if @ced_entity == 'other'
params.merge!({'dotasiacedidformother' => @ced_id_form_other}) if @ced_id_form == 'other'
return params
end
|
#optional_params ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/internetbs/dot_asia_attributes.rb', line 34
def optional_params
params = {}
params.merge!({'dotasiacedcity' => @ced_city}) if @ced_city
params.merge!({'dotasiacedidnumber' => @ced_id_number}) if @ced_id_number
params.merge!({'dotasiacedstateprovince' => @ced_state_province}) if @ced_state_province
return params
end
|
#valid?(inputs = {}) ⇒ Boolean
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/internetbs/dot_asia_attributes.rb', line 42
def valid?(inputs = {})
ensure_attribute_has_value :ced_locality, :ced_entity, :ced_id_form
unless CED_ENTITY_TYPES.include?(@ced_entity)
@errors << "ced_entity must be one of CED_ENTITY_TYPES"
end
unless CED_ID_FORM_TYPES.include?(@ced_id_form)
@errors << "ced_id_form must be one of CED_ID_FORM_TYPES"
end
ensure_attribute_has_value :ced_entity_other if @ced_entity == 'other'
ensure_attribute_has_value :ced_id_form_other if @ced_id_form == 'other'
ensure_attribute_has_value :cd_id_number if is_sunrise?
super
end
|