Class: ActionWebService::Protocol::Soap::SoapMapping
- Inherits:
-
Object
- Object
- ActionWebService::Protocol::Soap::SoapMapping
- Defined in:
- lib/action_web_service/protocol/soap_protocol.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#generated_klass ⇒ Object
readonly
Returns the value of attribute generated_klass.
-
#registry_mapping ⇒ Object
readonly
Returns the value of attribute registry_mapping.
-
#ruby_klass ⇒ Object
readonly
Returns the value of attribute ruby_klass.
-
#soap_klass ⇒ Object
readonly
Returns the value of attribute soap_klass.
Instance Method Summary collapse
- #custom_type? ⇒ Boolean
- #each_attribute(&block) ⇒ Object
-
#initialize(mapper, type_name, ruby_klass, generated_klass, soap_klass, registry_mapping, custom_type = false) ⇒ SoapMapping
constructor
A new instance of SoapMapping.
- #is_xsd_type?(klass) ⇒ Boolean
- #qualified_type_name ⇒ Object
- #type_name ⇒ Object
- #xsd_type_for(klass) ⇒ Object
Constructor Details
#initialize(mapper, type_name, ruby_klass, generated_klass, soap_klass, registry_mapping, custom_type = false) ⇒ SoapMapping
Returns a new instance of SoapMapping.
417 418 419 420 421 422 423 424 425 426 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 417 def initialize(mapper, type_name, ruby_klass, generated_klass, soap_klass, registry_mapping, custom_type=false) @mapper = mapper @type_name = type_name @ruby_klass = ruby_klass @generated_klass = generated_klass @soap_klass = soap_klass @registry_mapping = registry_mapping @custom_type = custom_type end |
Instance Attribute Details
#generated_klass ⇒ Object (readonly)
Returns the value of attribute generated_klass.
413 414 415 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 413 def generated_klass @generated_klass end |
#registry_mapping ⇒ Object (readonly)
Returns the value of attribute registry_mapping.
415 416 417 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 415 def registry_mapping @registry_mapping end |
#ruby_klass ⇒ Object (readonly)
Returns the value of attribute ruby_klass.
412 413 414 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 412 def ruby_klass @ruby_klass end |
#soap_klass ⇒ Object (readonly)
Returns the value of attribute soap_klass.
414 415 416 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 414 def soap_klass @soap_klass end |
Instance Method Details
#custom_type? ⇒ Boolean
432 433 434 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 432 def custom_type? @custom_type end |
#each_attribute(&block) ⇒ Object
445 446 447 448 449 450 451 452 453 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 445 def each_attribute(&block) if @ruby_klass.respond_to?(:members) @ruby_klass.members.each do |name, klass| name = name.to_s mapping = @mapper.lookup(klass) yield name, mapping.qualified_type_name, mapping end end end |
#is_xsd_type?(klass) ⇒ Boolean
455 456 457 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 455 def is_xsd_type?(klass) klass.ancestors.include?(XSD::NSDBase) end |
#qualified_type_name ⇒ Object
436 437 438 439 440 441 442 443 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 436 def qualified_type_name name = type_name if custom_type? "typens:#{name}" else xsd_type_for(@soap_klass) end end |
#type_name ⇒ Object
428 429 430 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 428 def type_name @type_name end |
#xsd_type_for(klass) ⇒ Object
459 460 461 462 463 464 465 |
# File 'lib/action_web_service/protocol/soap_protocol.rb', line 459 def xsd_type_for(klass) ns = XSD::NS.new ns.assign(XSD::Namespace, SOAP::XSDNamespaceTag) xsd_klass = klass.ancestors.find{|c| c.const_defined?('Type')} return ns.name(XSD::AnyTypeName) unless xsd_klass ns.name(xsd_klass.const_get('Type')) end |