module MsRest::Serialization

Base module for Ruby serialization and deserialization.

Provides methods to serialize Ruby object into Ruby Hash and to deserialize Ruby Hash into Ruby object.

Public Instance Methods

deserialize(mapper, response_body) click to toggle source

Deserialize the response from the server using the mapper.

@param mapper [Hash] Ruby Hash object to represent expected structure of the response_body. @param response_body [Hash] Ruby Hash object to deserialize. @param object_name [String] Name of the deserialized object.

# File lib/ms_rest/serialization.rb, line 18
def deserialize(mapper, response_body)
  build_serializer.deserialize(mapper, response_body)
end
serialize(mapper, object) click to toggle source

Serialize the Ruby object into Ruby Hash to send it to the server using the mapper.

@param mapper [Hash] Ruby Hash object to represent expected structure of the object. @param object [Object] Ruby object to serialize. @param object_name [String] Name of the serialized object.

# File lib/ms_rest/serialization.rb, line 29
def serialize(mapper, object)
  build_serializer.serialize(mapper, object)
end

Private Instance Methods

build_serializer() click to toggle source

Builds serializer

# File lib/ms_rest/serialization.rb, line 38
def build_serializer
  Serialization.new(self)
end