Class: SavonHelper::StringMapping

Inherits:
TypeMapping show all
Defined in:
lib/savon_helper/type_mappings.rb

Overview

StringMapping maps Savon data to Ruby strings.

Direct Known Subclasses

IPAddressMapping

Instance Attribute Summary

Attributes inherited from TypeMapping

#description, #name

Converting collapse

Instance Method Summary collapse

Methods inherited from TypeMapping

#initialize

Constructor Details

This class inherits a constructor from SavonHelper::TypeMapping

Instance Method Details

#default_valueObject

This method is abstract.

Return the default value the mapping.

Returns:



216
217
218
# File 'lib/savon_helper/type_mappings.rb', line 216

def default_value
  ""
end

#object_klassClass

This method is abstract.

Return the class represented by the mapping.

TODO:

Is this really neccessary?

Returns:

  • (Class)


204
205
206
# File 'lib/savon_helper/type_mappings.rb', line 204

def object_klass
  String
end

#to_native(data, interface) ⇒ String

Convert from Savon data to Ruby strings

Parameters:

  • data (Hash, String)

    Source Savon data

Returns:



188
189
190
# File 'lib/savon_helper/type_mappings.rb', line 188

def to_native(data, interface)
  data.to_s
end

#to_savon(value) ⇒ String

Convert from Ruby string type to Savon data

Parameters:

  • value (String)

    Source Ruby data

Returns:



195
196
197
# File 'lib/savon_helper/type_mappings.rb', line 195

def to_savon(value)
  value.to_s
end

#type_stringString

Return the class description represented by the mapping.

Returns:



210
211
212
# File 'lib/savon_helper/type_mappings.rb', line 210

def type_string
  "String"
end