Class: Registrar::Provider::OpenSRS::Operation
- Inherits:
-
Object
- Object
- Registrar::Provider::OpenSRS::Operation
- Defined in:
- lib/registrar/provider/opensrs/operation.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#initialize(action, attributes) ⇒ Operation
constructor
A new instance of Operation.
- #to_xml ⇒ Object
Constructor Details
#initialize(action, attributes) ⇒ Operation
Returns a new instance of Operation.
6 7 8 9 10 |
# File 'lib/registrar/provider/opensrs/operation.rb', line 6 def initialize(action, attributes) @action = action @object = :domain @attributes = attributes end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/registrar/provider/opensrs/operation.rb', line 5 def action @action end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/registrar/provider/opensrs/operation.rb', line 5 def attributes @attributes end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/registrar/provider/opensrs/operation.rb', line 5 def object @object end |
Instance Method Details
#to_xml ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/registrar/provider/opensrs/operation.rb', line 11 def to_xml builder = Builder::XmlMarkup.new builder.OPS_envelope { |b| b.header { |b| b.version('0.9') } b.body { |b| b.data_block { |b| b.dt_assoc { |b| b.item("XCP", :key => "protocol") b.item(action.to_s.upcase, :key => "action") b.item(object.to_s.upcase, :key => "object") b.item(:key => "attributes") { |b| b.dt_assoc { |b| attributes.each do |key, value| if (value.respond_to?(:to_xml)) b.item(:key => key.to_s) { value.to_xml(b) } else b.item(value.to_s, :key => key.to_s) end end } } } } } } end |