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

Converting collapse

Instance Method Summary collapse

Methods inherited from TypeMapping

#description, #initialize, #warn_unparseable_data

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:



229
230
231
# File 'lib/savon_helper/type_mappings.rb', line 229

def default_value
  ""
end

#object_klassClass

This method is abstract.

Return the class represented by the mapping.

TODO:

Is this really neccessary?

Returns:

  • (Class)


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

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:



201
202
203
# File 'lib/savon_helper/type_mappings.rb', line 201

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:



208
209
210
# File 'lib/savon_helper/type_mappings.rb', line 208

def to_savon(value)
  value.to_s
end

#type_stringString

Return the class description represented by the mapping.

Returns:



223
224
225
# File 'lib/savon_helper/type_mappings.rb', line 223

def type_string
  "String"
end