Class: ActionWebService::Simple

Inherits:
Object
  • Object
show all
Defined in:
lib/action_web_service/simple.rb

Overview

To send simple types across the wire, derive from ActionWebService::Simple, and use base to declare the base type for it restriction and, use restriction to declare valid W3C restriction element for SimpleType.

ActionWebService::Simple should be used when you want to declare valid custom simple type to be used inside expects, returns and structured types

There plenty documentation available at W3C Archives www.w3.org/TR/xmlschema-2/

Example

class Gender < ActionWebService::Simple
  base :string
  restriction :enumeration, "male|female"
end

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Simple

Returns a new instance of Simple.



24
25
26
# File 'lib/action_web_service/simple.rb', line 24

def initialize(value)
  @value = value
end

Class Method Details

.base(type) ⇒ Object



33
34
35
36
# File 'lib/action_web_service/simple.rb', line 33

def base(type)
  type = type.to_s.camelize(:lower)
  self.xml_base = type
end

.restriction(type, value) ⇒ Object



42
43
44
45
# File 'lib/action_web_service/simple.rb', line 42

def restriction(type, value)
  type = type.to_s.camelize(:lower)
  self.simple_restrictions = self.simple_restrictions.merge({ type => value })
end

.restriction_baseObject



38
39
40
# File 'lib/action_web_service/simple.rb', line 38

def restriction_base
  self.xml_base
end

.restrictionsObject



47
48
49
# File 'lib/action_web_service/simple.rb', line 47

def restrictions
  self.simple_restrictions
end