Class: Ingenico::Direct::SDK::Marshaller

Inherits:
Object
  • Object
show all
Defined in:
lib/ingenico/direct/sdk/marshaller.rb

Overview

Class responsible for marshalling and unmarshalling objects to and from JSON

Direct Known Subclasses

DefaultImpl::DefaultMarshaller

Instance Method Summary collapse

Instance Method Details

#marshal(request_object) ⇒ String

Marshals request_object to JSON format by calling #to_h on it.

Parameters:

Returns:

  • (String)

    request_object converted to JSON

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/ingenico/direct/sdk/marshaller.rb', line 10

def marshal(request_object)
  raise NotImplementedError
end

#unmarshal(response_json, type) ⇒ Object

Unmarshals a JSON string into an object of type type. The new object is initialized by calling .new_from_hash with contents of the JSON as a Hash object.

Parameters:

  • response_json (String)

    The JSON to unmarshal

  • type (Type)

    The class of the object that will be instantiated using type.new_from_hash

Returns:

  • The JSON unmarshalled to the given type

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/ingenico/direct/sdk/marshaller.rb', line 20

def unmarshal(response_json, type)
  raise NotImplementedError
end