Class: InternetBS::DotUKAttributes

Inherits:
AdditionalAttributes show all
Defined in:
lib/internetbs/dot_uk_attributes.rb

Constant Summary collapse

ORGANIZATION_TYPES =
{
  'LTD'    => 'UK Limited Company',
  'PLC'    => 'UK Public Limited Company',
  'PTNR'   => 'UK Partnership',
  'STRA'   => 'UK Sole Trader',
  'LLP'    => 'UK Limited Liability Partnership',
  'IP'     => 'UK Industrial/Provident Registered Company',
  'IND'    => 'UK Individual (self representing)',
  'SCH'    => 'UK School',
  'RCHAR'  => 'UK Registered Charity',
  'GOV'    => 'UK Government Body',
  'CRO'    => 'UK Corporation by Royal Charter',
  'STAT'   => 'UK Statutory Body',
  'OTHER'  => 'UK Entity that does not fit into any of the above',
  'FIND'   => 'Non-UK Individual (self representing)',
  'FCORP'  => 'Non-UK Corporation',
  'FOTHER' => 'Non-UK Entity that does not fit into any of the above'
}

Instance Method Summary collapse

Methods inherited from AdditionalAttributes

#admin_params, #billing_params, #mandatory_params, #zone_params

Methods inherited from Base

#inspect

Instance Method Details

#optional_paramsObject



41
42
43
44
45
46
47
# File 'lib/internetbs/dot_uk_attributes.rb', line 41

def optional_params
  params = {} 
  if %w[IND FIND].include?(@organization_type)
    params.merge!({"#{@contact_type.to_s}_dotukoptout" => @opt_out ? 'Y' : 'N'})
  end
  return params
end

#registrant_paramsObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/internetbs/dot_uk_attributes.rb', line 30

def registrant_params
  params = {'registrant_county' => @county, 'registrant_dotukorgtype' => @organization_type}
  if %w[LTD PLC LLP IP SCH RCHAR].include?(@organization_type)
    params.merge!({
      'registrant_dotukorgno' => @organization_number, 
      'registrant_dotukregistrationnumber' => @registration_number
    })
  end
  returns params
end

#valid?(inputs = {}) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
52
53
54
55
56
57
58
# File 'lib/internetbs/dot_uk_attributes.rb', line 49

def valid?(inputs = {})
  ensure_attribute_has_value :county, :organization_type
  unless ORGANIZATION_TYPES.has_key?(@organization_type)
    @errors << "organization_type must be one in ORGANIZATION_TYPES"
  end
  if %w[LTD PLC LLP IP SCH RCHAR].include?(@organization_type)
    ensure_attribute_has_value :organization_number, :registration_number
  end
  super
end