Class: ActionService::Protocol::Soap::SoapMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/action_service/protocol/soap.rb

Overview

:nodoc:

Direct Known Subclasses

SoapArrayMapping

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapper, type_name, ruby_klass, generated_klass, soap_klass, registry_mapping, custom_type = false) ⇒ SoapMapping

Returns a new instance of SoapMapping.



400
401
402
403
404
405
406
407
408
409
# File 'lib/action_service/protocol/soap.rb', line 400

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_klassObject (readonly)

Returns the value of attribute generated_klass.



396
397
398
# File 'lib/action_service/protocol/soap.rb', line 396

def generated_klass
  @generated_klass
end

#registry_mappingObject (readonly)

Returns the value of attribute registry_mapping.



398
399
400
# File 'lib/action_service/protocol/soap.rb', line 398

def registry_mapping
  @registry_mapping
end

#ruby_klassObject (readonly)

Returns the value of attribute ruby_klass.



395
396
397
# File 'lib/action_service/protocol/soap.rb', line 395

def ruby_klass
  @ruby_klass
end

#soap_klassObject (readonly)

Returns the value of attribute soap_klass.



397
398
399
# File 'lib/action_service/protocol/soap.rb', line 397

def soap_klass
  @soap_klass
end

Instance Method Details

#custom_type?Boolean

Returns:

  • (Boolean)


415
416
417
# File 'lib/action_service/protocol/soap.rb', line 415

def custom_type?
  @custom_type
end

#each_attribute(&block) ⇒ Object



428
429
430
431
432
433
434
435
436
# File 'lib/action_service/protocol/soap.rb', line 428

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

Returns:

  • (Boolean)


438
439
440
# File 'lib/action_service/protocol/soap.rb', line 438

def is_xsd_type?(klass)
  klass.ancestors.include?(XSD::NSDBase)
end

#qualified_type_nameObject



419
420
421
422
423
424
425
426
# File 'lib/action_service/protocol/soap.rb', line 419

def qualified_type_name
  name = type_name
  if custom_type?
    "typens:#{name}"
  else
    xsd_type_for(@soap_klass)
  end
end

#type_nameObject



411
412
413
# File 'lib/action_service/protocol/soap.rb', line 411

def type_name
  @type_name
end

#xsd_type_for(klass) ⇒ Object



442
443
444
445
446
447
448
# File 'lib/action_service/protocol/soap.rb', line 442

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