Class: Registrar::Provider::OpenSRS::TldDataUs

Inherits:
Object
  • Object
show all
Defined in:
lib/registrar/provider/opensrs/tld_data_us.rb

Constant Summary collapse

DEFINITIONS =
{
  :"US Citizen" => 'C11',
  :"Business Entity" => 'C21',
  :"Foreign Entity" => 'C31',
  :"Permanent Resident" => 'C12',
  :"US Based Office" => 'C22',
  :"For Profit" => 'P1',
  :"Non Profit" => 'P2',
  :Personal => 'P3',
  :Educational => 'P4',
  :Government => 'P5'
}
SELECT_OPTION =
->(options, name){
  options.select { |option| option.name == name }.first.value
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ TldDataUs

Returns a new instance of TldDataUs.



26
27
28
29
# File 'lib/registrar/provider/opensrs/tld_data_us.rb', line 26

def initialize options
  @category    = DEFINITIONS[SELECT_OPTION.call(options, :Nexus)]
  @app_purpose = DEFINITIONS[SELECT_OPTION.call(options, :Purpose)]
end

Instance Attribute Details

#app_purposeObject (readonly)

Returns the value of attribute app_purpose.



7
8
9
# File 'lib/registrar/provider/opensrs/tld_data_us.rb', line 7

def app_purpose
  @app_purpose
end

#categoryObject (readonly)

Returns the value of attribute category.



6
7
8
# File 'lib/registrar/provider/opensrs/tld_data_us.rb', line 6

def category
  @category
end

Instance Method Details

#to_xml(context) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/registrar/provider/opensrs/tld_data_us.rb', line 31

def to_xml(context)
  context.dt_assoc do |dt_assoc|
    dt_assoc.item(key: 'nexus') do |item|
      item.dt_assoc do |inner_dt_assoc|
        inner_dt_assoc.item(key: 'category') do |category|
          category.text! @category
        end
        inner_dt_assoc.item(key: 'app_purpose') do
          |purpose| purpose.text! @app_purpose
        end
      end
    end
  end
end