Class: Registrar::Provider::OpenSRS::TldDataUs
- Inherits:
-
Object
- Object
- Registrar::Provider::OpenSRS::TldDataUs
- 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 =
->(, name){ .select { |option| option.name == name }.first.value }
Instance Attribute Summary collapse
-
#app_purpose ⇒ Object
readonly
Returns the value of attribute app_purpose.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
Instance Method Summary collapse
-
#initialize(options) ⇒ TldDataUs
constructor
A new instance of TldDataUs.
- #to_xml(context) ⇒ Object
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 @category = DEFINITIONS[SELECT_OPTION.call(, :Nexus)] @app_purpose = DEFINITIONS[SELECT_OPTION.call(, :Purpose)] end |
Instance Attribute Details
#app_purpose ⇒ Object (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 |
#category ⇒ Object (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 |